opkg

statically linked package installer
git clone anongit@rnpnr.xyz:opkg.git
Log | Files | Refs | Feed | Submodules | README | LICENSE

extract.sh (342B)


      1 file=$1
      2 shift
      3 
      4 case $file in
      5 *.tar.gz|*.tgz) tool=gzip  ;;
      6 *.tar.bz2)      tool=bzip2 ;;
      7 *.tar.xz)       tool=xz    ;;
      8 *) exit 0
      9 esac
     10 
     11 if command -v bsdtar >/dev/null; then
     12 	exec bsdtar -xf "$file" "$@"
     13 elif command -v pax >/dev/null; then
     14 	"$tool" -d -c "$file" | pax -r "$@"
     15 else
     16 	printf '%s: bsdtar or pax is required' "$0" >&2
     17 	exit 1
     18 fi