diff --git a/makedebian.pl b/makedebian.pl index f375787fe..b3060ae7f 100755 --- a/makedebian.pl +++ b/makedebian.pl @@ -260,16 +260,19 @@ system("chmod 755 $preinstall_file"); open(SCRIPT, ">$postinstall_file"); print SCRIPT </dev/null 2>&1 /dev/null 2>&1 /dev/null 2>&1 /dev/null 2>&1 /dev/null 2>&1 /dev/null 2>&1 /dev/null 2>&1 /dev/null 2>&1 /dev/null 2>&1 /dev/null 2>&1"); } + else { + $killmodenonepl = 1; + } } } @@ -566,6 +573,12 @@ else { # Define final start command if ($upgrading) { $start_cmd = "$config_directory/.post-install"; + if ($killmodenonepl == 1) { + $start_cmd = "$config_directory/.reload-init"; + } + else { + $start_cmd = "$config_directory/.post-install"; + } } else { $start_cmd = "$config_directory/start"; @@ -880,9 +893,14 @@ if (-r "$srcdir/setup-post.pl") { if (!$ENV{'nostart'}) { if (!$miniserv{'inetd'}) { print "Attempting to start Webmin web server..\n"; + $action = 'start'; + if ($upgrading) { + $action = 'restart'; + } + print "Attempting to $action Webmin web server ..\n"; $ex = system($start_cmd); if ($ex) { - &errorexit("Failed to start web server!"); + &errorexit("Failed to $action web server!"); } print "..done\n"; print "\n"; diff --git a/setup.sh b/setup.sh index 06dbd4156..44de03eb4 100755 --- a/setup.sh +++ b/setup.sh @@ -614,6 +614,11 @@ if [ "$noperlpath" = "" ]; then echo "" fi +killmodenonesh=0 +if [ ! -f "$config_dir/.pre-install" ]; then + killmodenonesh=1 +fi + # Re-generating main scripts echo "Creating start and stop init scripts.." # Start main @@ -940,10 +945,25 @@ fi if [ "$nostart" = "" ]; then if [ "$inetd" != "1" ]; then - echo "Attempting to start Webmin web server.." - $config_dir/.post-install + action="start" + if [ "$upgrading" = "1" ]; then + action="restart" + fi + echo "Attempting to $action Webmin web server.." + # If upgrading, restart + if [ "$upgrading" = "1" ]; then + if [ "$killmodenonesh" != "1" ]; then + $config_dir/.post-install >/dev/null 2>&1 + else + $config_dir/.reload-init >/dev/null 2>&1 + fi + # If installing first time, start it + else + $config_dir/start >/dev/null 2>&1 + fi + if [ $? != "0" ]; then - echo "ERROR: Failed to start web server!" + echo "ERROR: Failed to $action web server!" echo "" exit 14 fi