--- /mnt/rock-linux/rock-src-1.5.12-OLD/misc/sysfiles/usr/sbin/pkg-remove Tue Aug 8 20:49:03 2000 +++ pkg-remove Tue Nov 27 09:41:00 2001 @@ -1,4 +1,8 @@ #!/bin/sh +# +# The pkg-remove script parses the list in /var/adm/flists and +# removes the files therein. +# exec 2>&1 @@ -12,6 +16,7 @@ for x do + # Find flists file if ! [ -f "var/adm/flists/$x" ] ; then echo "No such package: $x!" continue @@ -23,24 +28,30 @@ fi echo "Removing package $x. Please wait ..." - + + # Remove leading package name in flists file and write to temporary + # list cut -f2 -d' ' var/adm/flists/$x > tmp/$$-pkgrm.tmp - + + # Remove files and directories xargs rm -f < tmp/$$-pkgrm.tmp 2> /dev/null xargs rmdir -p < tmp/$$-pkgrm.tmp 2> /dev/null sed 's,/[^/]*$,\1,' < tmp/$$-pkgrm.tmp | \ xargs rmdir -p 2> /dev/null + # Remove temporary list rm -f tmp/$$-pkgrm.tmp done if [ $d != / ] ; then + # Not deleting from root - run setup.d in chroot'd environment echo "export CHROOT_GOAL=$d" > $d/tmp/$$.tmp echo "cd / ; . /etc/profile" >> $d/tmp/$$.tmp echo 'for x in /etc/setup.d/* ; do $x update ; done' >> $d/tmp/$$.tmp echo "umount /dev /proc" >> $d/tmp/$$.tmp cd $d ; chroot . bin/sh tmp/$$.tmp ; rm -f /tmp/$$.tmp else + # Run setup.d for each package cd / ; for x in /etc/setup.d/* ; do $x update ; done fi