#!/bin/sh #---------------------------------------------------------------------------- # /usr/bin/undeb - undeb # # Creation : 2015-04-25 holbru # Last update: $Id$ # # Based on unrpm from Kent Robotti 1999-12-03 # Copyright (c) 2015-@@YEAR@@ Holger Bruenjes, holgerbruenjes(at)gmx(dot)net # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. #---------------------------------------------------------------------------- MSG() { cat < # # Extract debian package to current directory. # Example: undeb -x -d . package.deb # Extract debian package to a directory called fooboo, create # the directory if it doesn't exist: # mkdir fooboo # Example: undeb -x -d fooboo package.deb # Extract debian package to /mnt/linux directory. # Example: undeb -x -d /mnt/linux package.deb EOF } case "${1}" in ""|--help|-h) MSG exit 0 ;; esac if [ "${1}" = "-x" -a "${2}" = "-d" ] then _path="${3}" if [ "${_path}" = "/" ] then echo "No extract to '/' " echo "extract to /tmp/$(basename "${4}")" _path="/tmp/$(basename "${4}")" fi if [ ! -d "${_path}" ] then mkdir -pv -m 1777 "${_path}" fi pwd=${PWD} echo dpkg-deb -X ${4} ${_path} || exit 1 echo echo "${4} extracted to ${_path}" echo exit fi if [ "${1}" = "-l" -a -s "${2}" ] then if [ -n "${PAGER}" ] then pager="${PAGER}" elif type -all less >/dev/null 2>&1 then pager=less elif type -all more >/dev/null 2>&1 then pager=more else pager="echo No PAGER found, no more or less." exit 1 fi dpkg-deb -I ${2} > /tmp/deb.tmp echo >> /tmp/deb.tmp dpkg-deb -c ${2} >> /tmp/deb.tmp tmp=/tmp/deb.tmp ${pager} ${tmp} rm -f /tmp/deb.tmp fi