Sophie

Sophie

distrib > Mandriva > 9.0 > x86_64 > media > main > by-pkgid > 713f4892d5ac58da17c441f011a96058 > scriptlet

linuxconf-1.28r2-4.2mdk.x86_64.rpm

PREIN

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


echo "#### pre install script" >>/tmp/linuxconf-rpminstall.log
date >>/tmp/linuxconf-rpminstall.log

log(){
	echo $* >>/tmp/linuxconf-rpminstall.log
	$*
}

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

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

# Check for old 1.9r22 RPM installation
if [ -f /usr/lib64/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 :-)

	echo Upgrading from older install strategy >>/tmp/linuxconf-rpminstall.log
	# Kill the Install directory
	if [ -f /install/doinst.sh ] ; then
		log rm -Rf /install
	fi

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

	# Create the directories we will need for the upgrade
	log install -d -g users -m 755 -o root /usr/lib64/linuxconf/
	log install -d -g users -m 755 -o root /usr/lib64/linuxconf/help.eng/notices/
	log install -d -g users -m 755 -o root /usr/lib64/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
	echo "You may want to check /tmp/linuxconf-rpminstall.log" >>$OLDINSTALL

	# I put a default RedHat inittab in /usr/lib64/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
		log cp /etc/inittab /usr/lib64/linuxconf/uninstall/inittab.beforeupgrade
		log 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
		#log cp /etc/inittab /usr/lib64/linuxconf/uninstall/inittab.beforeupgrade
		#log touch $INITTABREPLACE
	fi

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

	if [ -f /etc/rc.d/rc.sysinit.old ] ; then
		log mv -f /etc/rc.d/rc.sysinit.old /usr/lib64/linuxconf/uninstall/rc.sysinit.beforelinuxconf
	fi

	if [ -f /etc/rc.d/rc.old ] ; then
		log mv -f /etc/rc.d/rc.old /usr/lib64/linuxconf/uninstall/rc.beforelinuxconf
	fi

	if [ -f /usr/bin/passwd.old ] ; then
		log mv -f /usr/bin/passwd.old /usr/lib64/linuxconf/uninstall/passwd.beforelinuxconf
	fi

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

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

if [ $UPGRADE = "NO" ] ; then
		rm -f /tmp/linuxconf-rpminstall.log		
fi

if [ -f /usr/X11R6/bin/wxxt-linuxconf ];then 
	rm -f /usr/X11R6/bin/wxxt-linuxconf
fi

PREUN

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

POSTIN

/bin/sh
touch /var/log/linuxconf/htmlaccess.log
touch /var/log/linuxconf/netconf.log
touch /var/log/linuxconf/boot.log
/sbin/ldconfig
/usr/lib64/linuxconf/install/rpm-postinst.sh $*
# Add a few group ids so that the user is not prompted for them later...
if [ -x /usr/sbin/groupadd ] ; then
	# 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 2>&1 || true
	/usr/sbin/groupadd -g 231 -r -f popusers >/dev/null 2>&1 || \
	  /usr/sbin/groupadd -r -f popusers >/dev/null 2>&1 || true
	/usr/sbin/groupadd -g 232 -r -f slipusers >/dev/null 2>&1 || \
	  /usr/sbin/groupadd -r -f slipusers >/dev/null 2>&1 || true
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