#!/bin/mksh
#-
-# Copyright © 2014
-# Thorsten “mirabilos” Glaser <t.glaser@tarent.de>
+# Copyright © 2014, 2018
+# mirabilos <t.glaser@tarent.de>
#
# Provided that these terms and disclaimer and all copyright notices
# are retained or reproduced in an accompanying document, permission
[[ $fn = *.dsc ]] && exec dpkg-source -x "$fn"
-[[ $fn = *.deb ]] || die not a Debian source or binary package
-dn=${fn%.deb}-extracted
+[[ $fn = *.@(deb|ipk) ]] || die not a Debian source or binary package or IPK
+dn=${fn%.???}-extracted
+
+mode=xapf
+[[ $fn = *.ipk ]] && mode=xzpf
set -e
rm -rf "$dn"
mkdir "$dn"
cd "$dn"
-paxtar xapf ../"$fn"
+paxtar $mode ../"$fn"
mkdir c d
cd c
paxtar xapf ../control.*