From 205426e96d7c78f54f26eed33519e478f562d5b5 Mon Sep 17 00:00:00 2001 From: Dave Reisner Date: Mon, 18 Jan 2010 16:27:17 -0500 Subject: Check UID and that .bin.list is writeable before proceeding with delete --- squashfu | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'squashfu') diff --git a/squashfu b/squashfu index eca789f..65e891b 100755 --- a/squashfu +++ b/squashfu @@ -270,6 +270,14 @@ action_backup () { action_remove_bin () { # check if the bin exists both in the binventory AND in the bins directory + if [[ $UID -eq 0 ]]; then + die "Must be root to remove a backup" + fi + + if [[ ! -w "$BINVENTORY" ]]; then + die "Error writing to ${BINVENTORY}" + fi + if [[ -z $2 && grep -E "^$1:" && -d "${BINS_DIR}/$1" ]]; then echo "Are you SURE you want to remove this bin?" printf "Bin ID: %s\nDate Created: %s\nSize: %s\n" \ -- cgit v1.2.3