From: Heiko Z. <smi...@us...> - 2011-12-21 19:55:47
|
Update of /cvsroot/devil-linux/build/scripts/scripts In directory vz-cvs-3.sog:/tmp/cvs-serv25806/scripts/scripts Modified Files: pre_init upgrade-config Log Message: - closed bug #106 - pre_init: logic of /sbin/upgrade-config call - automatic upgrade is now available with "a" (good luck!) - upgrade has now to be initiated with "u", any other key skips - we now only wait 2 minutes for a upgrade-config decision, default behavior - is to skip Index: pre_init =================================================================== RCS file: /cvsroot/devil-linux/build/scripts/scripts/pre_init,v retrieving revision 1.33 retrieving revision 1.34 diff -u -d -r1.33 -r1.34 --- pre_init 19 May 2011 18:34:31 -0000 1.33 +++ pre_init 21 Dec 2011 19:55:44 -0000 1.34 @@ -101,23 +101,42 @@ $NORMAL echo cp -f /etc-cd/{Devil-release,issue,issue.net} /shm/etc-mods/ - bs="n" - read -n 1 -t 300 -p 'Press any key to upgrade, or "n" to skip. (timeout in 5 minutes)' bs - echo - if [ "$bs" != "n" ]; then - echo - echo -n "Comparing configurations, please wait " - /sbin/upgrade-config - echo - $YELLOW - echo - echo 'You MUST run "save-config" after bootup to save your new config' - echo - $NORMAL - echo - read -n 1 -t 300 -p 'Press any key to continue ... (timeout in 5 minutes)' + while true + do + bs="n" + read -n 1 -t 120 -p 'Press "u" to upgrade, "a" for automatic upgrade, or "n" to skip. (timeout in 2 minutes)' bs + test $? -gt 0 && bs="n" echo - fi + case "$bs" in + "u" ) + echo + echo -n "Comparing configurations, please wait " + /sbin/upgrade-config + echo + $YELLOW + echo + echo 'You MUST run "save-config" after bootup to save your new config' + echo + $NORMAL + echo + read -n 1 -t 300 -p 'Press any key to continue ... (timeout in 5 minutes)' + echo + break + ;; + "a" ) + echo + echo -n "Comparing configurations, please wait " + /sbin/upgrade-config auto + break + ;; + "n" ) + echo "skipping" + break + ;; + * ) + echo + esac + done unset bs fi Index: upgrade-config =================================================================== RCS file: /cvsroot/devil-linux/build/scripts/scripts/upgrade-config,v retrieving revision 1.46 retrieving revision 1.47 diff -u -d -r1.46 -r1.47 --- upgrade-config 18 Dec 2011 19:36:18 -0000 1.46 +++ upgrade-config 21 Dec 2011 19:55:44 -0000 1.47 @@ -9,6 +9,11 @@ # # Written by: Bruce Smith <dev...@re...> +AUTOCONFIG=0 +if [ "$1" = "auto" ]; then + AUTOCONFIG=1 +fi + DL_CONFIG_DIR="/floppy" DL_CONFIG_SOURCE="$(cat /shm/DL_CONFIG_SOURCE)" DL_CONFIG_FILE="$(cat /shm/DL_CONFIG_FILE)" @@ -17,6 +22,7 @@ TMPD=/shm/var/tmp/upd-etc.$$ TMPF=/shm/var/tmp/upd-tmp.$$ CMPF=/shm/var/tmp/upd-cmpf.$$ +AUTOF=/shm/var/tmp/upd-autof.$$ RESULT=/shm/var/tmp/upd-res.$$ RAMDISKDIR="/shm" LOGF="/shm/upgrade.log" @@ -104,6 +110,9 @@ fi echo > $CMPF +rm -f $AUTOF 2> /dev/null +touch $AUTOF + touch -t 198101010101.01 /shm/oldfile for f in $(find $FINDDIR -type f -mtime $MTIME -print) do @@ -134,19 +143,30 @@ [ -f "$f" -a "$f" -ot /shm/oldfile ] && onoff="off" cmp -s "/etc/$f" "$CMPDIR/$f" || echo "$f" \"\" $onoff \"$f\" >> $TMPD echo "$f" >> $CMPF + if [ "$onoff" = "on" ]; then + echo "\"$f\"" >> $AUTOF + fi done +echo rm -f /shm/oldfile -msgbox "Please read:" "The next screen will let you select which of your old config files you want to copy to your new configuration \n\nBe VERY CAREFUL to only copy files you have customized. Copying other files could cause severe problems.\n\nNote: Selecting \"Help\" will display info about the current file, but upon return you will lose all selections made." +if [ ${AUTOCONFIG} -eq 0 ]; then + msgbox "Please read:" "The next screen will let you select which of your old config files you want to copy to your new configuration \n\nBe VERY CAREFUL to only copy files you have customized. Copying other files could cause severe problems.\n\nNote: Selecting \"Help\" will display info about the current file, but upon return you will lose all selections made." +fi while true do - setmenuheight - eval $DIALOG --title \"Select files to be copied to the new config\" --backtitle \"$BACKTITLE\" \ - --item-help --help-button \ - --checklist \"[un]select files to be kept with the SPACE BAR\" 0 $width $height \ - $(sort $TMPD) 2> $RESULT - RETURN=$? + if [ ${AUTOCONFIG} -eq 0 ]; then + setmenuheight + eval $DIALOG --title \"Select files to be copied to the new config\" --backtitle \"$BACKTITLE\" \ + --item-help --help-button \ + --checklist \"[un]select files to be kept with the SPACE BAR\" 0 $width $height \ + $(sort $TMPD) 2> $RESULT + RETURN=$? + else + RESULT=$AUTOF + RETURN=0 + fi if [ $RETURN -eq 0 ]; then if [ "$(head -n1 $RESULT|cut -c1-4)" = "HELP" ]; then @@ -229,23 +249,9 @@ done fi -# echo >> $LOGF -# echo "Symlinks preserved from old config:" >> $LOGF -# echo "-----------------------------------" >> $LOGF -# echo >> $LOGF -# for f in $(find /etc/ -type l | grep -v "init.d/rc" | grep -v "init.d/boot.d") -# do -# eval p=$f -# d="$(dirname $p)" -# if [ ! -d $CMPDIR/$d ]; then -# mkdir -p $CMPDIR/$d -# chmod --reference /$d $CMPDIR/$d -# chown --reference /$d $CMPDIR/$d -# fi -# echo "preserving link: $f" | tee -a $LOGF -# cp -dpf $f $CMPDIR/$f -# done - pause + if [ ${AUTOCONFIG} -eq 0 ]; then + pause + fi break fi else @@ -255,8 +261,17 @@ done echo -if askyesno "/etc/sysconfig/config migration" "Do you want to migrate old values to your new /etc/sysconfig/config ?" yes -then + +DOIT=0 +if [ ${AUTOCONFIG} -eq 0 ]; then + if askyesno "/etc/sysconfig/config migration" "Do you want to migrate old values to your new /etc/sysconfig/config ?" yes ; then + DOIT=1 + fi +else + DOIT=1 +fi + +if [ ${DOIT} -eq 1 ]; then echo >> $LOGF echo >> $LOGF echo "/etc/sysconfig/config migration:" >> $LOGF @@ -275,10 +290,21 @@ do eval mod_config /etc/sysconfig/config ${bs} \"\$${bs}\" done - pause + if [ ${AUTOCONFIG} -eq 0 ]; then + pause + fi fi -if askyesno "User and Group migration" "Do you want to migrate your old users, groups and passwords?" yes ; then +DOIT=0 +if [ ${AUTOCONFIG} -eq 0 ]; then + if askyesno "User and Group migration" "Do you want to migrate your old users, groups and passwords?" yes ; then + DOIT=1 + fi +else + DOIT=1 +fi + +if [ ${DOIT} -eq 1 ]; then migrateid () { if [ -n "${PREUFS}" ]; then |