aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnthony Basile <blueness@gentoo.org>2010-12-12 18:30:45 -0500
committerZac Medico <zmedico@gentoo.org>2010-12-12 22:01:58 -0800
commit99ec8de8e69f71e9a3f04dc318c7c741c5e6563a (patch)
treebbc8925e3f1a8142856163eb7364252836400693 /bin/etc-update
parentloadResumeCommand: select first matched package (diff)
downloadportage-99ec8de8e69f71e9a3f04dc318c7c741c5e6563a.tar.gz
portage-99ec8de8e69f71e9a3f04dc318c7c741c5e6563a.tar.bz2
portage-99ec8de8e69f71e9a3f04dc318c7c741c5e6563a.zip
etc-update: add option to save example config
This will fix bug #348561.
Diffstat (limited to 'bin/etc-update')
-rwxr-xr-xbin/etc-update33
1 files changed, 33 insertions, 0 deletions
diff --git a/bin/etc-update b/bin/etc-update
index e282a307c..d4ed6e689 100755
--- a/bin/etc-update
+++ b/bin/etc-update
@@ -339,6 +339,7 @@ do_cfg() {
2) Delete update, keeping original as is
3) Interactively merge original with update
4) Show differences again
+5) Save update as example config
Please select from the menu above (-1 to ignore this update): "
my_input=$(read_int)
fi
@@ -361,6 +362,8 @@ Please select from the menu above (-1 to ignore this update): "
;;
4) continue
;;
+ 5) do_distconf "${file}" "${ofile}"
+ ;;
*) continue
;;
esac
@@ -444,6 +447,36 @@ Please select from the menu above (-1 to exit, losing this merge): "
return 255
}
+do_distconf() {
+ # search for any previously saved distribution config
+ # files and number the current one accordingly
+
+ local file="${1}"
+ local ofile="${2}"
+ local -i count
+ local -i size
+ local -i fill
+ local -i f
+ local suffix
+ local efile
+
+ for count in $(seq 0 9999); do
+ size=${#count}
+ let fill=$((4-$size))
+ suffix=".dist_"
+ for f in $(seq 1 $fill); do
+ suffix+="0"
+ done
+ suffix+="${count}"
+ efile="${ofile}${suffix}"
+ if [[ ! -f ${efile} ]]; then
+ echo ${efile}
+ mv ${mv_opts} ${file} ${efile}
+ break
+ fi
+ done
+}
+
die() {
trap SIGTERM
trap SIGINT