Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
alpine
alpine-conf
Commits
40a33b2c
Commit
40a33b2c
authored
May 06, 2009
by
Natanael Copa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
implement lbu diff and lbu status
parent
b9ee041e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
78 additions
and
3 deletions
+78
-3
lbu.in
lbu.in
+78
-3
No files found.
lbu.in
View file @
40a33b2c
...
...
@@ -120,7 +120,31 @@ list_delete() {
done
}
#
unpack
archive
on
LBU_MEDIA
to
given
dir
unpack_apkovl
()
{
local
f
=
"$(hostname).apkovl.tar.gz"
local
dest
=
"$1"
local
mnt
=
"/media/$LBU_MEDIA"
local
count
=
0
mkdir
-
p
"$dest"
mount_once
"$mnt"
if
[
! -f "$mnt/$f" ]; then
return
1
fi
if
[
-
z
"$ENCRYPTION"
];
then
tar
-
C
"$dest"
-
zxf
"$mnt/$f"
return
fi
f
=
"$f.$ENCRYPTION"
check_openssl
while
[
$
count
-
lt
3
];
do
$
OPENSSL
enc
-
d
-$
ENCRYPTION
-
in
"$mnt/$f"
|
tar
\
-
C
"$dest"
-
zx
2
>/
dev
/
null
&&
return
0
count
=$((
$
count
+
1
))
done
cleanup
die
"Failed to unpack $mnt/$f"
}
#
#
lbu_include
-
add
/
remove
files
to
include
list
...
...
@@ -496,14 +520,64 @@ cmd_status() {
apk
audit
--
backup
return
0
fi
#
unpack
old
apkovl
to
tmpdir
/
a
LBU_MEDIA
=${
1
:-
"$LBU_MEDIA"
}
[
-
z
"$LBU_MEDIA"
]
&&
usage_status
local
tmp
init_tmpdir
tmp
mkdir
-
p
"$tmpdir/a"
"$tmp/b"
#
unpack
last
commited
apkovl
to
tmpdir
/
a
unpack_apkovl
"$tmp/a"
#
generate
new
apkovl
and
extract
to
tmpdir
/
b
cmd_package
-
|
tar
-
C
"$tmp/b"
-
zx
#
show
files
that
exists
in
a
but
not
in
b
as
deleted
local
f
(
cd
"$tmp"
/
a
&&
find
)
|
while
read
f
;
do
f
=${
f
#./}
[
"$f"
=
"."
]
&&
continue
[
-
e
"$tmp/b/$f"
]
||
echo
"D $f"
done
#
compare
files
in
b
with
files
in
a
#
cleanup
(
cd
"$tmp"
/
b
&&
find
)
|
while
read
f
;
do
f
=${
f
#./}
[
"$f"
=
"."
]
&&
continue
local
a
=
"$tmp/a/$f"
local
b
=
"$tmp/b/$f"
if
[
! -e "$a" ]; then
echo
"A $f"
elif
[
"$b"
-
nt
"$a"
]
&&
! cmp -s "$a" "$b"; then
echo
"U $f"
fi
done
}
#-----------------------------------------------------------
#
lbu_diff
-
run
a
diff
against
last
commit
usage_diff
()
{
echo
"$PROGRAM $VERSION
Run a diff against last commit
usage: $PROGRAM diff [<media>]
"
exit
1
}
cmd_diff
()
{
LBU_MEDIA
=${
1
:-
"$LBU_MEDIA"
}
[
-
z
"$LBU_MEDIA"
]
&&
usage_diff
local
tmp
init_tmpdir
tmp
mkdir
-
p
"$tmpdir/a"
"$tmp/b"
unpack_apkovl
"$tmp/a"
cmd_package
-
|
tar
-
C
"$tmp/b"
-
zx
cd
"$tmp"
&&
diff
-
ruN
a
b
}
#-----------------------------------------------------------
#
Main
...
...
@@ -526,6 +600,7 @@ case "$cmd" in
status
|
stat
|
st
)
SUBCMD
=
"status"
;;
list
-
backup
|
lb
)
SUBCMD
=
"listbackup"
;;
revert
)
SUBCMD
=
"revert"
;;
diff
)
SUBCMD
=
"diff"
;;
*)
usage
;;
esac
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment