Sophie

Sophie

distrib > Mandriva > 7.1 > i586 > by-pkgid > 74c1ce0f6911e7a2323d708166e5c926 > scriptlet

linuxconf-1.18-2mdk.i586.rpm

PREIN

/bin/sh
OLDINSTALL=/usr/lib/linuxconf/help.eng/notices/01-oldinstall
INITTABREPLACE=/usr/lib/linuxconf/uninstall/inittab.replace
UPGRADE="NO"

# Check for tarball installation
if [ -f /usr/lib/linuxconf/conf.daemons ] ; then
	UPGRADE="YES"
fi

if [ -f /usr/lib/linuxconf/std/conf.daemons ] ; then
	UPGRADE="YES"
fi

# Check for old 1.9r22 RPM installation
if [ -f /usr/lib/linuxconf/install/doinst.sh ] ; then
	UPGRADE="YES"
fi

if [ $UPGRADE = "YES" ] ; then
	# Script to upgrade pre-1.9r25 Linuxconf to new SysV compliant booting.
	# Dale - Hacked in a few minutes late one night :-)

	# Kill the Install directory
	if [ -f /install/doinst.sh ] ; then
		rm -Rf /install
	fi

	# Kill the old /usr/lib/linuxconf directory, the RPM will put
	# everything we need back in later.
	rm -Rf /usr/lib/linuxconf

	# Create the directories we will need for the upgrade
	install -d -g users -m 755 -o root /usr/lib/linuxconf/
	install -d -g users -m 755 -o root /usr/lib/linuxconf/help.eng/notices/
	install -d -g users -m 755 -o root /usr/lib/linuxconf/uninstall/

	# Create a note displayed by linuxconf informing that the RPM
	# install has done some cleanup
	echo "      Installation note" >$OLDINSTALL
	echo >>$OLDINSTALL
	echo "The RPM installation has detected that linuxconf was already" >>$OLDINSTALL
	echo "installed using the tar.gz kit" >>$OLDINSTALL
	echo >>$OLDINSTALL
	echo "It has taken action to fix your linuxconf installation" >>$OLDINSTALL
	echo "so it becomes more compatible with RPM based systems" >>$OLDINSTALL
	echo >>$OLDINSTALL

	# I put a default RedHat inittab in /usr/lib/linuxconf/install
	# When I unpack the distro, the original SHOULD be there, but hey,
	# You never can tell when someone is gonna need that 1k taken up
	# by the backup....
	if [ -f /etc/inittab.old ] ; then
		cp /etc/inittab /usr/lib/linuxconf/uninstall/inittab.beforeupgrade
		mv -f /etc/inittab.old /etc/inittab
	#else
		# Tell the RPM to replace this file with a stock RedHat
		# We haven't untarred anything yet, so we can't replace it
		#cp /etc/inittab /usr/lib/linuxconf/uninstall/inittab.beforeupgrade
		#touch $INITTABREPLACE
	fi

	if [ -f /etc/rc.d/rc.M ] ; then
		mv -f /etc/rc.d/rc.M /usr/lib/linuxconf/uninstall/rc.M.beforeupgrade
	fi

	if [ -f /usr/sbin/syslogd.old ] ; then
		mv -f /usr/bin/syslogd.old /usr/lib/linuxconf/uninstall/syslogd.beforelinuxconf
	fi

	if [ -f /etc/conf.linuxconf ] ; then
		mv -f /etc/conf.linuxconf /etc/conf.linuxconf-installed
	fi
fi

PREUN

/bin/sh
# The script is handed a 0 if this is a uninstall
# and a 1 if it is an upgrade...
/usr/lib/linuxconf/install/rpm-preuninst.sh $1

POSTIN

/bin/sh
touch /var/log/linuxconf/htmlaccess.log
touch /var/log/linuxconf/netconf.log

/usr/lib/linuxconf/install/rpm-postinst.sh $*

# Add a few group ids so that the user is not prompted for them later...

# if it is an old version of groupadd, the combined -g and -r options
# will cause it to fail, so we fall back on just -r.  It will be less
# consistent across systems, but that's not too horrible.
/usr/sbin/groupadd -g 230 -r -f pppusers >/dev/null 2>&1 || \
  /usr/sbin/groupadd -r -f pppusers >/dev/null
/usr/sbin/groupadd -g 231 -r -f popusers >/dev/null 2>&1 || \
  /usr/sbin/groupadd -r -f popusers >/dev/null
/usr/sbin/groupadd -g 232 -r -f slipusers >/dev/null 2>&1 || \
  /usr/sbin/groupadd -r -f slipusers >/dev/null
echo "[netaccess]" >> /etc/conf.linuxconf
echo "htmlaccess.from 127.0.0.1 255.255.255.255" >> /etc/conf.linuxconf
echo "htmlaccess.dolog 0" >> /etc/conf.linuxconf
echo "htmlaccess.enable 1" >> /etc/conf.linuxconf
/sbin/ldconfig

# Those are not needed since 1.17
#%triggerin -- netkit-base
## Update /etc/inetd.conf
#if grep -v '^linuxconf' /etc/inetd.conf >/dev/null 2>&1 ; then
#        echo >> /etc/inetd.conf
#        echo linuxconf stream tcp wait root /bin/linuxconf linuxconf --http >> /etc/inetd.conf
#        if [ -f /var/run/inetd.pid ] ; then
#                kill -HUP `cat /var/run/inetd.pid`
#        fi
#fi
#
#%triggerin -- setup
## Update /etc/services
#if grep -v '^linuxconf' /etc/services >/dev/null 2>&1 ; then
#  echo "linuxconf 98/tcp" >> /etc/services
#fi

if [ -x /usr/bin/update-menus ];then
		/usr/bin/update-menus
fi

POSTUN

/bin/sh
if [ "$1" = 0 ] ; then

	# remove linuxconf from /etc/inetd.conf if it is there
	if [ -f /etc/inetd.conf ] &&
   	grep linuxconf /etc/inetd.conf >/dev/null 2>&1 ; then
		if grep -v linuxconf /etc/inetd.conf > /tmp/inetd.$$ ; then
			mv /tmp/inetd.$$ /etc/inetd.conf
		fi
	fi

	rm -f /var/run/treemenu.cache

		if [ -x /usr/bin/update-menus ];then
				/usr/bin/update-menus
		fi

fi

Triggers

named

/bin/sh
/bin/linuxconf --setmod dnsconf

dhcpd

/bin/sh
/bin/linuxconf --setmod dhcpd

sendmail

/bin/sh
/bin/linuxconf --setmod mailconf

apache

/bin/sh
/bin/linuxconf --setmod apache

samba

/bin/sh
/bin/linuxconf --setmod samba

wu-ftpd

/bin/sh
/bin/linuxconf --setmod wuftpd

named

/bin/sh
# we do not use --unsetmod because we want to leave a module that is
# explicitly turned off that way even if the triggered package is
# afterwards reinstalled...
[ $2 = 0 ] || exit 0
TMPFILE=`mktemp /tmp/lct.XXXXXX` || exit 1
sed '/^module.list 1 dnsconf$/d' < /etc/conf.linuxconf > $TMPFILE || exit 2
mv $TMPFILE /etc/conf.linuxconf || { rm -f $TMPFILE ; exit 3 ; }

dhcpd

/bin/sh
[ $2 = 0 ] || exit 0
TMPFILE=`mktemp /tmp/lct.XXXXXX` || exit 1
sed '/^module.list 1 dhcpd$/d' < /etc/conf.linuxconf > $TMPFILE || exit 2
mv $TMPFILE /etc/conf.linuxconf || { rm -f $TMPFILE ; exit 3 ; }

sendmail

/bin/sh
[ $2 = 0 ] || exit 0
TMPFILE=`mktemp /tmp/lct.XXXXXX` || exit 1
sed '/^module.list 1 mailconf$/d' < /etc/conf.linuxconf > $TMPFILE || exit 2
mv $TMPFILE /etc/conf.linuxconf || { rm -f $TMPFILE ; exit 3 ; }

apache

/bin/sh
[ $2 = 0 ] || exit 0
TMPFILE=`mktemp /tmp/lct.XXXXXX` || exit 1
sed '/^module.list 1 apache$/d' < /etc/conf.linuxconf > $TMPFILE || exit 2
mv $TMPFILE /etc/conf.linuxconf || { rm -f $TMPFILE ; exit 3 ; }

samba

/bin/sh
[ $2 = 0 ] || exit 0
TMPFILE=`mktemp /tmp/lct.XXXXXX` || exit 1
sed '/^module.list 1 samba$/d' < /etc/conf.linuxconf > $TMPFILE || exit 2
mv $TMPFILE /etc/conf.linuxconf || { rm -f $TMPFILE ; exit 3 ; }

wu-ftpd

/bin/sh
[ $2 = 0 ] || exit 0
TMPFILE=`mktemp /tmp/lct.XXXXXX` || exit 1
sed '/^module.list 1 wuftpd$/d' < /etc/conf.linuxconf > $TMPFILE || exit 2
mv $TMPFILE /etc/conf.linuxconf || { rm -f $TMPFILE ; exit 3 ; }