Fix to work-around if Webmin 1.994 is running outside of systemd

This commit is contained in:
iliajie
2022-08-05 21:25:26 +03:00
parent 18c12abef5
commit f0f680d76f

View File

@@ -676,10 +676,23 @@ echo "pidfile=\`grep \"^pidfile=\" $config_dir/miniserv.conf | sed -e 's/pidfile
echo "kill -USR1 \`cat \$pidfile\`" >>$config_dir/.reload-init
if [ -x "$systemctlcmd" ]; then
current_version=`cat "$config_dir/version" 2>/dev/null`
ancient_version=`echo $current_version 1.993 | 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
if [ "$current_version" != "" ]; then
ancient_version=`echo $current_version 1.994 | awk '{if ($1 < $2) print 1; else print 0}'`
# If upgrading from ancient version
if [ "$ancient_version" = "1" ]; then
echo "$config_dir/.stop-init" >>$config_dir/.reload-init
echo "$config_dir/start" >>$config_dir/.reload-init
fi
# If Webmin 1.994 is started outside of systemd, and
# has no pid file (possible if upgraded from < 1.990)
if [ "$current_version" = "1.994" ] && [ ! -f "$var_dir/miniserv.pid" ]; then
echo "if [ ! -f \"\$pidfile\" ]; then" >>$config_dir/.reload-init
# If started with systemd (with KillMode=none)
echo " $config_dir/stop" >>$config_dir/.reload-init
# Start service
echo " $config_dir/start" >>$config_dir/.reload-init
echo "fi" >>$config_dir/.reload-init
fi
fi
fi
# Pre install