]> Zhao Yanbai Git Server - minix.git/commitdiff
Fixes for packaging system that will read .postinstall script and run it
authorBen Gras <ben@minix3.org>
Thu, 16 Feb 2006 15:43:37 +0000 (15:43 +0000)
committerBen Gras <ben@minix3.org>
Thu, 16 Feb 2006 15:43:37 +0000 (15:43 +0000)
if exists.

packit installs a package.

commands/scripts/Makefile
commands/scripts/binpackage.sh
commands/scripts/packit.sh [new file with mode: 0644]
commands/scripts/packme.sh

index e7dbaa1139a88b0cd950864cbced53dafd6b1463..28a5efb77b12e1177754d61fc98d90bfab83652a 100755 (executable)
@@ -42,6 +42,7 @@ usr:  \
        /usr/bin/binsizes \
        /usr/bin/rotate \
        /usr/bin/floppysetup \
+       /usr/bin/packit \
        /usr/bin/packme \
        /usr/bin/spell \
        /usr/bin/srccrc \
@@ -138,6 +139,9 @@ clean:
 /usr/bin/binsizes:     binsizes.sh
        install -m 755 -c -o bin $? $@
 
+/usr/bin/packit:       packit.sh
+       install -m 755 -c -o bin $? $@
+
 /usr/bin/packme:       packme.sh
        install -m 755 -c -o bin $? $@
 
index b57fe5a0f76418f34112d88b39abd72d7fadb24d..915e86cca21d842fa50e3f14ff41fc8482f7eaa4 100644 (file)
@@ -1,5 +1,7 @@
 #!/bin/sh 
 
+PI=.postinstall
+
 set -e
 
 # No trailing slashes in the directory, because we want to base the
@@ -37,9 +39,8 @@ then  echo "Error: No build script in $dir."
 fi
 
 sh -e build
-cd /
 echo " * Building package"
-find / -cnewer $packagestart | grep -v "^$srcdir" | grep -v "^/dev" | grep -v "^/tmp" | grep -v "^/usr/tmp" | grep -v "^/usr/log" | grep -v "^/usr/adm" | grep -v "^/etc/utmp" | grep -v "^/usr/src" | pax -w -d | bzip2 >$tarbz
+( if [ -f $PI ]; then echo $PI; fi; find / -cnewer $packagestart | grep -v "^$srcdir" | grep -v "^/dev" | grep -v "^/tmp" | grep -v "^/usr/tmp" | grep -v "^/usr/log" | grep -v "^/usr/adm" | grep -v "^/etc/utmp" | grep -v "^/usr/src" ) | pax -w -d | bzip2 >$tarbz
 rm -f $packagestart $findlist $tarcmd
 binsizes normal
 mv $tarbz $here/$pdir
diff --git a/commands/scripts/packit.sh b/commands/scripts/packit.sh
new file mode 100644 (file)
index 0000000..26acfb7
--- /dev/null
@@ -0,0 +1,38 @@
+#!/bin/sh
+
+PI=.postinstall
+TMP=/usr/tmp
+
+if [ "$#" -ne 1  ]
+then
+       echo "Usage: $0 <package file>"
+       exit 1
+fi
+
+dir=`pwd`
+if [ "$1" = "-" ]
+then f=""
+else f=$dir/$1
+fi
+
+set -e
+cd $TMP
+rm -f $PI
+
+if [ -f $PI ]
+then   echo "$PI is in $TMP, please remove it first."
+       exit 1
+fi
+
+if [ ! -f $f ]
+then   echo "Couldn't find package $f."
+       exit 1
+fi
+
+cat $f | smallbunzip2 | pax -r -p e
+if [ -f $PI ]
+then
+       sh -e $PI
+       rm -f $PI
+fi
+
index c84b6d6a13edb6bd88ae087ea51fd77782c7d4e3..68f74f95b1a871c28ff424180e2ae142d58d6fd9 100644 (file)
@@ -17,7 +17,7 @@ then  for package in `isodir "$cddrive" $CDDIR | grep -i '\.tbz'`
                read y
                if [ "$y" = y ]
                then    echo "Extracting $CDDIR/$package .."
-                       isoread "$cddrive" $CDDIR/$package | smallbunzip2 | pax -r -p e || echo "Extract failed."
+                       isoread "$cddrive" $CDDIR/$package | packit -
                fi
        done
 fi