#!/bin/sh # # Create a complete file list for all installed packages # rpm version # # Author: Stefan Hundhammer # License: GPL V2 SCRIPT_NAME=$(basename $0) TMPDIR=/tmp/qdirstat-$USER PKGLIST=$TMPDIR/pkglist.txt FILELIST=$TMPDIR/filelist.txt die() { msg="$*" echo "$SCRIPT_NAME: FATAL: $msg" exit 1 } create_tmpdir() { test -d $TMPDIR || mkdir -p -m 700 $TMPDIR test -d $TMPDIR || die "Can't create tmp dir $TMPDIR" } # Make sure the tmp directory has the right user and group ownership and # permissions check_tmpdir_security() { test $(stat $TMPDIR --format "%u") -eq $(id -u) || die "$TMPDIR: Wrong user ownership" test $(stat $TMPDIR --format "%g") -eq $(id -g) || die "$TMPDIR: Wrong group ownership" chmod 700 $TMPDIR } get_complete_filelist() { rm -f $FILELIST echo -n "Reading file lists... " rpm -qla | sort -u >$FILELIST echo " done" wc -l $FILELIST } # # main() # create_tmpdir check_tmpdir_security get_complete_filelist