From: <smi...@us...> - 2004-01-06 02:38:17
|
Update of /cvsroot/devil-linux/build/scripts/scripts In directory sc8-pr-cvs1:/tmp/cvs-serv17234/scripts/scripts Modified Files: Tag: rel-1-0-patches upgrade-config Log Message: backported upgrade-script added latest kernel patches Index: upgrade-config =================================================================== RCS file: /cvsroot/devil-linux/build/scripts/scripts/upgrade-config,v retrieving revision 1.6.2.3 retrieving revision 1.6.2.4 diff -u -d -r1.6.2.3 -r1.6.2.4 --- upgrade-config 26 Dec 2003 19:51:46 -0000 1.6.2.3 +++ upgrade-config 6 Jan 2004 02:38:14 -0000 1.6.2.4 @@ -95,19 +95,27 @@ for f in $(find etc root -type f -print) do + onoff="off" echo -n "." [ $f = "etc/Devil-release" ] && continue [ $f = "etc/issue" ] && continue [ $f = "etc/issue.net" ] && continue - [ $f = "etc/sysconfig/config" ] && continue - [ $f = "etc/sysconfig/config.default" ] && continue - [ $f = "etc/sysconfig/config.old" ] && continue [ $f = "etc/sysconfig/upgrade.log" ] && continue [ $f = "etc/sysconfig/software" ] && continue - [ $f = "etc/modules/modules.dep" ] && continue [ $f = "etc/mtab" ] && continue [ $f = "etc/.pwd.lock" ] && continue - cmp -s $f newconfig/$f || echo $f \"\" off \"$f\" >> $TMPD + [ $f = "etc/passwd" ] && continue + [ $f = "etc/passwd-" ] && continue + [ $f = "etc/group" ] && continue + [ $f = "etc/group-" ] && continue + [ $f = "etc/shadow" ] && continue + [ $f = "etc/shadow-" ] && continue + [ $f = "etc/gshadow" ] && continue + [ $f = "etc/gshadow-" ] && continue + [ "$(expr substr "$f" 1 12)" = "etc/modules/" ] && continue + [ "$(expr substr "$f" 1 20)" = "etc/sysconfig/config" ] && continue + [ "$(expr substr "$f" 1 17)" = "etc/ssh/ssh_host_" ] && onoff="on" + cmp -s $f newconfig/$f || echo $f \"\" $onoff \"$f\" >> $TMPD done 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." @@ -220,12 +228,58 @@ cp -f etc/sysconfig/config newconfig/etc/sysconfig/config.old cp -f newconfig/etc/sysconfig/config newconfig/etc/sysconfig/config.default . etc/sysconfig/config - echo "Migrating /etc/sysconfig/config values " + echo "Migrating /etc/sysconfig/config values ..." echo for bs in $(grep -v -e '^ *#' -e '^ *$' etc/sysconfig/config|cut -f1 -d'=') do eval mod_config newconfig/etc/sysconfig/config ${bs} \"\$${bs}\" done +fi + +if askyesno "User and Group migration" "Do you want to migrate your old users, groups and passwords?" yes ; then + migrateid () + { + cp -f newconfig/${1} newconfig/${1}- + cp -f newconfig/${2} newconfig/${2}- + > newconfig/${2} + + # Migrate passwords for existing users/groups + while read id ; do + name="$(echo $id|cut -d: -f1)" + if [ $(grep -c "^${name}:" ${2}) -ne 1 ]; then + grep "^${name}:" newconfig/${2}- >> newconfig/${2} + else + grep "^${name}:" ${2} >> newconfig/${2} + fi + [ "$(grep "^${name}:" ${2})" != "$(grep "^${name}:" newconfig/${2}-)" ] && \ + echo ${name} - info migrated. | tee -a $LOGF + done < newconfig/$1 + + # Add all non-existing users/groups to new config + while read id ; do + name="$(echo $id|cut -d: -f1)" + [ "$(grep -c "^${name}:" newconfig/${1})" -gt 0 ] && continue + grep "^${name}:" ${1} >> newconfig/${1} + grep "^${name}:" ${2} >> newconfig/${2} + echo ${name} - created. | tee -a $LOGF + done < $1 + } + + echo >> $LOGF + echo | tee -a $LOGF + echo "User migration:" | tee -a $LOGF + echo "---------------" >> $LOGF + echo | tee -a $LOGF + + migrateid etc/passwd etc/shadow + + echo >> $LOGF + echo | tee -a $LOGF + echo "Group migration:" | tee -a $LOGF + echo "----------------" >> $LOGF + echo | tee -a $LOGF + + migrateid etc/group etc/gshadow fi rm -fr $TMPD $RESULT |