summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rwxr-xr-xscripts/ipkg-build13
1 files changed, 9 insertions, 4 deletions
diff --git a/scripts/ipkg-build b/scripts/ipkg-build
index ac8f286..0533048 100755
--- a/scripts/ipkg-build
+++ b/scripts/ipkg-build
@@ -108,41 +108,43 @@ You probably want to chown these to a system user: " >&2
108 for cf in `cat $CONTROL/conffiles`; do 108 for cf in `cat $CONTROL/conffiles`; do
109 if [ ! -f ./$cf ]; then 109 if [ ! -f ./$cf ]; then
110 echo "*** Error: $CONTROL/conffiles mentions conffile $cf which does not exist" >&2 110 echo "*** Error: $CONTROL/conffiles mentions conffile $cf which does not exist" >&2
111 PKG_ERROR=1 111 PKG_ERROR=1
112 fi 112 fi
113 done 113 done
114 fi 114 fi
115 115
116 cd $owd 116 cd $owd
117 return $PKG_ERROR 117 return $PKG_ERROR
118} 118}
119 119
120### 120###
121# ipkg-build "main" 121# ipkg-build "main"
122### 122###
123ogargs="" 123ogargs=""
124usage="Usage: $0 [-o owner] [-g group] <pkg_directory> [<destination_directory>]" 124usage="Usage: $0 [-o owner] [-g group] [-c] <pkg_directory> [<destination_directory>]"
125while getopts ":o:g:" opt; do 125while getopts ":o:g:c" opt; do
126 case $opt in 126 case $opt in
127 o ) owner=$OPTARG 127 o ) owner=$OPTARG
128 ogargs="--owner=$owner" 128 ogargs="--owner=$owner"
129 ;; 129 ;;
130 g ) group=$OPTARG 130 g ) group=$OPTARG
131 ogargs="$ogargs --group=$group" 131 ogargs="$ogargs --group=$group"
132 ;; 132 ;;
133 c ) classic=1
134 ;;
133 \? ) echo $usage >&2 135 \? ) echo $usage >&2
134 esac 136 esac
135done 137done
136 138
137 139
138shift $(($OPTIND - 1)) 140shift $(($OPTIND - 1))
139 141
140# continue on to process additional arguments 142# continue on to process additional arguments
141 143
142case $# in 144case $# in
1431) 1451)
144 dest_dir=. 146 dest_dir=.
145 ;; 147 ;;
1462) 1482)
147 dest_dir=$2 149 dest_dir=$2
148 ;; 150 ;;
@@ -171,24 +173,27 @@ fi
171if ! pkg_appears_sane $pkg_dir; then 173if ! pkg_appears_sane $pkg_dir; then
172 echo >&2 174 echo >&2
173 echo "ipkg-build: Please fix the above errors and try again." >&2 175 echo "ipkg-build: Please fix the above errors and try again." >&2
174 exit 1 176 exit 1
175fi 177fi
176 178
177tmp_dir=$dest_dir/IPKG_BUILD.$$ 179tmp_dir=$dest_dir/IPKG_BUILD.$$
178mkdir $tmp_dir 180mkdir $tmp_dir
179 181
180tar $ogargs -C $pkg_dir -czf $tmp_dir/data.tar.gz . --exclude=$CONTROL 182tar $ogargs -C $pkg_dir -czf $tmp_dir/data.tar.gz . --exclude=$CONTROL
181tar $ogargs -C $pkg_dir/$CONTROL -czf $tmp_dir/control.tar.gz . 183tar $ogargs -C $pkg_dir/$CONTROL -czf $tmp_dir/control.tar.gz .
182 184
183echo "2.0" > $tmp_dir/debian-binary 185echo "2.0" > $tmp_dir/debian-binary
184 186
185pkg_file=$dest_dir/${pkg}_${version}_${arch}.ipk 187pkg_file=$dest_dir/${pkg}_${version}_${arch}.ipk
186here_dir=$PWD 188here_dir=$PWD
187## tar -C $tmp_dir -czf $pkg_file ./debian-binary ./data.tar.gz ./control.tar.gz
188rm -f $pkg_file 189rm -f $pkg_file
189cd $tmp_dir ; ar crf $here_dir/$pkg_file ./debian-binary ./data.tar.gz ./control.tar.gz 190if [ -n "$classic" ]; then
191 tar -C $tmp_dir -czf $pkg_file ./debian-binary ./data.tar.gz ./control.tar.gz
192else
193 cd $tmp_dir ; ar crf $here_dir/$pkg_file ./debian-binary ./data.tar.gz ./control.tar.gz
194fi
190cd $here_dir 195cd $here_dir
191rm $tmp_dir/debian-binary $tmp_dir/data.tar.gz $tmp_dir/control.tar.gz 196rm $tmp_dir/debian-binary $tmp_dir/data.tar.gz $tmp_dir/control.tar.gz
192rmdir $tmp_dir 197rmdir $tmp_dir
193 198
194echo "Packaged contents of $pkg_dir into $pkg_file" 199echo "Packaged contents of $pkg_dir into $pkg_file"