Просмотр исходного кода

Post Install Should Be Run Here Too

own3mall 8 лет назад
Родитель
Сommit
2843799f66
1 измененных файлов с 23 добавлено и 0 удалено
  1. 23 0
      ogp_agent.pl

+ 23 - 0
ogp_agent.pl

@@ -1655,6 +1655,29 @@ sub start_file_download
 				uncompress_file_without_decrypt($download_file_path,
 												$destination);
 			}
+			
+			# Run post scripts if any
+			if ($post_script ne "")
+			{
+				logger "Running postscript commands.";
+				my @postcmdlines = split /[\r\n]+/, $post_script;
+				my $postcmdfile = $destination."/".'postinstall.sh';
+				open  FILE, '>', $postcmdfile;
+				print FILE "cd $destination\n";
+				print FILE "while kill -0 $pid >/dev/null 2>&1\n";
+				print FILE "do\n";
+				print FILE "	sleep 1\n";
+				print FILE "done\n";
+				foreach my $line (@postcmdlines) {
+					print FILE "$line\n";
+				}
+				print FILE "rm -f $destination/postinstall.sh\n";
+				close FILE;
+				chmod 0755, $postcmdfile;
+				my $screen_id = create_screen_id("post_script", $pid);
+				my $cli_bin = create_screen_cmd($screen_id, "bash $postcmdfile");
+				system($cli_bin);
+			}
 		}
 		else
 		{