summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rwxr-xr-xnoncore/apps/qashmoney/ipkg-build163
1 files changed, 0 insertions, 163 deletions
diff --git a/noncore/apps/qashmoney/ipkg-build b/noncore/apps/qashmoney/ipkg-build
deleted file mode 100755
index 3ec1364..0000000
--- a/noncore/apps/qashmoney/ipkg-build
+++ b/dev/null
@@ -1,163 +0,0 @@
1#!/bin/sh
2
3# ipkg-build -- construct a .ipk from a directory
4# Carl Worth <cworth@east.isi.edu>
5# based on a script by Steve Redler IV, steve@sr-tech.com 5-21-2001
6set -e
7
8ipkg_extract_value() {
9 sed -e "s/^[^:]*:[[:space:]]*//"
10}
11
12required_field() {
13 field=$1
14
15 value=`grep "^$field:" < $CONTROL/control | ipkg_extract_value`
16 if [ -z "$value" ]; then
17 echo "*** Error: $CONTROL/control is missing field $field" >&2
18 return 1
19 fi
20 echo $value
21 return 0
22}
23
24pkg_appears_sane() {
25 local pkg_dir=$1
26
27 local owd=`pwd`
28 cd $pkg_dir
29
30 PKG_ERROR=0
31
32 large_uid_files=`find . -uid +99`
33 if [ -n "$large_uid_files" ]; then
34 echo "*** Warning: The following files have a UID greater than 99.
35You probably want to chown these to a system user: " >&2
36 ls -ld $large_uid_files
37 echo >&2
38 fi
39
40
41 if [ ! -f "$CONTROL/control" ]; then
42 echo "*** Error: Control file $pkg_dir/$CONTROL/control not found." >&2
43 cd $owd
44 return 1
45 fi
46
47 pkg=`required_field Package`
48 [ "$?" -ne 0 ] && PKG_ERROR=1
49
50 version=`required_field Version | sed 's/.*://;'`
51 [ "$?" -ne 0 ] && PKG_ERROR=1
52
53 arch=`required_field Architecture`
54 [ "$?" -ne 0 ] && PKG_ERROR=1
55
56 required_field Maintainer >/dev/null
57 [ "$?" -ne 0 ] && PKG_ERROR=1
58
59 required_field Description >/dev/null
60 [ "$?" -ne 0 ] && PKG_ERROR=1
61
62 section=`required_field Section`
63 [ "$?" -ne 0 ] && PKG_ERROR=1
64 if [ -z "$section" ]; then
65 echo "The Section field should have one of the following values:" >&2
66 echo "Games, Multimedia, Communications, Settings, Utilies, Applications, Console, Misc" >&2
67 fi
68
69 priority=`required_field Priority`
70 [ "$?" -ne 0 ] && PKG_ERROR=1
71 if [ -z "$priority" ]; then
72 echo "The Priority field should have one of the following values:" >&2
73 echo "required, important, standard, optional, extra." >&2
74 echo "If you don't know which priority value you should be using, then use \`optional'" >&2
75 fi
76
77 if echo $pkg | grep '[^a-z0-9.+-]'; then
78 echo "*** Error: Package name $name contains illegal characters, (other than [a-z0-9.+-])" >&2
79 PKG_ERROR=1;
80 fi
81
82 local bad_fields=`sed -ne 's/^\([^[:space:]][^:[:space:]]\+[[:space:]]\+\)[^:].*/\1/p' < $CONTROL/control | sed -e 's/\\n//'`
83 if [ -n "$bad_fields" ]; then
84 bad_fields=`echo $bad_fields`
85 echo "*** Error: The following fields in $CONTROL/control are missing a ':'" >&2
86 echo "$bad_fields" >&2
87 echo "ipkg-build: This may be due to a missing initial space for a multi-line field value" >&2
88 PKG_ERROR=1
89 fi
90
91 for script in $CONTROL/preinst $CONTROL/postinst $CONTROL/prerm $CONTROL/postrm; do
92 if [ -f $script -a ! -x $script ]; then
93 echo "*** Error: package script $script is not executable" >&2
94 PKG_ERROR=1
95 fi
96 done
97
98 if [ -f $CONTROL/conffiles ]; then
99 for cf in `cat $CONTROL/conffiles`; do
100 if [ ! -f ./$cf ]; then
101 echo "*** Error: $CONTROL/conffiles mentions conffile $cf which does not exist" >&2
102 PKG_ERROR=1
103 fi
104 done
105 fi
106
107 cd $owd
108 return $PKG_ERROR
109}
110
111###
112# ipkg-build "main"
113###
114
115case $# in
1161)
117 dest_dir=.
118 ;;
1192)
120 dest_dir=$2
121 ;;
122*)
123 echo "Usage: ipkg-build <pkg_directory> [<destination_directory>]" >&2
124 exit 1
125 ;;
126esac
127
128pkg_dir=$1
129
130if [ ! -d $pkg_dir ]; then
131 echo "*** Error: Directory $pkg_dir does not exist" >&2
132 exit 1
133fi
134
135# CONTROL is second so that it takes precedence
136CONTROL=
137[ -d $pkg_dir/DEBIAN ] && CONTROL=DEBIAN
138[ -d $pkg_dir/CONTROL ] && CONTROL=CONTROL
139if [ -z "$CONTROL" ]; then
140 echo "*** Error: Directory $pkg_dir has no CONTROL subdirectory." >&2
141 exit 1
142fi
143
144if ! pkg_appears_sane $pkg_dir; then
145 echo >&2
146 echo "ipkg-build: Please fix the above errors and try again." >&2
147 exit 1
148fi
149
150tmp_dir=$dest_dir/IPKG_BUILD.$$
151mkdir $tmp_dir
152
153tar -C $pkg_dir -czf $tmp_dir/data.tar.gz . --exclude=$CONTROL
154tar -C $pkg_dir/$CONTROL -czf $tmp_dir/control.tar.gz .
155
156echo "2.0" > $tmp_dir/debian-binary
157
158pkg_file=$dest_dir/${pkg}_${version}_${arch}.ipk
159tar -C $tmp_dir -czf $pkg_file ./debian-binary ./data.tar.gz ./control.tar.gz
160rm $tmp_dir/debian-binary $tmp_dir/data.tar.gz $tmp_dir/control.tar.gz
161rmdir $tmp_dir
162
163echo "Packaged contents of $pkg_dir into $pkg_file"