blob: c13d8cb3e6876f3ca13bc314287a028673283bf3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
#!/bin/sh
PREFIX=
. $PREFIX/lib/libalpine.sh
# set up temp dir
init_tmpdir TMPD
LBUCACHE="$TMPD/lbucache"
usage() {
echo "$PROGRAM $VERSION
Usage: $PROGAM [-ahl]
-a Select all updated files.
-h Show this help.
-l List updated files.
"
}
is_modified() {
[ -f "$LBUCACHE" ] || lbu status -a | awk '{print $2}' > "$LBUCACHE"
test -n "`( echo \"$1\" ; cat \"$LBUCACHE\" ) | sort | uniq -d`"
}
while getopts "alh" opt ; do
case "$opt" in
a) aflag="-a" ;;
l) lflag="-l" ;;
h|*) usage;;
esac
done
shift `expr $OPTIND - 1`
find "$ROOT/etc" -name '*.apk-new' | while read apknew ; do
p="${apknew%.apk-new}"
f="${p#${ROOT}/}"
unset choice
if [ "$lflag" ] ; then
# just list the file
if [ "$aflag" ] || is_modified "$f" ; then
echo "$p"
fi
elif [ "$aflag" ] || is_modified "$f" ; then
# ask user what to do with the file
while [ -z "$choice" ] ; do
echo "New $p available:"
echon "Quit, Next, Show diff, Edit new, Zap new, Use new (q/n/s/e/z/u) [s]: "
default_read choice "s" </dev/tty
case "$choice" in
q) exit;;
n) continue;;
s) diff -u "$p" "$apknew" | ${PAGER:-less}
unset choice
;;
e) ${EDITOR:-vi} "$apknew" ; unset choice;;
z) rm "$apknew";;
u) mv "$apknew" "$p";;
*) unset choice;;
esac
done
else
# auto update
echo "Autoupdating unchanged $p"
mv "$apknew" "$p"
fi
done
|