196 |
196 |
197 ______________________________________________________________________________ |
197 ______________________________________________________________________________ |
198 #!/bin/sh |
198 #!/bin/sh |
199 #![OpenPKG] |
199 #![OpenPKG] |
200 ## |
200 ## |
201 ## THIS IS AN AUTO-GENERATED SHELL-WRAPPER ARCHIVE |
201 ## THIS IS AN AUTOGENERATED SHELL WRAPPER ARCHIVE |
202 ## |
202 ## |
203 |
203 |
204 # establish sane environment |
204 # establish sane environment |
205 PATH="$PATH:/bin:/sbin:/usr/bin:/usr/sbin" |
205 PATH="$PATH:/bin:/sbin:/usr/bin:/usr/sbin" |
206 LC_CTYPE=C |
206 LC_CTYPE=C |
207 export LC_CTYPE |
207 export LC_CTYPE |
208 umask 022 |
208 umask 022 |
209 |
209 |
210 # pass-through |
210 # passthrough |
211 if [ $# -eq 1 -a ".$1" = ".--tar" ]; then |
211 if [ $# -eq 1 -a ".$1" = ".--tar" ]; then |
212 # pass-through attached payload on stdout |
212 # passthrough attached payload on stdout |
213 dd if="$0" bs=2048 skip=1 2>/dev/null |
213 dd if="$0" bs=2048 skip=1 2>/dev/null |
214 rc=$? |
214 rc=$? |
215 else |
215 else |
216 # extract attached payload |
216 # extract attached payload |
217 rm -rf "$0.d" >/dev/null 2>&1 |
217 rm -rf "$0.d" >/dev/null 2>&1 |
222 echo "$0: ERROR: failed to unpack attached payload into directory \"$0.d\"" 1>&2 |
222 echo "$0: ERROR: failed to unpack attached payload into directory \"$0.d\"" 1>&2 |
223 rm -rf "$0.d" >/dev/null 2>&1 || true |
223 rm -rf "$0.d" >/dev/null 2>&1 || true |
224 exit 1 |
224 exit 1 |
225 fi |
225 fi |
226 |
226 |
227 # pass-through execution to control script |
227 # passthrough execution to control script |
228 (cd "$0.d" && exec sh "./@script@" ${1+"$@"}) |
228 (cd "$0.d" && exec sh "./@script@" ${1+"$@"}) |
229 rc=$? |
229 rc=$? |
230 |
230 |
231 # cleanup |
231 # cleanup |
232 rm -rf "$0.d" >/dev/null 2>&1 || true |
232 rm -rf "$0.d" >/dev/null 2>&1 || true |
236 # (before the shell discovers that we carry MBs of raw data with us below) |
236 # (before the shell discovers that we carry MBs of raw data with us below) |
237 exit $rc |
237 exit $rc |
238 |
238 |
239 # the payload tarball is appended in raw format directly to the end |
239 # the payload tarball is appended in raw format directly to the end |
240 # of this script, just leaded by padding whitespaces which make sure |
240 # of this script, just leaded by padding whitespaces which make sure |
241 # that the tarball data starts at the pre-defined offset of 2KB. This |
241 # that the tarball data starts at the predefined offset of 2KB. This |
242 # allows us to unpack the tarball by just skipping the leading 2KB. |
242 # allows us to unpack the tarball by just skipping the leading 2KB. |
243 |
243 |