diff options
-rwxr-xr-x | bin/etc-update | 33 |
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 |