Changeset 3621 in MondoRescue for branches/3.3/mindi-busybox/examples/undeb


Ignore:
Timestamp:
Dec 20, 2016, 4:07:32 PM (7 years ago)
Author:
Bruno Cornec
Message:

New 3?3 banch for incorporation of latest busybox 1.25. Changing minor version to handle potential incompatibilities.

Location:
branches/3.3
Files:
1 edited
1 copied

Legend:

Unmodified
Added
Removed
  • branches/3.3/mindi-busybox/examples/undeb

    r821 r3621  
    66#
    77usage() {
    8 echo "Usage: undeb -c package.deb            <Print control file info>"
    9 echo "       undeb -l package.deb            <List contents of deb package>"
    10 echo "       undeb -x package.deb /foo/boo   <Extract deb package to this directory,"
    11 echo "                                        put . for current directory>"
    12 exit
     8    cat <<EOF
     9Usage: undeb -c package.deb            <Print control file info>
     10       undeb -l package.deb            <List contents of deb package>
     11       undeb -x package.deb /foo/boo   <Extract deb package to this directory,
     12                                        put . for current directory>
     13EOF
     14    exit
    1315}
    1416
     
    1618
    1719exist() {
    18 if [ "$deb" = "" ]; then
    19 usage
    20 elif [ ! -s "$deb" ]; then
    21 echo "Can't find $deb!"
    22 exit
    23 fi
     20    if [ -z "${deb}" ]; then
     21        usage
     22    elif [ ! -s "${deb}" ]; then
     23        echo "Can't find ${deb}!"
     24        exit 1
     25    fi
    2426}
    2527
    26 if [ "$1" = "" ]; then
    27 usage
     28if [ -z "$1" ]; then
     29    usage
    2830elif [ "$1" = "-l" ]; then
    29 exist
    30 type more >/dev/null 2>&1 && pager=more
    31 type less >/dev/null 2>&1 && pager=less
    32 [ "$pager" = "" ] && echo "No pager found!" && exit
    33 (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
    34 exit
     31    exist
     32    type more >/dev/null 2>&1 && pager=more
     33    type less >/dev/null 2>&1 && pager=less
     34    [ -z "${pager}" ] && echo "No pager found!" && exit 1
     35    (
     36        ar -p "${deb}" control.tar.gz | tar -xzO *control
     37        printf "\nPress enter to scroll, q to Quit!\n\n"
     38        ar -p "${deb}" data.tar.gz | tar -tzv
     39    ) | ${pager}
     40    exit
    3541elif [ "$1" = "-c" ]; then
    36 exist
    37 ar -p $deb control.tar.gz | tar -xzO *control
    38 exit
     42    exist
     43    ar -p "${deb}" control.tar.gz | tar -xzO *control
     44    exit
    3945elif [ "$1" = "-x" ]; then
    40 exist
    41 if [ "$3" = "" ]; then
    42 usage
    43 elif [ ! -d "$3" ]; then
    44 echo "No such directory $3!"
    45 exit
     46    exist
     47    if [ -z "$3" ]; then
     48        usage
     49    elif [ ! -d "$3" ]; then
     50        echo "No such directory $3!"
     51        exit 1
     52    fi
     53    ar -p "${deb}" data.tar.gz | tar -xzvpf - -C "$3" || exit
     54    echo
     55    echo "Extracted ${deb} to $3!"
     56    exit
     57else
     58    usage
    4659fi
    47 ar -p $deb data.tar.gz | tar -xzvpf - -C $3 || exit
    48 echo
    49 echo "Extracted $deb to $3!"
    50 exit
    51 else
    52 usage
    53 fi
Note: See TracChangeset for help on using the changeset viewer.