Commit a74bb7dd authored by Natanael Copa's avatar Natanael Copa
Browse files

fix bug with filenames on backup files.

fix bug when there are no backups
parent 3a0cbe42
V=1.6 V=1.6.1
P=alpine-conf P=alpine-conf
PV=$(P)-$(V) PV=$(P)-$(V)
APKF=$(PV).apk APKF=$(PV).apk
......
...@@ -82,7 +82,7 @@ mount_once() { ...@@ -82,7 +82,7 @@ mount_once() {
# create backupfile # create backupfile
backup_apkovl() { backup_apkovl() {
local outfile="$1" local outfile="$1"
local d=$( date -u -r "$outfile" "+%Y%m%d%H%m%S" ) local d=$( date -u -r "$outfile" "+%Y%m%d%H%M%S" )
local backup=$(echo "$outfile" | sed "s/\.apkovl\.tar\.gz/.$d.tar.gz/") local backup=$(echo "$outfile" | sed "s/\.apkovl\.tar\.gz/.$d.tar.gz/")
vecho "Creating backup $backup" vecho "Creating backup $backup"
if [ -z "$DRYRUN" ]; then if [ -z "$DRYRUN" ]; then
...@@ -387,7 +387,7 @@ cmd_commit() { ...@@ -387,7 +387,7 @@ cmd_commit() {
# delete old backups if needed # delete old backups if needed
# poor mans 'head -n -N' done with awk. # poor mans 'head -n -N' done with awk.
ls "$mnt"/$(hostname).[0-9][0-9][0-9][0-9]*[0-9].tar.gz \ ls "$mnt"/$(hostname).[0-9][0-9][0-9][0-9]*[0-9].tar.gz 2>/dev/null \
| awk '{ a[++i] = $0; } END { | awk '{ a[++i] = $0; } END {
print a[0]; print a[0];
while (i-- > '"${BACKUP_LIMIT:-0}"') { while (i-- > '"${BACKUP_LIMIT:-0}"') {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment