summaryrefslogtreecommitdiffstats
path: root/sysutils/pkg_tarup/files/patch-aa
blob: e09be9ee8b4fcc5432c57dc7a5d0b17bf1854b3e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
--- pkg_tarup.orig	Thu Aug 23 14:16:01 2001
+++ pkg_tarup	Thu Aug 23 14:18:58 2001
@@ -7,21 +7,28 @@
 #
 
 PKG_DBDIR=${PKG_DBDIR:-/var/db/pkg}
-PKGREPOSITORY=${PKGREPOSITORY:-/tmp}
 PKG_SUFX=${PKG_SUFX:-tgz}
+PKG_INFO_CMD=/usr/sbin/pkg_info
+PKG_CREATE_CMD=/usr/sbin/pkg_create
+
+# A package file can be very big beyond /tmp's capacity
+PKGREPOSITORY=${PKGREPOSITORY:-${TMPDIR:-/var/tmp}}
 
 PKG="$1"
-rPKG="`pkg_info -e \"$PKG\"`"
 
-if [ "$PKG" = "" -o "$rPKG" = "" -o -f "${PKG_DBDIR}/${rPKG}" ]
+if [ "$PKG" = "" ]
 then
-     echo Usage: $0 installed_pkg
+     echo Usage: $0 installed_package
      exit 1
 fi
 
-PKG=$rPKG
-echo "Taring up $PKG"
+if ! $PKG_INFO_CMD -e "$PKG"
+then
+     echo $PKG is not installed.
+     exit 1
+fi
 
+echo "Taring up $PKG"
 
 check_and_add() {
 	opt="$1"
@@ -40,10 +47,10 @@
 
 check_and_add -c ${PKG_DBDIR}/${PKG}/+COMMENT
 check_and_add -d ${PKG_DBDIR}/${PKG}/+DESC
-check_and_add -b ${PKG_DBDIR}/${PKG}/+BUILD_VERSION
-check_and_add -B ${PKG_DBDIR}/${PKG}/+BUILD_INFO
+#check_and_add -b ${PKG_DBDIR}/${PKG}/+BUILD_VERSION
+#check_and_add -B ${PKG_DBDIR}/${PKG}/+BUILD_INFO
 check_and_add -s ${PKG_DBDIR}/${PKG}/+SIZE_PKG
-check_and_add -S ${PKG_DBDIR}/${PKG}/+SIZE_ALL
+#check_and_add -S ${PKG_DBDIR}/${PKG}/+SIZE_ALL
 check_and_add -i ${PKG_DBDIR}/${PKG}/+INSTALL
 check_and_add -k ${PKG_DBDIR}/${PKG}/+DEINSTALL
 check_and_add -r ${PKG_DBDIR}/${PKG}/+REQUIRE
@@ -54,7 +61,8 @@
 sed -n \
     -e '/^@comment MD5:/d' \
     -e '/^@cwd \.$/,$d' \
-    -e '/\$NetBSD/,$p' \
+    -e '/^@srcdir /d' \
+    -e 'p' \
     <${PKG_DBDIR}/${PKG}/+CONTENTS >$PLIST
 
 # Duplicate first @cwd (work around pkg_create "feature" ...)
@@ -64,9 +72,9 @@
     sed \
        -e "/`cat ${PLIST}.1 | sed 's,/,\\\\/,g'`/r${PLIST}.1" \
        <${PLIST} >${PLIST}.2
-    mv ${PLIST}.2 ${PLIST}
+    /bin/mv ${PLIST}.2 ${PLIST}
 fi
-rm ${PLIST}.1
+/bin/rm ${PLIST}.1
 
 # echo -----
 # cat $PLIST
@@ -76,17 +84,15 @@
 # Just for kicks ...
 # pkg_admin check "${PKG}"
   
-pkg_create \
+$PKG_CREATE_CMD \
         ${PKG_ARGS} \
 	-v \
 	-f ${PLIST} \
-	-l \
-	-p "`pkg_info -qp ${PKG} | head -1 | awk '{ print $2 }'`" \
-	-P "`pkg_info -qf ${PKG} | grep ^@pkgdep | awk '{ print $2 }'`" \
-	-C "`pkg_info -qf ${PKG} | grep ^@pkgcfl | awk '{ print $2 }'`" \
+	-p "`$PKG_INFO_CMD -qp ${PKG} | head -1 | awk '{ print $2 }'`" \
+	-P "`$PKG_INFO_CMD -qf ${PKG} | grep ^@pkgdep | awk '{ print $2 }'`" \
 	${PKGREPOSITORY}/${PKG}.${PKG_SUFX}
 
-rm -f ${PLIST}
+/bin/rm -f ${PLIST}
 exit 0
 
 
OpenPOWER on IntegriCloud