aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/undeb49
-rw-r--r--examples/unrpm43
2 files changed, 92 insertions, 0 deletions
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