Newer
Older
Digital_Repository / OARiNZ / DIY / webmin-oarinz / webmin-oarinz-1.340 / debian / postinst
nstanger on 20 Jun 2007 2 KB - First working version.
#!/bin/sh
# postinst script for webmin-oarinz

inetd=`grep "^inetd=" /etc/webmin/miniserv.conf 2>/dev/null | sed -e 's/inetd=//g'`
if [ "$1" = "upgrade" ]; then
	# Upgrading the package, so stop the old webmin properly
	if [ "$inetd" != "1" ]; then
		invoke-rc.d webmin stop >/dev/null 2>&1 </dev/null
	fi
fi
cd /usr/share/webmin
config_dir=/etc/webmin
var_dir=/var/webmin
perl=/usr/bin/perl
autoos=3
if [ "$WEBMIN_PORT" != "" ]; then
	port=$WEBMIN_PORT
else
	port=10000
fi
login=admin
password=admin
host=`hostname`
ssl=1
atboot=1
nochown=1
autothird=1
nouninstall=1
nostart=1
export config_dir var_dir perl autoos port login password host ssl nochown autothird nouninstall nostart allow atboot
./setup.sh >/tmp/.webmin/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 [ "" != "1" ]; then
	invoke-rc.d webmin start >/dev/null 2>&1 </dev/null
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 .."
	dpkg --remove webmin
	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/"
else
	echo "Webmin install complete. You can now login to http://$host:$port/"
fi
if [ "webmin" = "webmin" ]; then
	echo "as root with your root password, or as any user who can use sudo"
	echo "to run commands as root."
else
	echo "as any user on the system."
fi

# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.

#DEBHELPER#

exit 0