Commit f1b3b2d2 authored by Natanael Copa's avatar Natanael Copa

lbu log is renamed to lbu list-backup|lb. fix bugs in lbu list-backup and lbu revert

parent c7e6eae6
...@@ -9,7 +9,7 @@ PREFIX= ...@@ -9,7 +9,7 @@ PREFIX=
# this one is from apk-tools # this one is from apk-tools
. $PREFIX/lib/apk/libutil.sh . $PREFIX/lib/apk/libutil.sh
VERSION=1.1 VERSION=1.2
[ "$SFIC" ] && SFIC="$SFIC -i d" [ "$SFIC" ] && SFIC="$SFIC -i d"
# globals # globals
...@@ -47,7 +47,7 @@ Available subcommands: ...@@ -47,7 +47,7 @@ Available subcommands:
package (pkg) package (pkg)
status (stat, st) status (stat, st)
update (up) update (up)
log list-backup (lb)
revert revert
Common options: Common options:
...@@ -73,7 +73,7 @@ exit_clean() { ...@@ -73,7 +73,7 @@ exit_clean() {
} }
mount_once() { mount_once() {
if grep $1 /proc/mounts >/dev/null; then if ! grep $1 /proc/mounts >/dev/null; then
mount $1 && UMOUNT_LIST="$1 $UMOUNT_LIST" mount $1 && UMOUNT_LIST="$1 $UMOUNT_LIST"
fi fi
} }
...@@ -453,18 +453,18 @@ show_exclude() { ...@@ -453,18 +453,18 @@ show_exclude() {
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
# lbu_status - check what files have been changed since last save # lbu_status - check what files have been changed since last save
usage_log() usage_listbackup() {
cat <<EOF cat <<EOF
$PROGRAM $VERSION $PROGRAM $VERSION
Show old commits. Show old commits.
usage: $PROGRAM log [<media>] usage: $PROGRAM list-backup [<media>]
EOF EOF
exit 1 exit 1
} }
cmd_log() { cmd_listbackup() {
local media=${1:-"$LBU_MEDIA"} local media=${1:-"$LBU_MEDIA"}
local mnt="/media/$media" local mnt="/media/$media"
[ -z "$media" ] && usage_log [ -z "$media" ] && usage_log
...@@ -495,13 +495,13 @@ cmd_revert() { ...@@ -495,13 +495,13 @@ cmd_revert() {
local current="$mnt/$(hostname).apkovl.tar.gz" local current="$mnt/$(hostname).apkovl.tar.gz"
if [ -n "$ENCRYPTION" ]; then if [ -n "$ENCRYPTION" ]; then
outfile="$outfile.$ENCRYPTION" current="$current.$ENCRYPTION"
fi fi
mount_once "$mnt" || die "failed to mount $mnt" mount_once "$mnt" || die "failed to mount $mnt"
[ -f "$revertto" ] || die "file not found: $revertto" [ -f "$revertto" ] || die "file not found: $revertto"
backup_apkovl "$outfile" backup_apkovl "$current"
vecho "Reverting to $1" vecho "Reverting to $1"
[ -z "$DRYRUN" ] && mv "$revertto" "$outfile" [ -z "$DRYRUN" ] && mv "$revertto" "$current"
} }
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
...@@ -593,7 +593,7 @@ case "$cmd" in ...@@ -593,7 +593,7 @@ case "$cmd" in
package|pkg) SUBCMD="package";; package|pkg) SUBCMD="package";;
status|stat|st) SUBCMD="status";; status|stat|st) SUBCMD="status";;
update|up) SUBCMD="update";; update|up) SUBCMD="update";;
log) SUBCMD="log";; list-backup|lb) SUBCMD="listbackup";;
revert) SUBCMD="revert";; revert) SUBCMD="revert";;
*) usage;; *) usage;;
esac esac
......
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