Skip to content

Commit

Permalink
Round1 of bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
falconindy committed Jan 19, 2010
1 parent c9e85ab commit 4e10aff
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions squashfu
Original file line number Diff line number Diff line change
Expand Up @@ -270,23 +270,24 @@ 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

if [[ ! -w "$BINVENTORY" ]]; then
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
Expand Down

0 comments on commit 4e10aff

Please sign in to comment.