undeb: clean up
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
This commit is contained in:
parent
ea1b44412a
commit
ee22fe8793
@ -5,49 +5,55 @@
|
|||||||
# Requires the programs (ar, tar, gzip, and the pager more or less).
|
# Requires the programs (ar, tar, gzip, and the pager more or less).
|
||||||
#
|
#
|
||||||
usage() {
|
usage() {
|
||||||
echo "Usage: undeb -c package.deb <Print control file info>"
|
cat <<EOF
|
||||||
echo " undeb -l package.deb <List contents of deb package>"
|
Usage: undeb -c package.deb <Print control file info>
|
||||||
echo " undeb -x package.deb /foo/boo <Extract deb package to this directory,"
|
undeb -l package.deb <List contents of deb package>
|
||||||
echo " put . for current directory>"
|
undeb -x package.deb /foo/boo <Extract deb package to this directory,
|
||||||
exit
|
put . for current directory>
|
||||||
|
EOF
|
||||||
|
exit
|
||||||
}
|
}
|
||||||
|
|
||||||
deb=$2
|
deb=$2
|
||||||
|
|
||||||
exist() {
|
exist() {
|
||||||
if [ "$deb" = "" ]; then
|
if [ -z "${deb}" ]; then
|
||||||
usage
|
usage
|
||||||
elif [ ! -s "$deb" ]; then
|
elif [ ! -s "${deb}" ]; then
|
||||||
echo "Can't find $deb!"
|
echo "Can't find ${deb}!"
|
||||||
exit
|
exit 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ "$1" = "" ]; then
|
if [ -z "$1" ]; then
|
||||||
usage
|
usage
|
||||||
elif [ "$1" = "-l" ]; then
|
elif [ "$1" = "-l" ]; then
|
||||||
exist
|
exist
|
||||||
type more >/dev/null 2>&1 && pager=more
|
type more >/dev/null 2>&1 && pager=more
|
||||||
type less >/dev/null 2>&1 && pager=less
|
type less >/dev/null 2>&1 && pager=less
|
||||||
[ "$pager" = "" ] && echo "No pager found!" && exit
|
[ -z "${pager}" ] && echo "No pager found!" && exit 1
|
||||||
(ar -p $deb control.tar.gz | tar -xzO *control ; echo -e "\nPress enter to scroll, q to Quit!\n" ; ar -p $deb data.tar.gz | tar -tzv) | $pager
|
(
|
||||||
exit
|
ar -p "${deb}" control.tar.gz | tar -xzO *control
|
||||||
|
printf "\nPress enter to scroll, q to Quit!\n\n"
|
||||||
|
ar -p "${deb}" data.tar.gz | tar -tzv
|
||||||
|
) | ${pager}
|
||||||
|
exit
|
||||||
elif [ "$1" = "-c" ]; then
|
elif [ "$1" = "-c" ]; then
|
||||||
exist
|
exist
|
||||||
ar -p $deb control.tar.gz | tar -xzO *control
|
ar -p "${deb}" control.tar.gz | tar -xzO *control
|
||||||
exit
|
exit
|
||||||
elif [ "$1" = "-x" ]; then
|
elif [ "$1" = "-x" ]; then
|
||||||
exist
|
exist
|
||||||
if [ "$3" = "" ]; then
|
if [ -z "$3" ]; then
|
||||||
usage
|
usage
|
||||||
elif [ ! -d "$3" ]; then
|
elif [ ! -d "$3" ]; then
|
||||||
echo "No such directory $3!"
|
echo "No such directory $3!"
|
||||||
exit
|
exit 1
|
||||||
fi
|
fi
|
||||||
ar -p $deb data.tar.gz | tar -xzvpf - -C $3 || exit
|
ar -p "${deb}" data.tar.gz | tar -xzvpf - -C "$3" || exit
|
||||||
echo
|
echo
|
||||||
echo "Extracted $deb to $3!"
|
echo "Extracted ${deb} to $3!"
|
||||||
exit
|
exit
|
||||||
else
|
else
|
||||||
usage
|
usage
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user