aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Reisner <d@falconindy.com>2010-01-18 21:32:56 -0500
committerDave Reisner <d@falconindy.com>2010-01-18 21:32:56 -0500
commit4e10aff51d4b56f4d467dcd9f726bdb9d60677ca (patch)
tree1872461f464c39e4517ce68174200d6e680cdaa0
parentc9e85abea99dbb65f8f0ba71c1fd6ac7d84ec2ea (diff)
downloadsquashfu-4e10aff51d4b56f4d467dcd9f726bdb9d60677ca.tar.gz
Round1 of bug fixes
-rwxr-xr-xsquashfu7
1 files changed, 4 insertions, 3 deletions
diff --git a/squashfu b/squashfu
index e18c6a7..690fc23 100755
--- a/squashfu
+++ b/squashfu
@@ -270,7 +270,7 @@ action_backup () {
action_remove_bin () {
# check if the bin exists both in the binventory AND in the bins directory
- if [[ $UID -eq 0 ]]; then
+ if [[ $UID -ne 0 ]]; then
die "Must be root to remove a backup"
fi
@@ -278,15 +278,16 @@ action_remove_bin () {
die "Error writing to ${BINVENTORY}"
fi
- if [[ -z $2 && grep -E "^$1:" && -d "${BINS_DIR}/$1" ]]; then
+ if [[ -z $2 && $(grep -E "^$1:" ${BINVENTORY}) && -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" \
+ printf "\tBin ID: %s\n\tDate Created: %s\n\tSize: %s\n" \
"$1" \
"$(date --rfc-3339=seconds --date="1970-01-01 $rb_timestamp sec GMT")" \
"$(du -sh "${BINS_DIR}/$1" 2>/dev/null)"
read -p "Confirm deletion (y/N)" confirm
if [[ $confirm != "y" ]]; then
+ info "Delete operation aborted"
exit 1
fi
fi