aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2000-11-29 21:39:02 +0000
committerEric Andersen <andersen@codepoet.org>2000-11-29 21:39:02 +0000
commit4bfb6b7b67ff4238fde52e4019efe2284b9f99ef (patch)
treee9e09f6d93fc8e16b2fd13844b07beede33176d8
parente500d2083560b2988e7e48e00ba836ce0450c656 (diff)
downloadbusybox-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--Changelog5
-rw-r--r--examples/undeb49
-rw-r--r--examples/unrpm43
-rw-r--r--rpmunpack.c (renamed from unrpm.c)14
-rw-r--r--scripts/undeb49
-rw-r--r--scripts/unrpm43
6 files changed, 193 insertions, 10 deletions
diff --git a/Changelog b/Changelog
index 4f6f619bf..d2c1e7d28 100644
--- a/Changelog
+++ b/Changelog
@@ -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#
3usage() {
4echo "Usage: undeb -c package.deb <Print control file info>"
5echo " undeb -l package.deb <List contents of deb package>"
6echo " undeb -x package.deb /foo/boo <Extract deb package to this directory,"
7echo " put . for current directory>"
8exit
9}
10
11deb=$2
12
13exist() {
14if [ "$deb" = "" ]; then
15usage
16elif [ ! -s "$deb" ]; then
17echo "Can't find $deb!"
18exit
19fi
20}
21
22if [ "$1" = "" ]; then
23usage
24elif [ "$1" = "-l" ]; then
25exist
26type more >/dev/null 2>&1 && pager=more
27type less >/dev/null 2>&1 && pager=less
28trap "" 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
30exit
31elif [ "$1" = "-c" ]; then
32exist
33ar -p $deb control.tar.gz | gunzip -c | tar -x -O control
34exit
35elif [ "$1" = "-x" ]; then
36exist
37if [ "$3" = "" ]; then
38usage
39elif [ ! -d "$3" ]; then
40echo "No such directory $3!"
41exit
42fi
43ar -p $deb data.tar.gz | gunzip | (cd $3 ; tar -x -v -f -) || exit
44echo
45echo "Extracted $deb to $3!"
46exit
47else
48usage
49fi
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#
3usage() {
4echo "Usage: unrpm -l package.rpm <List contents of rpm package>"
5echo " unrpm -x package.rpm /foo/boo <Extract rpm package to this directory,"
6echo " put . for current directory>"
7exit
8}
9
10rpm=$2
11
12exist() {
13if [ "$rpm" = "" ]; then
14usage
15elif [ ! -s "$rpm" ]; then
16echo "Can't find $rpm!"
17exit
18fi
19}
20
21if [ "$1" = "" ]; then
22usage
23elif [ "$1" = "-l" ]; then
24exist
25type more >/dev/null 2>&1 && pager=more
26type 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
28exit
29elif [ "$1" = "-x" ]; then
30exist
31if [ "$3" = "" ]; then
32usage
33elif [ ! -d "$3" ]; then
34echo "No such directory $3!"
35exit
36fi
37rpmunpack < $rpm | gunzip | (cd $3 ; cpio -idmuv) || exit
38echo
39echo "Extracted $rpm to $3!"
40exit
41else
42usage
43fi
diff --git a/unrpm.c b/rpmunpack.c
index 26989e8b6..2178a247d 100644
--- a/unrpm.c
+++ b/rpmunpack.c
@@ -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 */
57int unrpm_main(int argc, char **argv) 53int 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#
3usage() {
4echo "Usage: undeb -c package.deb <Print control file info>"
5echo " undeb -l package.deb <List contents of deb package>"
6echo " undeb -x package.deb /foo/boo <Extract deb package to this directory,"
7echo " put . for current directory>"
8exit
9}
10
11deb=$2
12
13exist() {
14if [ "$deb" = "" ]; then
15usage
16elif [ ! -s "$deb" ]; then
17echo "Can't find $deb!"
18exit
19fi
20}
21
22if [ "$1" = "" ]; then
23usage
24elif [ "$1" = "-l" ]; then
25exist
26type more >/dev/null 2>&1 && pager=more
27type less >/dev/null 2>&1 && pager=less
28trap "" 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
30exit
31elif [ "$1" = "-c" ]; then
32exist
33ar -p $deb control.tar.gz | gunzip -c | tar -x -O control
34exit
35elif [ "$1" = "-x" ]; then
36exist
37if [ "$3" = "" ]; then
38usage
39elif [ ! -d "$3" ]; then
40echo "No such directory $3!"
41exit
42fi
43ar -p $deb data.tar.gz | gunzip | (cd $3 ; tar -x -v -f -) || exit
44echo
45echo "Extracted $deb to $3!"
46exit
47else
48usage
49fi
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#
3usage() {
4echo "Usage: unrpm -l package.rpm <List contents of rpm package>"
5echo " unrpm -x package.rpm /foo/boo <Extract rpm package to this directory,"
6echo " put . for current directory>"
7exit
8}
9
10rpm=$2
11
12exist() {
13if [ "$rpm" = "" ]; then
14usage
15elif [ ! -s "$rpm" ]; then
16echo "Can't find $rpm!"
17exit
18fi
19}
20
21if [ "$1" = "" ]; then
22usage
23elif [ "$1" = "-l" ]; then
24exist
25type more >/dev/null 2>&1 && pager=more
26type 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
28exit
29elif [ "$1" = "-x" ]; then
30exist
31if [ "$3" = "" ]; then
32usage
33elif [ ! -d "$3" ]; then
34echo "No such directory $3!"
35exit
36fi
37rpmunpack < $rpm | gunzip | (cd $3 ; cpio -idmuv) || exit
38echo
39echo "Extracted $rpm to $3!"
40exit
41else
42usage
43fi