Debian Codegraph @

examples/undeb

raw symbols SCIP
1 #!/bin/shscip-shell filesystem . . `/bin/sh`.
2 #
3 # This should work with the GNU version of tar and gzip!
4 # This should work with the bash or ash shell!
5 # Requires the programs (ar, tar, gzip, and the pager more or less).
6 #
7 usagescip-shell shell shell-project 0.0.0 usage().() {
8 catscip-shell system . . cat. <<EOF
9 Usage: 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>
13 EOF
14 exit
15 }
16
17 deb=$2
18
19 existscip-shell shell shell-project 0.0.0 exist().() {
20 if [scip-shell system . . `[`. -z "${deb}" ]; then
21 usagescip-shell shell shell-project 0.0.0 usage().
22 elif [scip-shell system . . `[`. ! -s "${deb}" ]; then
23 echoscip-shell system . . echo. "Can't find ${deb}!"
24 exit 1
25 fi
26 }
27
28 if [scip-shell system . . `[`. -z "$1" ]; then
29 usagescip-shell shell shell-project 0.0.0 usage().
30 elif [scip-shell system . . `[`. "$1" = "-l" ]; then
31 existscip-shell shell shell-project 0.0.0 exist().
32 type more >/dev/nullscip-shell filesystem . . `/dev/null`. 2>&1 && pager=more
33 type less >/dev/nullscip-shell filesystem . . `/dev/null`. 2>&1 && pager=less
34 [scip-shell system . . `[`. -z "${pager}" ] && echoscip-shell system . . echo. "No pager found!" && exit 1
35 (
36 arscip-shell system . . ar. -p "${deb}" control.tar.gz | tarscip-shell system . . tar. -xzO *control
37 printfscip-shell system . . printf. "\nPress enter to scroll, q to Quit!\n\n"
38 arscip-shell system . . ar. -p "${deb}" data.tar.gz | tarscip-shell system . . tar. -tzv
39 ) | ${pager}
40 exit
41 elif [scip-shell system . . `[`. "$1" = "-c" ]; then
42 existscip-shell shell shell-project 0.0.0 exist().
43 arscip-shell system . . ar. -p "${deb}" control.tar.gz | tarscip-shell system . . tar. -xzO *control
44 exit
45 elif [scip-shell system . . `[`. "$1" = "-x" ]; then
46 existscip-shell shell shell-project 0.0.0 exist().
47 if [scip-shell system . . `[`. -z "$3" ]; then
48 usagescip-shell shell shell-project 0.0.0 usage().
49 elif [scip-shell system . . `[`. ! -d "$3" ]; then
50 echoscip-shell system . . echo. "No such directory $3!"
51 exit 1
52 fi
53 arscip-shell system . . ar. -p "${deb}" data.tar.gz | tarscip-shell system . . tar. -xzvpf - -C "$3" || exit
54 echoscip-shell system . . echo.
55 echoscip-shell system . . echo. "Extracted ${deb} to $3!"
56 exit
57 else
58 usagescip-shell shell shell-project 0.0.0 usage().
59 fi