diff options
| author | Eric Andersen <andersen@codepoet.org> | 2000-11-29 21:39:02 +0000 |
|---|---|---|
| committer | Eric Andersen <andersen@codepoet.org> | 2000-11-29 21:39:02 +0000 |
| commit | 4bfb6b7b67ff4238fde52e4019efe2284b9f99ef (patch) | |
| tree | e9e09f6d93fc8e16b2fd13844b07beede33176d8 | |
| parent | e500d2083560b2988e7e48e00ba836ce0450c656 (diff) | |
| download | busybox-w32-4bfb6b7b67ff4238fde52e4019efe2284b9f99ef.tar.gz busybox-w32-4bfb6b7b67ff4238fde52e4019efe2284b9f99ef.tar.bz2 busybox-w32-4bfb6b7b67ff4238fde52e4019efe2284b9f99ef.zip | |
Finish commit of rpmunpack and add in scripts for undeb and unrpm
| -rw-r--r-- | Changelog | 5 | ||||
| -rw-r--r-- | examples/undeb | 49 | ||||
| -rw-r--r-- | examples/unrpm | 43 | ||||
| -rw-r--r-- | rpmunpack.c (renamed from unrpm.c) | 14 | ||||
| -rw-r--r-- | scripts/undeb | 49 | ||||
| -rw-r--r-- | scripts/unrpm | 43 |
6 files changed, 193 insertions, 10 deletions
| @@ -2,7 +2,10 @@ | |||
| 2 | 2 | ||
| 3 | * Fixed uname problem causing the kernel version to be | 3 | * Fixed uname problem causing the kernel version to be |
| 4 | mis-detected (causing problems with poweroff, init, | 4 | mis-detected (causing problems with poweroff, init, |
| 5 | and other things). | 5 | and other things). |
| 6 | * kent robotti -- Renamed unrpm to original rpmunpack, so you can use | ||
| 7 | an included shell script called unrpm as a front end to it. There's | ||
| 8 | also a shell script called undeb included for debian packages. | ||
| 6 | 9 | ||
| 7 | -Erik Andersen | 10 | -Erik Andersen |
| 8 | 11 | ||
diff --git a/examples/undeb b/examples/undeb new file mode 100644 index 000000000..fa2bcb34c --- /dev/null +++ b/examples/undeb | |||
| @@ -0,0 +1,49 @@ | |||
| 1 | #!/bin/sh | ||
| 2 | # | ||
| 3 | usage() { | ||
| 4 | echo "Usage: undeb -c package.deb <Print control file info>" | ||
| 5 | echo " undeb -l package.deb <List contents of deb package>" | ||
| 6 | echo " undeb -x package.deb /foo/boo <Extract deb package to this directory," | ||
| 7 | echo " put . for current directory>" | ||
| 8 | exit | ||
| 9 | } | ||
| 10 | |||
| 11 | deb=$2 | ||
| 12 | |||
| 13 | exist() { | ||
| 14 | if [ "$deb" = "" ]; then | ||
| 15 | usage | ||
| 16 | elif [ ! -s "$deb" ]; then | ||
| 17 | echo "Can't find $deb!" | ||
| 18 | exit | ||
| 19 | fi | ||
| 20 | } | ||
| 21 | |||
| 22 | if [ "$1" = "" ]; then | ||
| 23 | usage | ||
| 24 | elif [ "$1" = "-l" ]; then | ||
| 25 | exist | ||
| 26 | type more >/dev/null 2>&1 && pager=more | ||
| 27 | type less >/dev/null 2>&1 && pager=less | ||
| 28 | trap "" 13 | ||
| 29 | (ar -p $deb control.tar.gz | gunzip -c | tar -x -O control ; echo -e "\nPress enter to scroll, q to Quit!\n" ; ar -p $deb data.tar.gz | gunzip -c | tar -t -v 2>/dev/null) | $pager | ||
| 30 | exit | ||
| 31 | elif [ "$1" = "-c" ]; then | ||
| 32 | exist | ||
| 33 | ar -p $deb control.tar.gz | gunzip -c | tar -x -O control | ||
| 34 | exit | ||
| 35 | elif [ "$1" = "-x" ]; then | ||
| 36 | exist | ||
| 37 | if [ "$3" = "" ]; then | ||
| 38 | usage | ||
| 39 | elif [ ! -d "$3" ]; then | ||
| 40 | echo "No such directory $3!" | ||
| 41 | exit | ||
| 42 | fi | ||
| 43 | ar -p $deb data.tar.gz | gunzip | (cd $3 ; tar -x -v -f -) || exit | ||
| 44 | echo | ||
| 45 | echo "Extracted $deb to $3!" | ||
| 46 | exit | ||
| 47 | else | ||
| 48 | usage | ||
| 49 | fi | ||
diff --git a/examples/unrpm b/examples/unrpm new file mode 100644 index 000000000..2cd1aa9c9 --- /dev/null +++ b/examples/unrpm | |||
| @@ -0,0 +1,43 @@ | |||
| 1 | #!/bin/sh | ||
| 2 | # | ||
| 3 | usage() { | ||
| 4 | echo "Usage: unrpm -l package.rpm <List contents of rpm package>" | ||
| 5 | echo " unrpm -x package.rpm /foo/boo <Extract rpm package to this directory," | ||
| 6 | echo " put . for current directory>" | ||
| 7 | exit | ||
| 8 | } | ||
| 9 | |||
| 10 | rpm=$2 | ||
| 11 | |||
| 12 | exist() { | ||
| 13 | if [ "$rpm" = "" ]; then | ||
| 14 | usage | ||
| 15 | elif [ ! -s "$rpm" ]; then | ||
| 16 | echo "Can't find $rpm!" | ||
| 17 | exit | ||
| 18 | fi | ||
| 19 | } | ||
| 20 | |||
| 21 | if [ "$1" = "" ]; then | ||
| 22 | usage | ||
| 23 | elif [ "$1" = "-l" ]; then | ||
| 24 | exist | ||
| 25 | type more >/dev/null 2>&1 && pager=more | ||
| 26 | type less >/dev/null 2>&1 && pager=less | ||
| 27 | (echo -e "\nPress enter to scroll, q to Quit!\n" ; rpmunpack < $rpm | gunzip -c | cpio -tvf --quiet) | $pager | ||
| 28 | exit | ||
| 29 | elif [ "$1" = "-x" ]; then | ||
| 30 | exist | ||
| 31 | if [ "$3" = "" ]; then | ||
| 32 | usage | ||
| 33 | elif [ ! -d "$3" ]; then | ||
| 34 | echo "No such directory $3!" | ||
| 35 | exit | ||
| 36 | fi | ||
| 37 | rpmunpack < $rpm | gunzip | (cd $3 ; cpio -idmuv) || exit | ||
| 38 | echo | ||
| 39 | echo "Extracted $rpm to $3!" | ||
| 40 | exit | ||
| 41 | else | ||
| 42 | usage | ||
| 43 | fi | ||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * Mini unrpm implementation for busybox | 2 | * rpmunpack for busybox |
| 3 | * | 3 | * |
| 4 | * rpmunpack.c - Utility program to unpack an RPM archive | 4 | * rpmunpack.c - Utility program to unpack an RPM archive |
| 5 | * | 5 | * |
| @@ -14,11 +14,7 @@ | |||
| 14 | */ | 14 | */ |
| 15 | 15 | ||
| 16 | #include "busybox.h" | 16 | #include "busybox.h" |
| 17 | #include <unistd.h> | ||
| 18 | #include <stdio.h> | ||
| 19 | #include <stdlib.h> | ||
| 20 | #include <fcntl.h> | 17 | #include <fcntl.h> |
| 21 | #include <string.h> | ||
| 22 | 18 | ||
| 23 | /* | 19 | /* |
| 24 | * Some general definitions | 20 | * Some general definitions |
| @@ -46,7 +42,7 @@ static void myread(int num) | |||
| 46 | if (err < 0) | 42 | if (err < 0) |
| 47 | perror(progname); | 43 | perror(progname); |
| 48 | else | 44 | else |
| 49 | fprintf(stderr, "unexpected end of input file\n"); | 45 | fprintf(stderr, "Unexpected end of input file!\n"); |
| 50 | exit(1); | 46 | exit(1); |
| 51 | } | 47 | } |
| 52 | } | 48 | } |
| @@ -54,7 +50,7 @@ static void myread(int num) | |||
| 54 | /* | 50 | /* |
| 55 | * Main program | 51 | * Main program |
| 56 | */ | 52 | */ |
| 57 | int unrpm_main(int argc, char **argv) | 53 | int rpmunpack_main(int argc, char **argv) |
| 58 | { | 54 | { |
| 59 | int len, status = 0; | 55 | int len, status = 0; |
| 60 | 56 | ||
| @@ -66,7 +62,7 @@ int unrpm_main(int argc, char **argv) | |||
| 66 | 62 | ||
| 67 | /* Check for command line parameters */ | 63 | /* Check for command line parameters */ |
| 68 | if (argc>=2 && *argv[1]=='-') { | 64 | if (argc>=2 && *argv[1]=='-') { |
| 69 | usage(unrpm_usage); | 65 | usage(rpmunpack_usage); |
| 70 | } | 66 | } |
| 71 | 67 | ||
| 72 | /* Open input file */ | 68 | /* Open input file */ |
| @@ -80,7 +76,7 @@ int unrpm_main(int argc, char **argv) | |||
| 80 | /* Read magic ID and output filename */ | 76 | /* Read magic ID and output filename */ |
| 81 | myread(4); | 77 | myread(4); |
| 82 | if (strncmp(buffer, RPM_MAGIC, 4)) { | 78 | if (strncmp(buffer, RPM_MAGIC, 4)) { |
| 83 | fprintf(stderr, "input file is not in RPM format\n"); | 79 | fprintf(stderr, "Input file is not in RPM format!\n"); |
| 84 | exit(1); | 80 | exit(1); |
| 85 | } | 81 | } |
| 86 | myread(6); /* Skip flags */ | 82 | myread(6); /* Skip flags */ |
diff --git a/scripts/undeb b/scripts/undeb new file mode 100644 index 000000000..fa2bcb34c --- /dev/null +++ b/scripts/undeb | |||
| @@ -0,0 +1,49 @@ | |||
| 1 | #!/bin/sh | ||
| 2 | # | ||
| 3 | usage() { | ||
| 4 | echo "Usage: undeb -c package.deb <Print control file info>" | ||
| 5 | echo " undeb -l package.deb <List contents of deb package>" | ||
| 6 | echo " undeb -x package.deb /foo/boo <Extract deb package to this directory," | ||
| 7 | echo " put . for current directory>" | ||
| 8 | exit | ||
| 9 | } | ||
| 10 | |||
| 11 | deb=$2 | ||
| 12 | |||
| 13 | exist() { | ||
| 14 | if [ "$deb" = "" ]; then | ||
| 15 | usage | ||
| 16 | elif [ ! -s "$deb" ]; then | ||
| 17 | echo "Can't find $deb!" | ||
| 18 | exit | ||
| 19 | fi | ||
| 20 | } | ||
| 21 | |||
| 22 | if [ "$1" = "" ]; then | ||
| 23 | usage | ||
| 24 | elif [ "$1" = "-l" ]; then | ||
| 25 | exist | ||
| 26 | type more >/dev/null 2>&1 && pager=more | ||
| 27 | type less >/dev/null 2>&1 && pager=less | ||
| 28 | trap "" 13 | ||
| 29 | (ar -p $deb control.tar.gz | gunzip -c | tar -x -O control ; echo -e "\nPress enter to scroll, q to Quit!\n" ; ar -p $deb data.tar.gz | gunzip -c | tar -t -v 2>/dev/null) | $pager | ||
| 30 | exit | ||
| 31 | elif [ "$1" = "-c" ]; then | ||
| 32 | exist | ||
| 33 | ar -p $deb control.tar.gz | gunzip -c | tar -x -O control | ||
| 34 | exit | ||
| 35 | elif [ "$1" = "-x" ]; then | ||
| 36 | exist | ||
| 37 | if [ "$3" = "" ]; then | ||
| 38 | usage | ||
| 39 | elif [ ! -d "$3" ]; then | ||
| 40 | echo "No such directory $3!" | ||
| 41 | exit | ||
| 42 | fi | ||
| 43 | ar -p $deb data.tar.gz | gunzip | (cd $3 ; tar -x -v -f -) || exit | ||
| 44 | echo | ||
| 45 | echo "Extracted $deb to $3!" | ||
| 46 | exit | ||
| 47 | else | ||
| 48 | usage | ||
| 49 | fi | ||
diff --git a/scripts/unrpm b/scripts/unrpm new file mode 100644 index 000000000..2cd1aa9c9 --- /dev/null +++ b/scripts/unrpm | |||
| @@ -0,0 +1,43 @@ | |||
| 1 | #!/bin/sh | ||
| 2 | # | ||
| 3 | usage() { | ||
| 4 | echo "Usage: unrpm -l package.rpm <List contents of rpm package>" | ||
| 5 | echo " unrpm -x package.rpm /foo/boo <Extract rpm package to this directory," | ||
| 6 | echo " put . for current directory>" | ||
| 7 | exit | ||
| 8 | } | ||
| 9 | |||
| 10 | rpm=$2 | ||
| 11 | |||
| 12 | exist() { | ||
| 13 | if [ "$rpm" = "" ]; then | ||
| 14 | usage | ||
| 15 | elif [ ! -s "$rpm" ]; then | ||
| 16 | echo "Can't find $rpm!" | ||
| 17 | exit | ||
| 18 | fi | ||
| 19 | } | ||
| 20 | |||
| 21 | if [ "$1" = "" ]; then | ||
| 22 | usage | ||
| 23 | elif [ "$1" = "-l" ]; then | ||
| 24 | exist | ||
| 25 | type more >/dev/null 2>&1 && pager=more | ||
| 26 | type less >/dev/null 2>&1 && pager=less | ||
| 27 | (echo -e "\nPress enter to scroll, q to Quit!\n" ; rpmunpack < $rpm | gunzip -c | cpio -tvf --quiet) | $pager | ||
| 28 | exit | ||
| 29 | elif [ "$1" = "-x" ]; then | ||
| 30 | exist | ||
| 31 | if [ "$3" = "" ]; then | ||
| 32 | usage | ||
| 33 | elif [ ! -d "$3" ]; then | ||
| 34 | echo "No such directory $3!" | ||
| 35 | exit | ||
| 36 | fi | ||
| 37 | rpmunpack < $rpm | gunzip | (cd $3 ; cpio -idmuv) || exit | ||
| 38 | echo | ||
| 39 | echo "Extracted $rpm to $3!" | ||
| 40 | exit | ||
| 41 | else | ||
| 42 | usage | ||
| 43 | fi | ||
