diff options
author | Marius Mauch <genone@gentoo.org> | 2006-07-19 10:21:32 +0000 |
---|---|---|
committer | Marius Mauch <genone@gentoo.org> | 2006-07-19 10:21:32 +0000 |
commit | f2250f95caa762cb08aa0d556526220b80814d7a (patch) | |
tree | d69e19ddfb41f95c6858d22a23d4dddcc54075d5 | |
parent | 3ae45027783c90420579143bfbf72476ac232aea (diff) | |
download | portage-f2250f95caa762cb08aa0d556526220b80814d7a.tar.gz portage-f2250f95caa762cb08aa0d556526220b80814d7a.tar.bz2 portage-f2250f95caa762cb08aa0d556526220b80814d7a.zip |
add option to discard config updates
svn path=/main/trunk/; revision=3930
-rwxr-xr-x | bin/etc-update | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/bin/etc-update b/bin/etc-update index 06ac3ddef..a1f81342e 100755 --- a/bin/etc-update +++ b/bin/etc-update @@ -122,6 +122,8 @@ function sel_file() { if [ "${OVERWRITE_ALL}" == "yes" ]; then input=0 + elif [ "${DELETE_ALL}" == "yes" ]; then + input=0 else if [[ ${mode} == 0 ]] ; then echo "The following is the list of files which need updating, each @@ -133,9 +135,11 @@ configuration file is followed by a list of possible replacement files." if [[ ${mode} == 0 ]] ; then cat ${TMP}/menuitems echo "Please select a file to edit by entering the corresponding number." - echo " (don't use -3 or -5 if you're unsure what to do)" + echo " (don't use -3, -5, -7 or -9 if you're unsure what to do)" echo " (-1 to exit) (-3 to auto merge all remaining files)" - echo -n " (-5 to auto-merge AND not use 'mv -i'): " + echo " (-5 to auto-merge AND not use 'mv -i')" + echo " (-7 to discard all updates)" + echo -n " (-9 to discard all updates AND not use 'rm -i'):" read input else dialog --title "${title}" --menu "${my_title}" \ @@ -143,6 +147,19 @@ configuration file is followed by a list of possible replacement files." 2> ${TMP}/input || die "User termination!" 0 input=$(<${TMP}/input) fi + if [[ ${input} == -9 ]]; then + read -p "Are you sure that you want to delete all updates (type YES):" reply + if [[ ${reply} != "YES" ]]; then + continue + else + input=-7 + export rm_opts="" + fi + fi + if [[ ${input} == -7 ]]; then + input=0 + export DELETE_ALL="yes" + fi if [[ ${input} == -5 ]] ; then input=-3 export mv_opts="" @@ -172,6 +189,8 @@ function do_file() { if [ "${OVERWRITE_ALL}" == "yes" ]; then my_input=0 + elif [ "${DELETE_ALL}" == "yes" ]; then + my_input=0 else for line in $(<${TMP}/files/${input}); do if (( ${fcount} > 0 )); then @@ -240,6 +259,8 @@ function do_cfg() { until (( ${my_input} == -1 )) || [ ! -f ${file} ]; do if [ "${OVERWRITE_ALL}" == "yes" ]; then my_input=1 + elif [ "${DELETE_ALL}" == "yes" ]; then + my_input=2 else showdiffcmd=$(echo "${diff_command}" | sed -e "s:%file1:${ofile}:" -e "s:%file2:${file}:") @@ -273,11 +294,12 @@ Please select from the menu above (-1 to ignore this update): " case ${my_input} in 1) echo "Replacing ${ofile} with ${file}" mv ${mv_opts} ${file} ${ofile} - my_input=-1 + [ -n "${OVERWRITE_ALL}" ] && my_input=-1 continue ;; 2) echo "Deleting ${file}" rm ${rm_opts} ${file} + [ -n "${DELETE_ALL}" ] && my_input=-1 continue ;; 3) do_merge "${file}" "${ofile}" |