diff --git a/makedebian.pl b/makedebian.pl index 472004f35..2d4dbbfae 100755 --- a/makedebian.pl +++ b/makedebian.pl @@ -333,6 +333,10 @@ if [ "\$inetd" != "1" ]; then /etc/$baseproduct/.post-install >/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 >$config_directory/start.bat"); @@ -629,6 +629,18 @@ else { print RELOAD "kill -USR1 \`cat \$pidfile\`\n"; close(RELOAD); + # Switch to systemd from init (intermediate) + if ($killmodenonepl == 1 && -x $systemctlcmd) { + if ($ver < 1.994) { + open(SDRELOAD, ">$config_directory/.reload-init-systemd"); + print SDRELOAD "#!/bin/sh\n"; + print SDRELOAD "$config_directory/.stop-init\n"; + print SDRELOAD "$config_directory/start\n"; + close(SDRELOAD); + chmod(0755, "$config_directory/.reload-init-systemd"); + } + } + # Pre install open(PREINST, ">$config_directory/.pre-install"); print PREINST "#!/bin/sh\n"; @@ -671,7 +683,6 @@ else { symlink("$config_directory/.reload-init", "$config_directory/reload"); # For systemd - my $systemctlcmd = &has_command('systemctl'); if (-x $systemctlcmd) { # Clear existing @@ -894,8 +905,17 @@ if (!$ENV{'nostart'}) { if ($upgrading) { $action = 'restart'; } + my $start_cmd_extra; + if ($upgrading && $killmodenonepl == 1) { + $start_cmd_extra = "$config_directory/.reload-init-systemd"; + if (-r $start_cmd_extra) { + $start_cmd .= " ; $start_cmd_extra"; + } + } print "Attempting to $action Webmin web server ..\n"; $ex = system($start_cmd); + unlink($start_cmd_extra) + if (-r $start_cmd_extra); if ($ex) { &errorexit("Failed to $action web server!"); } diff --git a/setup.sh b/setup.sh index 37d125957..a43832c3e 100755 --- a/setup.sh +++ b/setup.sh @@ -674,12 +674,15 @@ echo "#!/bin/sh" >$config_dir/.reload-init echo "echo Reloading Webmin server in $wadir" >>$config_dir/.reload-init echo "pidfile=\`grep \"^pidfile=\" $config_dir/miniserv.conf | sed -e 's/pidfile=//g'\`" >>$config_dir/.reload-init echo "kill -USR1 \`cat \$pidfile\`" >>$config_dir/.reload-init +# Switch to systemd from init (intermediate) if [ "$killmodenonesh" = "1" ] && [ -x "$systemctlcmd" ]; then current_version=`cat "$config_dir/version" 2>/dev/null` ancient_version=`echo $current_version 1.994 | awk '{if ($1 < $2) print 1; else print 0}'` if [ "$ancient_version" = "1" ]; then - echo "$config_dir/.stop-init" >>$config_dir/.reload-init - echo "$config_dir/start" >>$config_dir/.reload-init + echo "#!/bin/sh" >$config_dir/.reload-init-systemd + echo "$config_dir/.stop-init" >>$config_dir/.reload-init-systemd + echo "$config_dir/start" >>$config_dir/.reload-init-systemd + chmod 755 $config_dir/.reload-init-systemd fi fi # Pre install