Changeset 11050 in hybrid for branches/releng-9.0/nanobsd/tools
- Timestamp:
- May 31, 2012, 1:19:16 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/releng-9.0/nanobsd/tools/image
r11049 r11050 40 40 41 41 prompt_timeout=5 42 p_warn "Going to DEPLOY $img to $host: (8.X-RELEASE and 9.X-RELEASE) to 9.X RELEASE" 42 p_warn "Going to DEPLOY $img to $host: (8.X-RELEASE and 9.X-RELEASE) to 9.X-RELEASE" 43 p_warn "You will need to type the root password at least twice, consider using a key" 43 44 $do_reboot && p_warn "AND will REBOOT the $host" 44 p_warn "Please do mind to use your ssh key else you be required to type the root"45 p_warn "password AT MOST 5 times"46 45 47 46 48 47 p_warn "Press CTRL+C in $prompt_timeout seconds to CANCEL" 49 sleep $prompt_timeout 50 51 # Details and alive checkings 52 release=`ssh $host mount | grep 'ada0' && echo "9.0-RELEASE" || echo "PRE-9.0-RELEASE"` || exit 1 53 if [ $release = "9.0-RELEASE" ]; then 54 cat $img | ssh $host sh -x /tools/update || exit 1 48 # sleep $prompt_timeout 49 50 echo "# Trying to connect to $host" 51 release=`ssh $host 'uname -r'` || exit 1 52 echo "# Host has FreeBSD Release: $release, starting update" 53 if [ "$release" = "9.0-RELEASE" ]; then 54 cat $img | ssh $host /tools/update || exit 1 55 55 else 56 56 # Hack to make sure we update the fstab the right way when converting from 57 # 8.X-RELEASE to 9.X-RELEASE. ad0 naming changed to ada0. 58 P=`ssh $HOST df / | grep '1a ' && echo "p2" || echo "p1"` || exit 1 59 echo "# Updating partition $P" 60 61 cat $img | ssh $host sh -x /tools/update$P || exit 1 62 63 if [ "$P" = "p2" ]; then 64 cat <<EOF | ssh $HOST sh -x || exit 1 65 mount -uwo noatime /dev/ad0s2a 66 sed -i "" "s/ada0s1/ada0s2/" /mnt/conf/base/etc/fstab /mnt/etc/fstab 67 umount 57 # 8.X-RELEASE to 9.X-RELEASE. ad0 naming changed to ada0, secondly an 58 # specific update script had to be called. 59 command="/tmp/update$$" 60 cat > $command <<'EOF' 61 # Write new image 62 echo "FreeBSD Release : `uname -r`" 63 echo "Active Partition: `df -H / | tail -1`" 64 if [ "`uname -r`" = "9.0-RELEASE" ]; then 65 echo "Error not valid update cycle!" 66 exit 1 67 else 68 if df / | grep -q '1a ' ; then 69 echo "New Partition : /dev/ad0s2a" 70 echo /tools/updatep2 71 72 # Quirck to fix partitions 73 # mount -uwo noatime /dev/ad0s2a 74 # sed -i "" "s/ada0s1/ada0s2/" /mnt/conf/base/etc/fstab /mnt/etc/fstab 75 # umount 76 else 77 echo "New Partition : /dev/ad0s1a" 78 echo /tools/updatep1 79 fi 80 fi 68 81 EOF 69 fi 82 cat $command | ssh $host "cat > $command" || exit 1 83 cat $img | ssh $host "sh $command" || exit 1 70 84 fi 71 85 72 86 if $do_reboot; then 73 ssh $host reboot 87 echo "# Reboot requested, press CTRL+C in $prompt_timeout seconds to cancel" 88 sleep $prompt_timeout 89 ssh $host reboot || exit 1 74 90 fi 75 91 }
Note:
See TracChangeset
for help on using the changeset viewer.