Author: jw Date: 2006-03-24 14:43:38 +0100 (Fri, 24 Mar 2006) New Revision: 1002 Added: crux-2.2/iso/bin/setup-helper Modified: crux-2.2/iso/bin/setup Log: add setup-helper to do rename/inject/remove packages Modified: crux-2.2/iso/bin/setup =================================================================== --- crux-2.2/iso/bin/setup 2006-03-24 10:38:13 UTC (rev 1001) +++ crux-2.2/iso/bin/setup 2006-03-24 13:43:38 UTC (rev 1002) @@ -228,12 +228,18 @@ select_root select_packages confirm + if [ "$ACTION" = "UPGRADE" ] && [ -f /usr/bin/setup-helper ]; then + /usr/bin/setup-helper $ROOT &> $helperlogfile + fi install_packages + + cat $helperlogfile } tmpfile=/tmp/tmp.$$ pkgfile=/tmp/packages.$$ logfile=/tmp/log.$$ +helperlogfile=/tmp/log-helper.$$ crux_dir=/crux trap "rm -f $tmpfile $pkgfile" 0 1 2 5 15 Added: crux-2.2/iso/bin/setup-helper =================================================================== --- crux-2.2/iso/bin/setup-helper (rev 0) +++ crux-2.2/iso/bin/setup-helper 2006-03-24 13:43:38 UTC (rev 1002) @@ -0,0 +1,89 @@ +#!/bin/bash +# post setup +# +# Johannes Winkelmann, jw at tks6 dot net + +ROOT=$1 +DB=$ROOT/var/lib/pkg/db + +## those values should be changed: +TMPDB=$DB.tmp +BACKUPDB=$DB.backup +PKGADD="pkgadd" +PKGRM="pkgrm" +MV="mv" + +rename_packages() { + echo "* Packages renamed: " + + if [ -z "$1" ]; then + return + fi + pkg=$@ + + filter="sed " + for tuple in $@; do + split=($(echo $tuple|sed -e 's|:| |')) + if [ -n "${split[1]}" ] && [ `pkginfo -r $ROOT -i|gawk '{ print $1; }'|grep ^${split[0]}$` ]; then + echo " ${split[0]} -> ${split[1]}" + filter="$filter -e 's|^${split[0]}$|${split[1]}|'" + fi + done + + :> $TMPDB + if [ -f $DB ]; then + nextIsName=1 + cat $DB|while read l; do + if [ $nextIsName -eq 1 ]; then + nextIsName=0 + echo $l|eval $filter >> $TMPDB + else + if [ "$l" = "" ]; then + nextIsName=1 + fi + echo $l >> $TMPDB + fi + done + fi + + $MV $DB $BACKUPDB + $MV $TMPDB $DB +} + + +remove_packages() { + echo "* Packages removed (obsolete):" + for package in $@; do + if [ `pkginfo -r $ROOT -i|gawk '{ print $1; }'|grep ^$package$` ]; then + echo " $package" + $PKGRM -r $ROOT $package + fi + done +} + +inject_packages() { + echo "* Packaged injected:" + for package in $@; do + if [ -z "`pkginfo -r $ROOT -i|gawk '{ print $1; }'|grep ^$package$`" ]; then + echo " $package" + pkg="`find core opt -name \"${package}#*.pkg.tar.gz\" &2> /dev/null`" + if [ -n "$pkg" ]; then + $PKGADD -r $ROOT -f $pkg + else + echo " ERROR: package $package not found on ISO" + fi + fi + done +} + +#################### + +if [ -z "$1" ]; then + echo "Usage: $0 <root>" + exit -1 +fi + +# 2.1 -> 2.2 +remove_packages devfsd +inject_packages udev pciutils libusb usbutils hotplug +rename_packages "pkgconfig:pkg-config" Property changes on: crux-2.2/iso/bin/setup-helper ___________________________________________________________________ Name: svn:executable + *
participants (1)
-
crux@crux.nu