summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDubiousjim <dubiousjim@gmail.com>2013-07-01 17:14:17 -0400
committerNatanael Copa <ncopa@alpinelinux.org>2013-07-03 07:56:16 +0000
commit27770e1e07da16dcd911a638434fd3dda3137db2 (patch)
tree6919ec96858886f0592334381cae72be532c6813
parent63198c22087474306f38e7158b701f673da6ea8e (diff)
downloadalpine-conf-27770e1e07da16dcd911a638434fd3dda3137db2.zip
update-conf: add vimdiff action
-rw-r--r--update-conf.in11
1 files changed, 10 insertions, 1 deletions
diff --git a/update-conf.in b/update-conf.in
index c3ba366..18e4e7d 100644
--- a/update-conf.in
+++ b/update-conf.in
@@ -51,6 +51,11 @@ while true; do
shift
done
+if which vimdiff >/dev/null; then
+ vflag=", Vimdiff old new"
+ vflag2="/v"
+fi
+
for apknew in $(find "$ROOT/etc" -name '*.apk-new') ; do
p="${apknew%.apk-new}"
f="${p#${ROOT}/}"
@@ -75,7 +80,7 @@ for apknew in $(find "$ROOT/etc" -name '*.apk-new') ; do
# 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]: "
+ echon "Quit, Next, Show diff, Edit new${vflag}, Zap new, Use new (q/n/s/e${vflag2}/z/u) [s]: "
default_read choice "s" </dev/tty
case "$choice" in
q) exit;;
@@ -84,6 +89,10 @@ for apknew in $(find "$ROOT/etc" -name '*.apk-new') ; do
unset choice
;;
e) ${EDITOR:-vi} "$apknew" ; unset choice;;
+ v) if [ "$vflag" ]; then
+ vimdiff "$p" "$apknew"
+ fi
+ unset choice;;
z) rm "$apknew";;
u) mv "$apknew" "$p";;
*) unset choice;;