summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2008-06-14 22:07:09 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2008-06-14 22:07:09 +0000
commit5fc20afe2bb1d1cb17303fe16dfe3cbea7ef1c12 (patch)
treefed6ac961cdfe8b3c9840f1002202d2dc46f7200
parent8fcae700d2f7b9d10819cc55c67a2ea6c89a4a60 (diff)
downloadalpine-conf-5fc20afe2bb1d1cb17303fe16dfe3cbea7ef1c12.tar.bz2
alpine-conf-5fc20afe2bb1d1cb17303fe16dfe3cbea7ef1c12.tar.xz
create backups
-rw-r--r--lbu8
1 files changed, 7 insertions, 1 deletions
diff --git a/lbu b/lbu
index 76400e8..c463afe 100644
--- a/lbu
+++ b/lbu
@@ -324,6 +324,7 @@ cmd_commit() {
outfile="$outfile.$ENCRYPTION"
fi
+
# remove old config files
if [ -n "$DELETEOLDCONFIGS" ] ; then
local rmfiles=$(ls "$mnt/"*.apkovl.tar.gz* 2>/dev/null)
@@ -337,7 +338,12 @@ cmd_commit() {
fi
else
lines=$(ls -1 "$mnt"/*.apkovl.tar.gz* 2>/dev/null)
- if [ -n "$lines" ] && [ "$lines" != "$outfile" ]; then
+ if [ "$lines" = "$outfile" ]; then
+ local d=$( date -r "$outfile" "+%Y%m%d%H%m%S" )
+ local backup=$(echo "$outfile" | sed "s/\.apkovl\.tar\.gz/.$d.tar.gz/")
+ vecho "Creating backup $backup"
+ [ -z "$DRYRUN" ] && mv "$outfile" "$backup"
+ elif [ -n "$lines" ]; then
# More then one apkovl, this is a security concern
[ -z "$was_mounted" ] && umount "$mnt"
eecho "The following apkovl file(s) were found:"