diff options
author | Mageia SVN-Git Migration <svn-git-migration@mageia.org> | 2011-02-06 22:37:08 +0000 |
---|---|---|
committer | Mageia SVN-Git Migration <svn-git-migration@mageia.org> | 2011-02-06 22:37:08 +0000 |
commit | fd8bbba2f02b8bccd69e67c326fd320c0827941d (patch) | |
tree | ade69986b2f99e113c95009736399966d4a3d511 /rescue/Flash/scripts/upgrade | |
parent | 368f416649ed34557702a946ec8c0cec2fd45294 (diff) | |
download | drakx-fd8bbba2f02b8bccd69e67c326fd320c0827941d.tar drakx-fd8bbba2f02b8bccd69e67c326fd320c0827941d.tar.gz drakx-fd8bbba2f02b8bccd69e67c326fd320c0827941d.tar.bz2 drakx-fd8bbba2f02b8bccd69e67c326fd320c0827941d.tar.xz drakx-fd8bbba2f02b8bccd69e67c326fd320c0827941d.zip |
Synthesized commit during git-svn import combining previous Mandriva history with Mageia.
This commit consitsts of the following subversion commits:
------------------------------------------------------------------------
r431 | dmorgan | 2011-02-06 01:58:02 +0000 (Sun, 06 Feb 2011) | 1 line
Add drakx structure on the SVN
------------------------------------------------------------------------
r432 | dmorgan | 2011-02-06 01:59:38 +0000 (Sun, 06 Feb 2011) | 1 line
Import cleaned advertising
------------------------------------------------------------------------
r446 | dmorgan | 2011-02-06 22:37:08 +0000 (Sun, 06 Feb 2011) | 1 line
Import Clean perl-install
------------------------------------------------------------------------
r448 | dmorgan | 2011-02-06 23:02:36 +0000 (Sun, 06 Feb 2011) | 1 line
Add cleaned files
------------------------------------------------------------------------
r449 | dmorgan | 2011-02-06 23:03:52 +0000 (Sun, 06 Feb 2011) | 1 line
Import cleaned kernel
------------------------------------------------------------------------
r450 | dmorgan | 2011-02-06 23:23:30 +0000 (Sun, 06 Feb 2011) | 1 line
Import cleaned tools
------------------------------------------------------------------------
r451 | dmorgan | 2011-02-07 00:01:56 +0000 (Mon, 07 Feb 2011) | 1 line
Import stage1
------------------------------------------------------------------------
r473 | dmorgan | 2011-02-07 11:20:50 +0000 (Mon, 07 Feb 2011) | 1 line
Import images
------------------------------------------------------------------------
r497 | ennael | 2011-02-09 21:02:06 +0000 (Wed, 09 Feb 2011) | 2 lines
readd missing file
------------------------------------------------------------------------
r502 | pterjan | 2011-02-09 23:30:32 +0000 (Wed, 09 Feb 2011) | 1 line
Import rescue
------------------------------------------------------------------------
r603 | ennael | 2011-02-24 13:32:54 +0000 (Thu, 24 Feb 2011) | 2 lines
import cleaned rescue for Mageia
------------------------------------------------------------------------
r2061 | tv | 2011-10-20 20:32:19 +0100 (Thu, 20 Oct 2011) | 1 line
import (cleaned) doc
------------------------------------------------------------------------
Diffstat (limited to 'rescue/Flash/scripts/upgrade')
-rwxr-xr-x | rescue/Flash/scripts/upgrade | 307 |
1 files changed, 0 insertions, 307 deletions
diff --git a/rescue/Flash/scripts/upgrade b/rescue/Flash/scripts/upgrade deleted file mode 100755 index 87510b421..000000000 --- a/rescue/Flash/scripts/upgrade +++ /dev/null @@ -1,307 +0,0 @@ -#!/bin/bash - -# import functions library -source rescue_common - -tmpdir="/tmp/flash-rescue-root" -rootdir="$tmpdir/pen" - -media_dir="/tmp/media" -upgrade_dir="$media_dir/upgrade" - - -config_files_network_scripts="etc/sysconfig/network-scripts/ifcfg-* \ - etc/sysconfig/network-scripts/cellular.d \ - etc/sysconfig/network-scripts/vpn.d \ - etc/sysconfig/network-scripts/wireless.d" - -config_files_users="etc/passwd etc/shadow etc/group etc/gshadow" -config_files_time="etc/localtime etc/ntp etc/ntp.conf" -config_files="etc/sysconfig/* $config_files_users $config_files_time \ - etc/wpa_supplicant.conf etc/shorewall etc/kde \ - etc/udev/rules.d/61-*_config.rules" - -config_files_to_remove="etc/sysconfig/harddrake2" - -mozilla_files=".apps/FirefoxPortable/Data/profile/*.sqlite \ - .apps/FirefoxPortable/Data/profile/prefs.js \ - .apps/FirefoxPortable/Data/profile/key3.db \ - .apps/FirefoxPortable/Data/profile/signons*.txt \ - .apps/FirefoxPortable/Data/profile/Bookmarks.html \ - .apps/FirefoxPortable/Data/profile/Cookies.txt \ - .apps/FirefoxPortable/Data/profile/Downloads.rdf \ - .apps/FirefoxPortable/Data/profile/History.dat \ - .apps/ThunderbirdPortable/Data/profile/prefs.js \ - .apps/ThunderbirdPortable/Data/profile/abook.mab \ - .apps/ThunderbirdPortable/Data/profile/Mail \ - .apps/ThunderbirdPortable/Data/profile/ImapMail" - -function prepare() { - - echo "Mounting Mandriva Flash key..." - echo - - modprobe unionfs > /dev/null 2>&1 - modprobe sqlzma > /dev/null 2>&1 - modprobe squashfs-lzma > /dev/null 2>&1 - modprobe squashfs > /dev/null 2>&1 - modprobe loop > /dev/null 2>&1 - - mkdir -p $rootdir - mkdir -p $tmpdir/squash - mkdir -p $tmpdir/user - mkdir -p $tmpdir/union - - if ! mount_usbroot $rootdir; then - return 1 - fi - - set_sfs_loop $rootdir - - mount -t ext2 -o loop $sys_loop $tmpdir/user > /dev/null 2>&1 - if [ $? -ne 0 ]; then - echo "Error mounting system.loop" - return 1 - fi - - return 0 -} - -function get_existing_rpms() { - - echo "Getting list of installed packages..." - echo - - mount -t squashfs -o loop $sfs_loop $tmpdir/squash > /dev/null 2>&1 - if [ $? -ne 0 ]; then - echo "Error mounting distrib.sqfs" - return 1 - fi - - mount -t unionfs -o dirs=$tmpdir/user=rw:$tmpdir/squash=ro \ - none $tmpdir/union - if [ $? -ne 0 ]; then - echo "Error creating union of distrib.sqfs and system.loop" - return 1 - fi - - 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" - fi - - umount $tmpdir/union > /dev/null 2>&1 - lumount $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 - 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() { - - echo "Filtering system configuration files and user accounts..." - echo - - cd $tmpdir/user - - rm -rf $config_files_to_remove - - if [ -e ..keep ]; then - mv ..keep ..keep.bak - fi - if [ -e ..keep ]; then - echo "remove_non_user_nor_config_files can't work with existing temp dir" - return 1 - fi - - mkdir ..keep - - move_files $config_files_network_scripts || return 1 - rm -rf etc/sysconfig/network-scripts - - move_files home root $config_files || return 1 - rm -rf * - rm -rf .[^.]* - - mv ..keep/* . - rmdir ..keep - - cd - > /dev/null - - return 0 -} - -function backup_portable_apps_user_data() { - echo "Backing up Firefox and Thunderbird user data..." - echo - - cd $rootdir - - if [ -e ..keep ]; then - mv ..keep ..keep.bak - fi - - if [ -e ..keep ]; then - echo "remove_non_user_nor_config_files can't work with existing temp dir" - return 1 - fi - - mkdir ..keep - - move_files $mozilla_files - - cd - > /dev/null - - return 0 -} - -function restore_portable_apps_user_data() { - echo "Restoring Firefox and Thunderbird user data..." - echo - - cd $rootdir/..keep || return 1 - tar c -C $rootdir/..keep . | tar x -C $rootdir - rm -rf $rootdir/..keep - cd - > /dev/null - - return 0 -} - -function copy_new_version() { - - echo "Copying new Mandriva Flash system..." - - rm -rf $rootdir$boot_rel - rm -f $rootdir$loopbacks_rel/.*sqf - rm -f $rootdir$loopbacks_rel/.*sqfs - [ -d "$modules_dir" ] && rm -rf $modules_dir - - tar c -C $upgrade_dir . | pv -s `du -sb $upgrade_dir | cut -f 1` | tar x -C $rootdir - echo - - chmod -R u+w $rootdir - chmod -R u-w $rootdir$boot_rel $rootdir$loopbacks_rel - - new_label=$(source_version_variables "2.05"; echo $label) - MTOOLS_SKIP_CHECK=1 mlabel -i $usbroot_device ::$new_label - - return 0 -} - -function merge_config_files() { - - echo "Merging user and group accounts in new system..." - echo - - mount -t squashfs -o loop $sfs_loop $tmpdir/squash > /dev/null 2>&1 - if [ $? -ne 0 ]; then - echo "Error mounting distrib.sqfs" - return 1 - fi - - upgrade.merge-users $tmpdir/user/etc $tmpdir/squash/etc - - mount -t unionfs -o dirs=$tmpdir/user=rw:$tmpdir/squash=ro \ - none $tmpdir/union - if [ $? -ne 0 ]; then - echo "Error creating union of distrib.sqfs and system.loop" - return 1 - fi - - #- reapply lang configuration, mostly to rewrite kdeglobals - chroot $tmpdir/union perl -I/usr/lib/libDrakX -Mlang -e "lang::write(lang::read())" &>/dev/null - - #- remove KDE sessions file so that previous compiz usage does not break session - rm -f $tmpdir/union/home/*/.kde/share/config/ksmserverrc &>/dev/null - - #- remove KDE autostart files that should have been migrated by startkde... - rm -f $tmpdir/union/home/*/.kde/Autostart/{alignment-icons,openkmenu}.desktop &>/dev/null - - return 0 -} - -function doit() { - - if [ -d $tmpdir/user/var/lib/rpm/Packages ]; then - get_existing_rpms || return 1 - fi - - remove_non_user_nor_config_files || return 1 - - backup_portable_apps_user_data || return 1 - - copy_new_version || return 1 - - restore_portable_apps_user_data || return 1 - - merge_config_files || return 1 - - return 0 -} - -function cleanup() { - cd / - - umount $tmpdir/union > /dev/null 2>&1 - lumount $tmpdir/user > /dev/null 2>&1 - lumount $tmpdir/squash > /dev/null 2>&1 - umount $rootdir > /dev/null 2>&1 - - rmdir $tmpdir/union $tmpdir/user $tmpdir/squash 2> /dev/null - rmdir $rootdir $tmpdir 2> /dev/null -} - -clear -trap cleanup SIGINT - -version="" -if ! insert_pendrive; then - exit 1 -fi - -#- works only when upgrading versions with the same layout -sys_loop="$rootdir$loopbacks_rel/system.loop" -sfs_loop= # - -modules_dir="$rootdir$loopbacks_rel/modules" - -echo - -if ! prepare; then - cleanup - exit 1 -fi - -if ! doit; then - cleanup - exit 1 -fi - -echo "Please wait, finishing copy to key..." -echo - -cleanup - -echo "Congratulations! Your Mandriva Flash system is now upgraded." -echo - -exit 0 |