Sophie

Sophie

distrib > Mandriva > 2007.0 > i586 > media > contrib-release > by-pkgid > 2f9afcd30208e639390779d1449597f4 > scriptlet

usermin-1.150-1mdk.noarch.rpm

PREIN

/bin/sh
perl <<EOD;
# maketemp.pl
# Create the /root/.webmin directory if needed
# ASkwar:
# This really needs to be /root/.webmin, because of (at least) the setup.sh
# script

\$tmp_dir = "/root/.webmin";

if (!-d \$tmp_dir) {
	mkdir(\$tmp_dir, 0755) || exit 1;
	chown(\$<, \$(, \$tmp_dir);
	chmod(0755, \$tmp_dir);
	}
@st = stat(\$tmp_dir);
if (@st && \$st[4] == \$< && \$st[5] == \$( && \$st[2] & 0x4000 &&
    (\$st[2] & 0777) == 0755) {
	exit 0;
	}
else {
	exit 1;
	}


EOD
if [ "$?" != "0" ]; then
	echo "Failed to create or check temp files directory /root/.webmin"
	exit 1
fi

PREUN

/bin/sh
/usr/share/rpm-helper/del-service usermin $1 usermin

POSTIN

/bin/sh
if [ "$1" != 1 ]; then
	# Upgrading the RPM, so stop the old usermin properly
	service usermin stop
fi
cd /usr/share/usermin
config_dir=/etc/usermin
var_dir=/var/run/usermin
perl=/usr/bin/perl
autoos=1
port=20000
host=`hostname`
ssl=1
atboot=1
nochown=1
autothird=1
noperlpath=1
nouninstall=1
nostart=1
export config_dir var_dir perl autoos port host ssl nochown autothird noperlpath nouninstall nostart allow
./setup.sh > /root/tmp/usermin-setup.out 2>/root/tmp/usermin-setup.err

cat > /etc/usermin/uninstall.sh <<EOFF
#!/bin/sh
printf "Are you sure you want to uninstall Usermin? (y/n) : "
read answer
printf "\n"
if [ "\$answer" = "y" ]; then
	echo "Removing usermin RPM .."
	#rpm -e --nodeps usermin
	urpme usermin
	echo "Done!"
fi
EOFF
chmod +x /etc/usermin/uninstall.sh

/usr/share/rpm-helper/add-service usermin $1 usermin

POSTUN

/bin/sh
if [ "$1" = 0 ]; then
	grep root=/usr/share/usermin /etc/usermin/miniserv.conf >/dev/null 2>&1
	if [ "$?" = 0 ]; then
		# RPM is being removed, and no new version of usermin
		# has taken it's place. Delete the config files
		rm -rf /etc/usermin /var/usermin
	fi
fi