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


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/unrpm

    r821 r3621  
    66#
    77usage() {
    8 echo "Usage: unrpm -l package.rpm            <List contents of rpm package>"
    9 echo "       unrpm -x package.rpm /foo/boo   <Extract rpm package to this directory,"
    10 echo "                                        put . for current directory>"
    11 exit
     8    cat <<EOF
     9Usage: unrpm -l package.rpm            <List contents of rpm package>
     10       unrpm -x package.rpm /foo/boo   <Extract rpm package to this directory,
     11                                        put . for current directory>
     12EOF
     13    exit
    1214}
    1315
     
    1517
    1618exist() {
    17 if [ "$rpm" = "" ]; then
    18 usage
    19 elif [ ! -s "$rpm" ]; then
    20 echo "Can't find $rpm!"
    21 exit
    22 fi
     19    if [ -z "${rpm}" ]; then
     20        usage
     21    elif [ ! -s "${rpm}" ]; then
     22        echo "Can't find ${rpm}!"
     23        exit 1
     24    fi
    2325}
    2426
    25 if [ "$1" = "" ]; then
    26 usage
     27if [ -z "$1" ]; then
     28    usage
    2729elif [ "$1" = "-l" ]; then
    28 exist
    29 type more >/dev/null 2>&1 && pager=more
    30 type less >/dev/null 2>&1 && pager=less
    31 [ "$pager" = "" ] && echo "No pager found!" && exit
    32 (echo -e "\nPress enter to scroll, q to Quit!\n" ; rpm2cpio $rpm | cpio -tv --quiet) | $pager
    33 exit
     30    exist
     31    type more >/dev/null 2>&1 && pager=more
     32    type less >/dev/null 2>&1 && pager=less
     33    [ "$pager" = "" ] && echo "No pager found!" && exit
     34    (
     35        printf "\nPress enter to scroll, q to Quit!\n\n"
     36        rpm2cpio "${rpm}" | cpio -tv --quiet
     37    ) | ${pager}
     38    exit
    3439elif [ "$1" = "-x" ]; then
    35 exist
    36 if [ "$3" = "" ]; then
    37 usage
    38 elif [ ! -d "$3" ]; then
    39 echo "No such directory $3!"
    40 exit
     40    exist
     41    if [ -z "$3" ]; then
     42        usage
     43    elif [ ! -d "$3" ]; then
     44        echo "No such directory $3!"
     45        exit 1
     46    fi
     47    rpm2cpio "${rpm}" | (umask 0 ; cd "$3" ; cpio -idmuv) || exit
     48    echo
     49    echo "Extracted ${rpm} to $3!"
     50    exit
     51else
     52    usage
    4153fi
    42 rpm2cpio $rpm | (umask 0 ; cd $3 ; cpio -idmuv) || exit
    43 echo
    44 echo "Extracted $rpm to $3!"
    45 exit
    46 else
    47 usage
    48 fi
Note: See TracChangeset for help on using the changeset viewer.