Debian Codegraph @

scripts/pkg-tools/complete-filelist-rpm

raw
1 #!/bin/sh
2 #
3 # Create a complete file list for all installed packages
4 # rpm version
5 #
6 # Author: Stefan Hundhammer <[email protected]>
7 # License: GPL V2
8
9
10 SCRIPT_NAME=$(basename $0)
11
12 TMPDIR=/tmp/qdirstat-$USER
13 PKGLIST=$TMPDIR/pkglist.txt
14 FILELIST=$TMPDIR/filelist.txt
15
16
17 die()
18 {
19 msg="$*"
20 echo "$SCRIPT_NAME: FATAL: $msg"
21 exit 1
22 }
23
24
25 create_tmpdir()
26 {
27 test -d $TMPDIR || mkdir -p -m 700 $TMPDIR
28 test -d $TMPDIR || die "Can't create tmp dir $TMPDIR"
29 }
30
31
32 # Make sure the tmp directory has the right user and group ownership and
33 # permissions
34
35 check_tmpdir_security()
36 {
37
38 test $(stat $TMPDIR --format "%u") -eq $(id -u) || die "$TMPDIR: Wrong user ownership"
39 test $(stat $TMPDIR --format "%g") -eq $(id -g) || die "$TMPDIR: Wrong group ownership"
40 chmod 700 $TMPDIR
41 }
42
43
44 get_complete_filelist()
45 {
46 rm -f $FILELIST
47
48 echo -n "Reading file lists... "
49 rpm -qla | sort -u >$FILELIST
50 echo " done"
51
52 wc -l $FILELIST
53 }
54
55
56 #
57 # main()
58 #
59
60 create_tmpdir
61 check_tmpdir_security
62
63 get_complete_filelist