diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2007-07-03 11:45:23 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2007-07-03 11:45:23 +0000 |
commit | d18b9ba9b861e539e4acbcb6eee830276279cb66 (patch) | |
tree | a0ab42ced03f6748cee9357299cc7c96f93bea43 | |
parent | b92748505dfe98482f5010ffaaf40ec51f690ad4 (diff) | |
download | drakx-d18b9ba9b861e539e4acbcb6eee830276279cb66.tar drakx-d18b9ba9b861e539e4acbcb6eee830276279cb66.tar.gz drakx-d18b9ba9b861e539e4acbcb6eee830276279cb66.tar.bz2 drakx-d18b9ba9b861e539e4acbcb6eee830276279cb66.tar.xz drakx-d18b9ba9b861e539e4acbcb6eee830276279cb66.zip |
- keep /root
- ensure moving files is an error
- save /root/new_existing_rpms.list in system.loop
- getting list of rpms is no more fatal
- make "cd -" quiet
-rwxr-xr-x | rescue-Flash/scripts/upgrade | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/rescue-Flash/scripts/upgrade b/rescue-Flash/scripts/upgrade index 17fb51b1b..a81263c38 100755 --- a/rescue-Flash/scripts/upgrade +++ b/rescue-Flash/scripts/upgrade @@ -59,24 +59,35 @@ function get_existing_rpms() { return 1 fi - chroot $tmpdir/union rpm -qa > /tmp/existing_rpms.list + chroot $tmpdir/squash rpm -qa | sort > /tmp/previous_rpms.list + if [ $? -ne 0 ]; then + echo "Error getting list of vanilla rpms installed on previous key" + fi + + chroot $tmpdir/union rpm -qa | sort > /tmp/existing_rpms.list if [ $? -ne 0 ]; then echo "Error getting list of rpms installed prior to upgrade" - return 1 fi umount $tmpdir/union > /dev/null 2>&1 umount $tmpdir/squash > /dev/null 2>&1 + mkdir -p $tmpdir/user/root + diff /tmp/previous_rpms.list /tmp/existing_rpms.list | sed -n 's/^> //p' > $tmpdir/user/root/new_existing_rpms.list + return 0 } function move_files() { for i in $*; do - dir=`dirname $i` - [ "$dir" = "." ] || mkdir -p ..keep/$dir - mv $i ..keep/$dir + if [ -e $i ]; then + dir=`dirname $i` + [ "$dir" = "." ] || mkdir -p ..keep/$dir + mv $i ..keep/$dir || { echo "Error moving $i"; return 1; } + fi done + + return 0 } function remove_non_user_nor_config_files() { @@ -95,17 +106,17 @@ function remove_non_user_nor_config_files() { mkdir ..keep - move_files $config_files_network_scripts + move_files $config_files_network_scripts || return 1 rm -rf etc/sysconfig/network-scripts - move_files home $config_files + move_files home root $config_files || return 1 rm -rf * rm -rf .[^.]* mv ..keep/* . rmdir ..keep - cd - + cd - > /dev/null return 0 } |