44 changes: 37 additions & 7 deletions makedebian.pl
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
-r "tarballs/$product-$ver.tar.gz" || die "tarballs/$product-$ver.tar.gz not found";

# Create the base directories
print "Creating Debian package of ",ucfirst($product)," ",$ver,$rel," ...\n";
print "Creating Debian package of ",ucfirst($product)," ",$ver,$rel," ..\n";
system("rm -rf $tmp_dir");
mkdir($tmp_dir, 0755);
chmod(0755, $tmp_dir);
Expand Down Expand Up @@ -260,16 +260,19 @@
open(SCRIPT, ">$postinstall_file");
print SCRIPT <<EOF;
#!/bin/sh
killmodenone=0
justinstalled=1
if [ -e "/etc/$baseproduct" ]; then
if [ -d "/etc/$baseproduct" ]; then
justinstalled=0
fi
inetd=`grep "^inetd=" /etc/$baseproduct/miniserv.conf 2>/dev/null | sed -e 's/inetd=//g'`
if [ "\$1" = "configure" ]; then
# Upgrading the package, so stop the old Webmin properly
if [ "\$inetd" != "1" ]; then
if [ -e "/etc/$baseproduct/.pre-install" ]; then
if [ -f "/etc/$baseproduct/.pre-install" ]; then
/etc/$baseproduct/.pre-install >/dev/null 2>&1 </dev/null
else
killmodenone=1
fi
fi
fi
Expand Down Expand Up @@ -314,16 +317,30 @@
fi
rm -f /var/lock/subsys/$baseproduct
if [ "$inetd" != "1" ]; then
if [ "\$inetd" != "1" ]; then
productucf=Webmin
productspace=""
if [ "$product" = "usermin" ]; then
productucf=Usermin
productspace=" "
fi
if [ "\$justinstalled" = "1" ]; then
/etc/$baseproduct/start >/dev/null 2>&1 </dev/null
if [ "\$?" != "0" ]; then
echo "E: Webmin server cannot be started. It is advised to start it manually\n by running \\"/etc/webmin/restart-by-force-kill\\" command"
echo "E: \${productucf} server cannot be started. It is advised to start it manually\n \${productspace} by running \\"/etc/$baseproduct/restart-by-force-kill\\" command"
fi
else
/etc/$baseproduct/.post-install >/dev/null 2>&1 </dev/null
if [ "$product" = "webmin" ]; then
if [ "\$killmodenone" != "1" ]; then
/etc/$baseproduct/.post-install >/dev/null 2>&1 </dev/null
else
/etc/$baseproduct/.reload-init >/dev/null 2>&1 </dev/null
fi
else
/etc/$baseproduct/restart >/dev/null 2>&1 </dev/null
fi
if [ "\$?" != "0" ]; then
echo "W: Webmin server cannot be restarted. It is advised to restart it manually\n by running \\"/etc/webmin/restart-by-force-kill\\" command when upgrade process is finished"
echo "W: \${productucf} server cannot be restarted. It is advised to restart it manually\n \${productspace} by running \\"/etc/$baseproduct/restart-by-force-kill\\" command when upgrade process is finished"
fi
fi
fi
Expand All @@ -336,6 +353,12 @@
if [ "\\\$answer" = "y" ]; then
echo "Removing $ucproduct package .."
dpkg --remove --force-depends $product
systemctlcmd=\\\`which systemctl 2>/dev/null\\\`
if [ -x "\\\$systemctlcmd" ]; then
\\\$systemctlcmd stop $product >/dev/null 2>&1 </dev/null
rm -f /lib/systemd/system/$product.service
\\\$systemctlcmd daemon-reload
fi
echo ".. done"
fi
EOFF
Expand Down Expand Up @@ -376,6 +399,13 @@
/etc/$baseproduct/stop >/dev/null 2>&1 </dev/null
if [ "$product" = "webmin" ]; then
(cd /usr/share/$baseproduct ; WEBMIN_CONFIG=/etc/$baseproduct WEBMIN_VAR=/var/$baseproduct LANG= /usr/share/$baseproduct/run-uninstalls.pl) >/dev/null 2>&1 </dev/null
else
systemctlcmd=\`which systemctl 2>/dev/null\`
if [ -x "\$systemctlcmd" ]; then
\$systemctlcmd stop $product >/dev/null 2>&1 </dev/null
rm -f /lib/systemd/system/$product.service
\$systemctlcmd daemon-reload
fi
fi
/bin/true
fi
Expand Down
11 changes: 9 additions & 2 deletions makerpm.pl
Original file line number Diff line number Diff line change
Expand Up @@ -170,11 +170,14 @@
%post
inetd=`grep "^inetd=" /etc/webmin/miniserv.conf 2>/dev/null | sed -e 's/inetd=//g'`
killmodenone=0
if [ "\$1" != 1 ]; then
# Upgrading the RPM, so stop the old Webmin properly
if [ "\$inetd" != "1" ]; then
if [ -e /etc/webmin/.pre-install ]; then
if [ -f /etc/webmin/.pre-install ]; then
/etc/webmin/.pre-install >/dev/null 2>&1 </dev/null
else
killmodenone=1
fi
fi
fi
Expand Down Expand Up @@ -220,7 +223,11 @@
echo "error: Webmin server cannot be started. It is advised to start it manually\n by running \\"/etc/webmin/restart-by-force-kill\\" command"
fi
else
/etc/webmin/.post-install >/dev/null 2>&1 </dev/null
if [ "\$killmodenone" != "1" ]; then
/etc/webmin/.post-install >/dev/null 2>&1 </dev/null
else
/etc/webmin/.reload-init >/dev/null 2>&1 </dev/null
fi
if [ "\$?" != "0" ]; then
echo "warning: Webmin server cannot be restarted. It is advised to restart it manually\n by running \\"/etc/webmin/restart-by-force-kill\\" when upgrade process is finished"
fi
Expand Down
29 changes: 19 additions & 10 deletions package-updates/update.cgi
Original file line number Diff line number Diff line change
Expand Up @@ -59,16 +59,24 @@ else {

if (@ops) {
# Ask first
print &ui_form_start("update.cgi", "post");
print &ui_hidden("mode", $in{'mode'});
print &ui_hidden("search", $in{'search'});
print &ui_hidden("redir", $in{'redir'});
print &ui_hidden("redirdesc", $in{'redirdesc'});
foreach $ps (@pkgs) {
print &ui_hidden("u", $ps);
}
print &text('update_rusure', scalar(@ops)),"<p>\n";
print &ui_form_end([ [ "confirm", $text{'update_confirm'} ] ]);
my $getconfform = sub {
my ($bottom) = @_;
my $bottom_sel;
$bottom_sel = 'data-outside-of-viewport'
if ($bottom);
my $confform = &ui_form_start("update.cgi", "post", undef, $bottom_sel);
$confform .= &ui_hidden("mode", $in{'mode'});
$confform .= &ui_hidden("search", $in{'search'});
$confform .= &ui_hidden("redir", $in{'redir'});
$confform .= &ui_hidden("redirdesc", $in{'redirdesc'});
foreach $ps (@pkgs) {
$confform .= &ui_hidden("u", $ps);
}
$confform .= &text('update_rusure', scalar(@ops)),"<p>\n"
if (!$bottom);
$confform .= &ui_form_end([ [ "confirm", $text{'update_confirm'} ] ]);
};
print &$getconfform();

# Show table of all depends
@current = &list_current(1);
Expand Down Expand Up @@ -96,6 +104,7 @@ else {
]);
}
print &ui_columns_end();
print &$getconfform(1), &ui_hide_outside_of_viewport();
}
else {
# Check if a reboot was required before
Expand Down
71 changes: 43 additions & 28 deletions setup.pl
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
if ($ARGV[0]) {
$wadir = $ARGV[0];
$wadir =~ s/\\/\//g; # always use / separator on windows
print "Installing Webmin from $srcdir to $wadir ...\n";
print "Installing Webmin from $srcdir to $wadir\n";
if (!-d $wadir) {
mkdir($wadir, 0755) || &errorexit("Failed to create $wadir");
}
Expand All @@ -52,7 +52,7 @@
}
}
else {
print "Installing Webmin in $wadir ...\n"
print "Installing Webmin in $wadir\n"
}

# Work out perl library path
Expand Down Expand Up @@ -100,16 +100,19 @@
&errorexit("Failed to create directory $config_directory");
}
if (-r "$config_directory/config") {
print "Found existing Webmin configuration in $config_directory\n";
print "\n";
$upgrading=1
print ".. found\n";
$upgrading = 1;
}

# We can now load the main Webmin library
$ENV{'WEBMIN_CONFIG'} = $config_directory;
$ENV{'WEBMIN_VAR'} = "/var/webmin"; # Only used for initial load of web-lib
require "$srcdir/web-lib-funcs.pl";

# Do we need to reload instead
# Can be deleted with Webmin 2.0
$killmodenonepl = 0;

# Check if upgrading from an old version
if ($upgrading) {
print "\n";
Expand Down Expand Up @@ -146,6 +149,9 @@
if (-r "$config_directory/.pre-install") {
system("$config_directory/.pre-install >/dev/null 2>&1");
}
else {
$killmodenonepl = 1;
}
}
}

Expand All @@ -167,7 +173,7 @@
$autothird = 1;
}
system("$perl ".&quote_path("$wadir/thirdparty.pl")." ".&quote_path($wadir)." ".&quote_path($oldwadir)." $autothird");
print "..done\n";
print ".. done\n";
print "\n";
}

Expand Down Expand Up @@ -370,7 +376,7 @@
print VAR $var_dir,"\n";
close(VAR);

print "Creating web server config files..";
print "Creating web server config files ..\n";
$ufile = "$config_directory/miniserv.users";
$kfile = "$config_directory/miniserv.pem";
%miniserv = ( 'port' => $port,
Expand Down Expand Up @@ -497,10 +503,10 @@
&copy_source_dest("$wadir/miniserv.pem", $kfile);
}
chmod(0600, $kfile);
print "..done\n";
print ".. done\n";
print "\n";

print "Creating access control file..\n";
print "Creating access control file ..\n";
$afile = "$config_directory/webmin.acl";
open(AFILE, ">$afile");
if ($ENV{'defaultmods'}) {
Expand All @@ -511,7 +517,7 @@
}
close(AFILE);
chmod(0600, $afile);
print "..done\n";
print ".. done\n";
print "\n";

if ($login ne "root" && $login ne "admin") {
Expand All @@ -523,13 +529,13 @@
}

if (!$ENV{'noperlpath"'} && $os_type ne 'windows') {
print "Inserting path to perl into scripts..\n";
print "Inserting path to perl into scripts ..\n";
system("(find ".&quote_path($wadir)." -name '*.cgi' -print ; find ".&quote_path($wadir)." -name '*.pl' -print) | $perl ".&quote_path("$wadir/perlpath.pl")." $perl -");
print "..done\n";
print ".. done\n";
print "\n";
}

print "Creating start and stop scripts..\n";
print "Creating start and stop scripts ..\n";
if ($os_type eq "windows") {
open(START, ">>$config_directory/start.bat");
print START "$perl \"$wadir/miniserv.pl\" $config_directory/miniserv.conf\n";
Expand Down Expand Up @@ -565,7 +571,12 @@

# 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";
Expand Down Expand Up @@ -724,16 +735,16 @@
system("$perl ".&quote_path("$wadir/init/updateboot.pl")." webmin");
}
}
print "..done\n";
print ".. done\n";
print "\n";

if ($upgrading) {
print "Updating config files..\n";
print "Updating config files ..\n";
}
else {
print "Copying config files..\n";
print "Copying config files ..\n";
}
system("$perl ".&quote_path("$wadir/copyconfig.pl")." ".&quote_path("$os_type/$real_os_type")." ".&quote_path("$os_version/$real_os_version")." ".&quote_path($wadir)." ".$config_directory." \"\" ".$allmods);
system("$perl ".&quote_path("$wadir/copyconfig.pl")." ".&quote_path("$os_type/$real_os_type")." ".&quote_path("$os_version/$real_os_version")." ".&quote_path($wadir)." ".$config_directory." \"\" ".$allmods . " >/dev/null 2>&1");
if (!$upgrading) {
# Store the OS and version
&read_file("$config_directory/config", \%gconfig);
Expand All @@ -747,7 +758,7 @@
open(VER, ">$config_directory/version");
print VER $ver,"\n";
close(VER);
print "..done\n";
print ".. done\n";
print "\n";

# Set passwd_ fields in miniserv.conf from global config
Expand Down Expand Up @@ -781,10 +792,10 @@
$gconfig{'product'} ||= "webmin";

if ($makeboot) {
print "Configuring Webmin to start at boot time..\n";
print "Configuring Webmin to start at boot time ..\n";
chdir("$wadir/init");
system("$perl ".&quote_path("$wadir/init/atboot.pl")." ".$ENV{'bootscript'});
print "..done\n";
print ".. done\n";
print "\n";
}

Expand Down Expand Up @@ -823,7 +834,7 @@
fi
EOF
chmod(0755, "$config_directory/uninstall.sh");
print "..done\n";
print ".. done\n";
print "\n";
}

Expand All @@ -850,7 +861,7 @@
system("chgrp -R bin $var_dir");
system("chmod -R og-rwx $var_dir");
}
print "..done\n";
print ".. done\n";
print "\n";
}

Expand All @@ -868,7 +879,7 @@
print "Running postinstall scripts ..\n";
chdir($wadir);
system("$perl ".&quote_path("$wadir/run-postinstalls.pl"));
print "..done\n";
print ".. done\n";
print "\n";
}

Expand All @@ -879,12 +890,16 @@

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 ".. done\n";
print "\n";
}

Expand Down Expand Up @@ -943,7 +958,7 @@ sub copy_to_wadir
# Looks like Windows .. use xcopy command
system("xcopy \"$srcdir\" \"$wadir\" /Y /E /I /Q");
}
print "..done\n";
print ".. done\n";
print "\n";
}
}
Expand Down
95 changes: 58 additions & 37 deletions setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ fi
# Use the supplied destination directory, if any
if [ "$1" != "" ]; then
wadir=$1
echo "Installing Webmin from $srcdir to $wadir ..."
echo "Installing Webmin from $srcdir to $wadir"
if [ ! -d "$wadir" ]; then
mkdir "$wadir"
if [ "$?" != "0" ]; then
Expand All @@ -66,7 +66,7 @@ if [ "$1" != "" ]; then
fi
fi
else
echo "Installing Webmin in $wadir ..."
echo "Installing Webmin in $wadir"
fi
cd "$wadir"

Expand Down Expand Up @@ -127,8 +127,7 @@ if [ ! -d $config_dir ]; then
fi
fi
if [ -r "$config_dir/config" -a -r "$config_dir/var-path" -a -r "$config_dir/perl-path" ]; then
echo "Found existing Webmin configuration in $config_dir"
echo ""
echo ".. found"
upgrading=1
fi

Expand Down Expand Up @@ -170,7 +169,7 @@ if [ "$upgrading" = 1 ]; then
if [ "$wadir" != "$srcdir" ]; then
echo "Copying files to $wadir .."
(cd "$srcdir" ; tar cf - . | (cd "$wadir" ; tar xf -))
echo "..done"
echo ".. done"
echo ""
fi

Expand All @@ -196,7 +195,7 @@ if [ "$upgrading" = 1 ]; then
autothird=1
fi
$perl "$wadir/thirdparty.pl" "$wadir" "$oldwadir" $autothird
echo "..done"
echo ".. done"
echo ""
fi

Expand Down Expand Up @@ -227,7 +226,7 @@ else
fi
if [ "$var_dir" = "/" ]; then
echo "Log directory cannot be /"
exit ""
echo ""
exit 3
fi
if [ ! -d $var_dir ]; then
Expand Down Expand Up @@ -272,7 +271,7 @@ else
echo ""

# Test perl
echo "Testing Perl ..."
echo "Testing Perl .."
if [ ! -x $perl ]; then
echo "ERROR: Failed to find perl at $perl"
echo ""
Expand Down Expand Up @@ -309,7 +308,7 @@ else
echo ""
exit 8
fi
echo "Perl seems to be installed ok"
echo ".. done"
echo ""

# Create temp files directory
Expand Down Expand Up @@ -345,7 +344,7 @@ else
echo " web server already using this port."
echo " - The login name required to access the web server."
echo " - The password required to access the web server."
echo " - If the webserver should use SSL (if your system supports it)."
echo " - If the web server should use SSL (if your system supports it)."
echo " - Whether to start webmin at boot time."
echo ""
printf "Web server port (default 10000): "
Expand Down Expand Up @@ -473,14 +472,14 @@ else
if [ "$wadir" != "$srcdir" ]; then
echo "Copying files to $wadir .."
(cd "$srcdir" ; tar cf - . | (cd "$wadir" ; tar xf -))
echo "..done"
echo ".. done"
echo ""
fi

# Create webserver config file
echo $perl > $config_dir/perl-path
echo $var_dir > $config_dir/var-path
echo "Creating web server config files.."
echo "Creating web server config files .."
cfile=$config_dir/miniserv.conf
echo "port=$port" >> $cfile
echo "root=$wadir" >> $cfile
Expand Down Expand Up @@ -568,7 +567,7 @@ else
.
.
.
Webmin Webserver on $host
Webmin web server on $host
.
*
root@$host
Expand All @@ -586,10 +585,10 @@ EOF
echo "keyfile=$config_dir/miniserv.pem" >> $cfile

chmod 600 $cfile
echo "..done"
echo ".. done"
echo ""

echo "Creating access control file.."
echo "Creating access control file .."
afile=$config_dir/webmin.acl
rm -f $afile
if [ "$defaultmods" = "" ]; then
Expand All @@ -598,7 +597,7 @@ EOF
echo "$login: $defaultmods" >> $afile
fi
chmod 600 $afile
echo "..done"
echo ".. done"
echo ""

if [ "$login" != "root" -a "$login" != "admin" ]; then
Expand All @@ -608,14 +607,19 @@ EOF
fi

if [ "$noperlpath" = "" ]; then
echo "Inserting path to perl into scripts.."
echo "Inserting path to perl into scripts .."
(find "$wadir" -name '*.cgi' -print ; find "$wadir" -name '*.pl' -print) | $perl "$wadir/perlpath.pl" $perl -
echo "..done"
echo ".. done"
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.."
echo "Creating start and stop init scripts .."
# Start main
echo "#!/bin/sh" >$config_dir/.start-init
echo "echo Starting Webmin server in $wadir" >>$config_dir/.start-init
Expand Down Expand Up @@ -675,7 +679,7 @@ echo "#!/bin/sh" >$config_dir/.post-install
echo "$config_dir/.start-init" >>$config_dir/.post-install

chmod 755 $config_dir/.stop-init $config_dir/.start-init $config_dir/.restart-init $config_dir/.restart-by-force-kill-init $config_dir/.reload-init $config_dir/.pre-install $config_dir/.post-install
echo "..done"
echo ".. done"
echo ""

# Re-generating supplementary
Expand All @@ -699,7 +703,7 @@ systemctlcmd=`which systemctl 2>/dev/null`
if [ -x "$systemctlcmd" ]; then
rm -f $config_dir/stop $config_dir/start $config_dir/restart $config_dir/restart-by-force-kill $config_dir/reload

echo "Creating start and stop scripts (systemd).."
echo "Creating start and stop scripts (systemd) .."
# Start systemd
echo "#!/bin/sh" >$config_dir/start
echo "$systemctlcmd start webmin" >>$config_dir/start
Expand Down Expand Up @@ -733,18 +737,18 @@ else
# Creating symlinks
echo "Creating start and stop init symlinks to scripts .."
fi
echo "..done"
echo ".. done"
echo ""

if [ "$upgrading" = 1 -a "$inetd" != "1" -a "$nostop" == "" ]; then
if [ "$upgrading" = 1 -a "$inetd" != "1" -a "$nostop" = "" ]; then
# Stop old version, with updated stop script
$config_dir/stop >/dev/null 2>&1
$config_dir/.pre-install >/dev/null 2>&1
fi

if [ "$upgrading" = 1 ]; then
echo "Updating config files.."
echo "Updating config files .."
else
echo "Copying config files.."
echo "Copying config files .."
fi
newmods=`$perl "$wadir/copyconfig.pl" "$os_type/$real_os_type" "$os_version/$real_os_version" "$wadir" $config_dir "" $allmods`
if [ "$upgrading" != 1 ]; then
Expand Down Expand Up @@ -781,7 +785,7 @@ else
fi
fi
echo $ver > $config_dir/version
echo "..done"
echo ".. done"
echo ""

# Set passwd_ fields in miniserv.conf from global config
Expand Down Expand Up @@ -837,9 +841,9 @@ if [ "$?" != "0" ]; then
fi

if [ "$makeboot" = "1" ]; then
echo "Configuring Webmin to start at boot time.."
echo "Configuring Webmin to start at boot time .."
(cd "$wadir/init" ; WEBMIN_CONFIG=$config_dir WEBMIN_VAR=$var_dir "$wadir/init/atboot.pl" $bootscript)
echo "..done"
echo ".. done"
echo ""
fi

Expand All @@ -864,11 +868,13 @@ if [ "\$answer" = "y" ]; then
rm -rf "$wadir"
echo "Deleting $config_dir .."
rm -rf "$config_dir"
echo "Deleting $var_dir .."
rm -rf "$var_dir"
echo "Done!"
fi
EOF
chmod +x $config_dir/uninstall.sh
echo "..done"
echo ".. done"
echo ""
fi

Expand Down Expand Up @@ -908,7 +914,7 @@ for m in ldap-client ldap-server ldap-useradmin mailboxes mysql postgresql serve
chmod og-rw $config_dir/$m/config 2>/dev/null
fi
done
echo "..done"
echo ".. done"
echo ""

# Save target directory if one was specified
Expand All @@ -921,15 +927,15 @@ fi
if [ "$nopostinstall" = "" ]; then
echo "Running postinstall scripts .."
(cd "$wadir" ; WEBMIN_CONFIG=$config_dir WEBMIN_VAR=$var_dir "$wadir/run-postinstalls.pl")
echo "..done"
echo ".. done"
echo ""
fi

# Enable background collection
if [ "$upgrading" != 1 -a -r $config_dir/system-status/enable-collection.pl ]; then
echo "Enabling background status collection .."
$config_dir/system-status/enable-collection.pl 5
echo "..done"
echo ".. done"
echo ""
fi

Expand All @@ -940,14 +946,29 @@ fi

if [ "$nostart" = "" ]; then
if [ "$inetd" != "1" ]; then
echo "Attempting to start Webmin web server.."
$config_dir/start
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
echo "..done"
echo ".. done"
echo ""
fi

Expand Down
4 changes: 2 additions & 2 deletions software/apt-lib.pl
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ sub update_system_install

# Build the command to run
$ENV{'DEBIAN_FRONTEND'} = 'noninteractive';
local $uicmd = "$apt_get_command -y ".($force ? " -f" : "")." install $update";
$update = join(" ", map { quotemeta($_) } split(/\s+/, $update));
$update =~ s/\\(-)|\\(.)/$1$2/g;
local $cmd = "$apt_get_command -y ".($force ? " -f" : "")." install $update";
print "<b>",&text('apt_install', "<tt>$cmd</tt>"),"</b><p>\n";
print "<b>",&text('apt_install', "<tt>".&html_escape($uicmd)."</tt>"),"</b><p>\n";
print "<pre>";
&additional_log('exec', undef, $cmd);

Expand Down
5 changes: 3 additions & 2 deletions software/yum-lib.pl
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ sub update_system_install
if (@names == 1) {
@names = ( $update );
}
$update = join(" ", @names);
$update = join(" ", map { quotemeta($_) } @names);

# Work out command to use - for DNF, upgrades need to use the update command
local $cmd;
Expand All @@ -56,6 +56,7 @@ sub update_system_install
}

# Work out the command to run, which may enable some repos
my $uicmd = "$yum_command $enable -y $cmd ".join(" ", @names);
my $fullcmd = "$yum_command $enable -y $cmd $update";
foreach my $u (@updates) {
my $repo = &update_system_repo($u);
Expand All @@ -64,7 +65,7 @@ sub update_system_install
}
}

print "<b>",&text('yum_install', "<tt>".&html_escape($fullcmd)."</tt>"),"</b><p>\n";
print "<b>",&text('yum_install', "<tt>".&html_escape($uicmd)."</tt>"),"</b><p>\n";
print "<pre>";
&additional_log('exec', undef, $fullcmd);
$SIG{'TERM'} = 'ignore'; # Installing webmin itself may kill this script
Expand Down
2 changes: 2 additions & 0 deletions time/module.info.zh
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
desc_zh=系统时间
name_zh=时间
longdesc_zh=手动或自动从时间服务器对时。
2 changes: 0 additions & 2 deletions time/module.info.zh.auto

This file was deleted.

32 changes: 32 additions & 0 deletions ui-lib.pl
Original file line number Diff line number Diff line change
Expand Up @@ -2755,6 +2755,38 @@ sub ui_details
return $rv;
}

=head2 ui_hide_outside_of_viewport(elem)
Prints element if not in viewport. Useful
when printing top and bottom controls as
printing bottom controls only if it's not
in view already
=cut
sub ui_hide_outside_of_viewport
{
my ($elem_sel) = @_;
$elem_sel ||= "[data-outside-of-viewport]";
if (defined(&theme_ui_hide_outside_of_viewport)) {
return &theme_ui_hide_outside_of_viewport(@_);
}
return <<EOF;
<script type='text/javascript'>
try {
(function() {
var elems = document.querySelectorAll('$elem_sel'),
i;
for (i = 0; i < elems.length; i++) {
if (elems[i].offsetTop < window.innerHeight) {
elems[i].style.display = "none";
}
}
})();
} catch (e) {};
</script>
EOF
}

=head2 ui_read_file_contents_limit(\%data)
Reads file content with options and
Expand Down
2 changes: 1 addition & 1 deletion version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.996
1.997
2 changes: 0 additions & 2 deletions webmin/module.info.zh.auto

This file was deleted.

9 changes: 7 additions & 2 deletions webmin/upgrade.cgi
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,10 @@ elsif ($in{'mode'} eq 'solaris-pkg' || $in{'mode'} eq 'sun-pkg') {
# package. It would be interesting, however, if this were embedded in
# a remote script that could be nohup'd and it would restart the server.
chdir("/");
&restart_miniserv();
my $pre_install_script = "$config_directory/.pre-install";
my $stop_script = -r $pre_install_script ? $pre_install_script : "$config_directory/stop";
&proc::safe_process_exec_logged(
$stop_script, 0, 0, STDOUT, undef, 1,1);

$in{'root'} = '/';
$in{'adminfile'} = '$module_root_directory/adminupgrade';
Expand All @@ -339,6 +342,8 @@ elsif ($in{'mode'} eq 'solaris-pkg' || $in{'mode'} eq 'sun-pkg') {
$ENV{'config_dir'} = $config_directory;
$ENV{'webmin_upgrade'} = 1;
$ENV{'autothird'} = 1;
$ENV{'nostop'} = 1;
$ENV{'nostart'} = 1;
$ENV{'tempdir'} = $gconfig{'tempdir'};
print "<p>",$text{'upgrade_setup'},"<p>\n";
print "<pre>";
Expand All @@ -361,7 +366,7 @@ elsif ($in{'mode'} eq 'solaris-pkg' || $in{'mode'} eq 'sun-pkg') {
&proc::safe_process_exec(
"cd $dir && ./setup.sh", 0, 0, STDOUT, undef, 1, 1);
&proc::safe_process_exec_logged(
"$config_directory/start", 0, 0, STDOUT, undef, 1,1);
"$config_directory/.post-install", 0, 0, STDOUT, undef, 1,1);
print "</pre>\n";
}
elsif ($in{'mode'} eq 'gentoo') {
Expand Down
1 change: 1 addition & 0 deletions webmincron/webmincron.pl
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

# Force webmin script type to be cron
$main::webmin_script_type = 'cron';
$main::webmin_script_webmincron = $cron->{'module'}."::".$cron->{'func'};

# Require the module, call the function
eval {
Expand Down