aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Reisner <d@falconindy.com>2010-01-18 16:27:17 -0500
committerDave Reisner <d@falconindy.com>2010-01-18 16:27:17 -0500
commit205426e96d7c78f54f26eed33519e478f562d5b5 (patch)
tree864f35284aeca6917e99972bb5972469cccb83cb
parent168655fec6b8ba0ea9cda56c6aa5fbdaa6e3b593 (diff)
downloadsquashfu-205426e96d7c78f54f26eed33519e478f562d5b5.tar.gz
Check UID and that .bin.list is writeable before proceeding with delete
-rwxr-xr-xsquashfu8
1 files changed, 8 insertions, 0 deletions
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" \