diff options
author | James Meyer <james.meyer@operamail.com> | 2008-12-14 03:17:14 (GMT) |
---|---|---|
committer | James Meyer <james.meyer@operamail.com> | 2008-12-14 03:17:14 (GMT) |
commit | 15f49f7b2cb3016c36b981641703b7a13951f28d (patch) | |
tree | 647f91b3b5d461c6ee1334b88af2554533a810b2 /abs/core-testing/LinHES-config/install_proxy.sh | |
parent | 8c3ef1f72923acce99cb632e663d6f8cef751c62 (diff) | |
download | linhes_pkgbuild-15f49f7b2cb3016c36b981641703b7a13951f28d.zip linhes_pkgbuild-15f49f7b2cb3016c36b981641703b7a13951f28d.tar.gz linhes_pkgbuild-15f49f7b2cb3016c36b981641703b7a13951f28d.tar.bz2 |
REF fs#50
Add hybrid of install/upgrade. This is an install without formating /myth or xda3
To use this feature append clean_upgrade to the kernel boot parm & select upgrade for the install type.The upgrade will error out with "can't find old settings", continue past this prompt and a fresh install without formating /myth will occur.
Diffstat (limited to 'abs/core-testing/LinHES-config/install_proxy.sh')
-rwxr-xr-x | abs/core-testing/LinHES-config/install_proxy.sh | 86 |
1 files changed, 47 insertions, 39 deletions
diff --git a/abs/core-testing/LinHES-config/install_proxy.sh b/abs/core-testing/LinHES-config/install_proxy.sh index 195d7af..92b90dc 100755 --- a/abs/core-testing/LinHES-config/install_proxy.sh +++ b/abs/core-testing/LinHES-config/install_proxy.sh @@ -67,7 +67,6 @@ function upgrade_mount_search { umount $mountpoint/myth mount $MYTH_P $mountpoint/myth return 0 - } @@ -195,7 +194,7 @@ function upgrade () { $run mount_it $disk startsize=`statgrab -M disk.|grep $disk.write_bytes|cut -d= -f 2|tr -d " "` echo "STARTSIZE=$startsize">/tmp/.startsize.io - echo "Creating $hostname" > /tmp/.install_state + echo "Upgrading $hostname" > /tmp/.install_state sleep 1 cp -rf /tmp/etc /new_boot/etc.old cp -rf /tmp/oss /new_boot/var/lib/oss.old @@ -210,7 +209,7 @@ function upgrade () { cp -fp /new_boot/etc.old/ssh/*.pub /new_boot/etc/ssh/ cp -fp /new_boot/etc.old/ssh/*.key /new_boot/etc/ssh/ cp -fp /new_boot/etc.old/ssh/*key /new_boot/etc/ssh/ - + cp -fp /new_boot/etc.old/mdadm.conf /new_boot/etc/ if [ ! -f /tmp/etc/KnoppMyth-version ] then #passwd/shadow/group @@ -225,16 +224,14 @@ function upgrade () { fi $run fstab_fix_it $disk UPGRADE - #this is here to copy in the systemconfig file as soon as possible. + #this is here to copy in the systemconfig file as soon as possible. cp -f /etc/systemconfig "$mountpoint"/etc echo "Writing boot sector" > /tmp/.install_state progress 99 sleep 1 $run grub_it $disk - - - echo "Configuring system" > /tmp/.install_state + echo "Configuring system" > /tmp/.install_state progress sleep 1 cp /etc/mtab "$mountpoint"/etc/mtab @@ -244,8 +241,9 @@ function upgrade () { then upgrade_mount_search fi - - if [ -f /tmp/etc/KnoppMyth-version ] + echo $CMDLINE | grep -q clean_upgrade + status=$? + if [ -f /tmp/etc/KnoppMyth-version -o $status = 0 ] then #run save syssettings to save settings, then copy to new mountpoint $MV_ROOT/bin/restore_default_settings.sh -c save -t syssettings -h $MVHOSTNAME -d localhost @@ -255,9 +253,14 @@ function upgrade () { chown root:mythtv "$mountpoint"/etc/systemconfig chown -R mythtv:mythtv ${mountpoint}$SE chmod -R 775 ${mountpoint}$SE - touch $mountpoint/home/mythtv/.kmupgrade && chmod 777 $mountpoint/home/mythtv/.kmupgrade + if [ ! $status = 0 ] + then + touch $mountpoint/home/mythtv/.kmupgrade && chmod 777 $mountpoint/home/mythtv/.kmupgrade + fi fi + + cp -f $MV_ROOT/bin/*.sh "$mountpoint"$MV_ROOT/bin/ chmod -R 755 ${mountpoint}/root chown root:mythtv "$mountpoint"/etc/systemconfig @@ -270,29 +273,41 @@ function upgrade () { #wrap this in a network check_network, no need to update the db if the import worked. ##### do I need to start mysql? /etc/rc.d/mysqld stop - if [ -f /new_boot/myth/backup/mythconverg.sql.gz ] + echo $CMDLINE | grep -q clean_upgrade + status=$? + if [ $status = 0 ] then + #new db as part of clean upgrade echo "--------------------------------" - echo "Restoring database" - echo "--------------------------------" - chroot "$mountpoint" "$MV_ROOT/bin/restore_km_db_chroot.sh" > /tmp/chrootdb_km.out - else - echo "--------------------------------" - echo "Couldn't find backup file, installing new database" + echo "clean upgrade installing new database" echo "--------------------------------" - touch /tmp/.upgrade_db_failed chroot "$mountpoint" "$MV_ROOT/bin/install_db_chroot.sh" > /tmp/chrootdb.out + else + #proceed as normal + if [ -f /new_boot/myth/backup/mythconverg.sql.gz ] + then + echo "--------------------------------" + echo "Restoring database" + echo "--------------------------------" + chroot "$mountpoint" "$MV_ROOT/bin/restore_km_db_chroot.sh" > /tmp/chrootdb_km.out + else + echo "--------------------------------" + echo "Couldn't find backup file, installing new database" + echo "--------------------------------" + touch /tmp/.upgrade_db_failed + chroot "$mountpoint" "$MV_ROOT/bin/install_db_chroot.sh" > /tmp/chrootdb.out + fi fi if [ -f /tmp/etc/KnoppMyth-version ] then - chroot "$mountpoint" $MV_ROOT/bin/restore_default_settings.sh -c restore -t hostsettings + chroot "$mountpoint" $MV_ROOT/bin/restore_default_settings.sh -c restore -t hostsettings #change permissions of /myth (only needed on km->linhes) - chown -R mythtv:mythtv $mountpoint/myth - chown -R root:root $mountpoint/myth/backup + chown -R mythtv:mythtv $mountpoint/myth + chown -R root:root $mountpoint/myth/backup else - chroot "$mountpoint" $MV_ROOT/bin/restore_default_settings.sh -c restore -t syssettings + chroot "$mountpoint" $MV_ROOT/bin/restore_default_settings.sh -c restore -t syssettings fi # #Run second time @@ -300,8 +315,6 @@ function upgrade () { chroot "$mountpoint" $MV_ROOT/bin/systemconfig.sh advanced,this_is_install apply_new_auth - - umount "$mountpoint/dev" umount "$mountpoint/proc" @@ -364,10 +377,14 @@ echo "-----------------------------------------------------------------------3-- netboot-full_install ;; find_update) + #TRY TO mount first partition of drive #copy /etc/systemconfig to live, import settings into db #umount drive - $run mount_it $disk + echo $CMDLINE | grep -q clean_upgrade + if [ $? = 1 ] + then + $run mount_it $disk if [ -f /new_boot/etc/systemconfig ] then ###########ADD templates @@ -378,10 +395,11 @@ echo "-----------------------------------------------------------------------3-- cp /new_boot/etc/systemconfig /etc/systemconfig cp -rf /new_boot/etc /tmp/etc cp -rf /new_boot/var/lib/oss /tmp/oss - + [ -e /tmp/etc/mdadm.conf ] && cp -rf /tmp/etc/mdadm.conf /etc/ $MV_ROOT/bin/restore_default_settings.sh -c restore -t syssettings -h $MVHOSTNAME -d 127.0.0.1 else cp -rf /new_boot/etc /tmp/etc + [ -e /tmp/etc/mdadm.conf ] && cp -rf /tmp/etc/mdadm.conf /etc/ #now we search for the timezone and try to update TZREGION=`cat /tmp/etc/timezone | cut -d"/" -f1` TZSUB=`cat /tmp/etc/timezone | cut -d"/" -f2 -` @@ -394,20 +412,13 @@ echo "-----------------------------------------------------------------------3-- $run update_db_it HostTimeZoneRegion "$TZREGION" $run update_db_it HostTimeZoneRegion_$TZREGION "$TZSUB" fi - - - fi - - - $run umount_it $disk + fi ;; upgrade_it) - #"$MV_ROOT/bin/install_proxy.sh upgrade_it " + install_drive + " " + rootfs + "&" upgrade - ;; disk_model_it) model="unknown" @@ -420,11 +431,8 @@ echo "-----------------------------------------------------------------------3-- s*) model=`sginfo /dev/$2|grep Product|awk ' { print $2 } '` ;; esac - size=`parted /dev/$2 print |grep Disk|awk ' { print $3 } ' ` - - - echo ""$model" $size " >/tmp/model - + size=`parted /dev/$2 print |grep Disk|awk ' { print $3 } ' ` + echo ""$model" $size " >/tmp/model ;; network_check_it) #Should never return from check_network |