aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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