author | allenforsythe <allenforsythe> | 2003-05-17 01:29:16 (UTC) |
---|---|---|
committer | allenforsythe <allenforsythe> | 2003-05-17 01:29:16 (UTC) |
commit | f6c30fa4d0e97b0256a7b40554f70b5c08895d80 (patch) (unidiff) | |
tree | 7bfe9ad9f743ce0c3d2fa57e684cc3d2716c5347 | |
parent | 9377a9c09fcacede85ef99a043e9d7c05fa7ac5e (diff) | |
download | opie-f6c30fa4d0e97b0256a7b40554f70b5c08895d80.zip opie-f6c30fa4d0e97b0256a7b40554f70b5c08895d80.tar.gz opie-f6c30fa4d0e97b0256a7b40554f70b5c08895d80.tar.bz2 |
*** empty log message ***
-rwxr-xr-x | noncore/apps/qashmoney/ipkg-build | 163 |
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 | ||
6 | set -e | ||
7 | |||
8 | ipkg_extract_value() { | ||
9 | sed -e "s/^[^:]*:[[:space:]]*//" | ||
10 | } | ||
11 | |||
12 | required_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 | |||
24 | pkg_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. | ||
35 | You 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 | |||
115 | case $# in | ||
116 | 1) | ||
117 | dest_dir=. | ||
118 | ;; | ||
119 | 2) | ||
120 | dest_dir=$2 | ||
121 | ;; | ||
122 | *) | ||
123 | echo "Usage: ipkg-build <pkg_directory> [<destination_directory>]" >&2 | ||
124 | exit 1 | ||
125 | ;; | ||
126 | esac | ||
127 | |||
128 | pkg_dir=$1 | ||
129 | |||
130 | if [ ! -d $pkg_dir ]; then | ||
131 | echo "*** Error: Directory $pkg_dir does not exist" >&2 | ||
132 | exit 1 | ||
133 | fi | ||
134 | |||
135 | # CONTROL is second so that it takes precedence | ||
136 | CONTROL= | ||
137 | [ -d $pkg_dir/DEBIAN ] && CONTROL=DEBIAN | ||
138 | [ -d $pkg_dir/CONTROL ] && CONTROL=CONTROL | ||
139 | if [ -z "$CONTROL" ]; then | ||
140 | echo "*** Error: Directory $pkg_dir has no CONTROL subdirectory." >&2 | ||
141 | exit 1 | ||
142 | fi | ||
143 | |||
144 | if ! 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 | ||
148 | fi | ||
149 | |||
150 | tmp_dir=$dest_dir/IPKG_BUILD.$$ | ||
151 | mkdir $tmp_dir | ||
152 | |||
153 | tar -C $pkg_dir -czf $tmp_dir/data.tar.gz . --exclude=$CONTROL | ||
154 | tar -C $pkg_dir/$CONTROL -czf $tmp_dir/control.tar.gz . | ||
155 | |||
156 | echo "2.0" > $tmp_dir/debian-binary | ||
157 | |||
158 | pkg_file=$dest_dir/${pkg}_${version}_${arch}.ipk | ||
159 | tar -C $tmp_dir -czf $pkg_file ./debian-binary ./data.tar.gz ./control.tar.gz | ||
160 | rm $tmp_dir/debian-binary $tmp_dir/data.tar.gz $tmp_dir/control.tar.gz | ||
161 | rmdir $tmp_dir | ||
162 | |||
163 | echo "Packaged contents of $pkg_dir into $pkg_file" | ||