#!/bin/sh killmodenone=0 justinstalled=1 if [ -d "/etc/webmin" ]; then justinstalled=0 fi inetd=`grep "^inetd=" /etc/webmin/miniserv.conf 2>/dev/null | sed -e 's/inetd=//g'` productpidfile=`grep "^pidfile=" /etc/webmin/miniserv.conf 2>/dev/null | sed -e 's/pidfile=//g'` if [ -r "$productpidfile" ]; then productrunning=1 fi if [ "$1" = "configure" ]; then # Upgrading the package, so stop the old Webmin properly if [ "$inetd" != "1" ]; then if [ -f "/etc/webmin/.pre-install" ]; then /etc/webmin/.pre-install >/dev/null 2>&1 </dev/null else killmodenone=1 fi fi fi cd /usr/share/webmin config_dir=/etc/webmin var_dir=/var/webmin perl=/usr/bin/perl autoos=1 if [ "$WEBMIN_PORT" != "" ]; then port=$WEBMIN_PORT else port=10000 fi login=root if [ -r /etc/shadow ]; then crypt=x else crypt=`grep "^root:" /etc/passwd | cut -f 2 -d :` fi host=`hostname` ssl=1 atboot=1 makeboot=1 nochown=1 autothird=1 noperlpath=1 nouninstall=1 nostart=1 nostop=1 export config_dir var_dir perl autoos port login crypt host ssl nochown autothird noperlpath nouninstall nostart allow atboot makeboot nostop tempdir=/tmp/.webmin if [ ! -d $tempdir ]; then tempdir=/tmp fi ./setup.sh >$tempdir/webmin-setup.out 2>&1 if [ "webmin" = "webmin" ]; then grep sudo= /etc/webmin/miniserv.conf >/dev/null 2>&1 if [ "$?" = 1 ]; then # Allow sudo-based logins for Ubuntu echo sudo=1 >>/etc/webmin/miniserv.conf fi fi rm -f /var/lock/subsys/webmin if [ "$inetd" != "1" ]; then productucf=Webmin if [ "webmin" = "usermin" ]; then productucf=Usermin fi if [ "$justinstalled" = "1" ]; then /etc/webmin/start >/dev/null 2>&1 </dev/null if [ "$?" != "0" ]; then echo "E: ${productucf} server cannot be started. It is advised to start it manually by running \"/etc/webmin/restart-by-force-kill\" command" fi else if [ "webmin" = "webmin" ]; then 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 if [ -f /etc/webmin/.reload-init-systemd ]; then /etc/webmin/.reload-init-systemd >/dev/null 2>&1 </dev/null rm -f /etc/webmin/.reload-init-systemd fi fi else if [ "$productrunning" = "1" ]; then /etc/webmin/restart >/dev/null 2>&1 </dev/null fi fi if [ "$?" != "0" ]; then echo "W: ${productucf} server cannot be restarted. It is advised to restart it manually by running \"/etc/webmin/restart-by-force-kill\" command when upgrade process is finished" fi fi fi cat >/etc/webmin/uninstall.sh <<EOFF #!/bin/sh printf "Are you sure you want to uninstall Webmin? (y/n) : " read answer printf "\n" if [ "\$answer" = "y" ]; then echo "Removing Webmin package .." rm -f /usr/share/webmin/authentic-theme/manifest-* dpkg --remove --force-depends webmin systemctlcmd=\`which systemctl 2>/dev/null\` if [ -x "\$systemctlcmd" ]; then \$systemctlcmd stop webmin >/dev/null 2>&1 </dev/null rm -f /lib/systemd/system/webmin.service \$systemctlcmd daemon-reload fi echo ".. done" fi EOFF chmod +x /etc/webmin/uninstall.sh port=`grep "^port=" /etc/webmin/miniserv.conf | sed -e 's/port=//g'` perl -e 'use Net::SSLeay' >/dev/null 2>/dev/null sslmode=0 if [ "$?" = "0" ]; then grep ssl=1 /etc/webmin/miniserv.conf >/dev/null 2>/dev/null if [ "$?" = "0" ]; then sslmode=1 fi fi if [ "$sslmode" = "1" ]; then echo "Webmin install complete. You can now login to https://$host:$port/" >>$tempdir/webmin-setup.out 2>&1 else echo "Webmin install complete. You can now login to http://$host:$port/" >>$tempdir/webmin-setup.out 2>&1 fi if [ "webmin" = "webmin" ]; then echo "as root with your root password, or as any user who can use sudo" >>$tempdir/webmin-setup.out 2>&1 echo "to run commands as root." >>$tempdir/webmin-setup.out 2>&1 else echo "as any user on the system." >>$tempdir/webmin-setup.out 2>&1 fi