Browse Source

Download first

Jakob Borg 10 years ago
parent
commit
aedb5f8a0d
2 changed files with 47 additions and 48 deletions
  1. 15 16
      README.md
  2. 32 32
      platform-upgrade

+ 15 - 16
README.md

@@ -11,8 +11,6 @@ Installation
 [root@acro ~]# chmod 755 /opt/local/bin/platform-upgrade
 [root@acro ~]# chmod 755 /opt/local/bin/platform-upgrade
 ```
 ```
 
 
-Optionally edit the script to select the desired mirror/download site at the top.
-
 Usage
 Usage
 -----
 -----
 
 
@@ -24,37 +22,39 @@ correctly from the USB stick.
 
 
 ```
 ```
 [root@acro ~]# platform-upgrade
 [root@acro ~]# platform-upgrade
-Checking current boot device... detected /dev/dsk/c0t0d0p1, mounted, OK
-Downloading latest platform... OK
+Downloading latest platform (platform-20150306T202346Z.tgz)... OK
 Verifying checksum... OK
 Verifying checksum... OK
 Extracting latest platform... OK
 Extracting latest platform... OK
+Marking release version... OK
+Checking current boot device... detected c0t0d0, mounted, OK
 Updating platform on boot device... OK
 Updating platform on boot device... OK
-Remounting boot device...  OK
+Remounting boot device... OK
 Verifying kernel checksum on boot device... OK
 Verifying kernel checksum on boot device... OK
 Verifying boot_archive checksum on boot device... OK
 Verifying boot_archive checksum on boot device... OK
 Activating new platform on /dev/dsk/c0t0d0p1... OK
 Activating new platform on /dev/dsk/c0t0d0p1... OK
 
 
 Boot device upgraded. To do:
 Boot device upgraded. To do:
 
 
- 1) Sanity check the contents of /tmp/tmp.Tsas6L/usb
+ 1) Sanity check the contents of /tmp/tmp.I8aw9L/usb
  2) umount /dev/dsk/c0t0d0p1
  2) umount /dev/dsk/c0t0d0p1
  3) reboot
  3) reboot
-[root@acro ~]#
+[root@acro ~]# 
 ```
 ```
 
 
 Once the upgrade is done, verify that the contents of the USB stick looks sane,
 Once the upgrade is done, verify that the contents of the USB stick looks sane,
 unmount it and reboot to the new platform.
 unmount it and reboot to the new platform.
 
 
 ```
 ```
-[root@acro ~]# ls -l /tmp/tmp.KCaawL/usb
+[root@acro ~]# ls -l /tmp/tmp.I8aw9L/usb
 total 24
 total 24
 drwxrwxrwx   1 root     root        4096 Jan  3  2011 boot
 drwxrwxrwx   1 root     root        4096 Jan  3  2011 boot
-drwxrwxrwx   1 root     root        4096 Dec 28 16:03 platform
-drwxrwxrwx   1 root     root        4096 Dec 28 15:24 platform.old
-[root@acro ~]# ls -l /tmp/tmp.KCaawL/usb/platform
-total 9
-drwxrwxrwx   1 root     root        4096 Dec 28 16:03 i86pc
--rwxrwxrwx   1 root     root          17 Dec 28 02:40 root.password
+drwxrwxrwx   1 root     root        4096 Mar 13 07:33 old
+drwxrwxrwx   1 root     root        4096 Mar 13 07:29 platform
+[root@acro ~]# ls -l /tmp/tmp.I8aw9L/usb/platform/
+total 10
+drwxrwxrwx   1 root     root        4096 Mar 13 07:29 i86pc
+-rwxrwxrwx   1 root     root          17 Mar  6 23:36 root.password
+-rwxrwxrwx   1 root     root          17 Mar 13 07:29 version
 [root@acro ~]# umount /dev/dsk/c0t0d0p1
 [root@acro ~]# umount /dev/dsk/c0t0d0p1
 [root@acro ~]# reboot
 [root@acro ~]# reboot
 ```
 ```
@@ -65,8 +65,7 @@ command line:
 
 
 ```
 ```
 [root@acro ~]# platform-upgrade /dev/dsk/c1t0d0p1
 [root@acro ~]# platform-upgrade /dev/dsk/c1t0d0p1
-Checking current boot device... using /dev/dsk/c1t0d0p1, mounted, OK
-Downloading latest platform...
+Downloading latest platform (platform-20150306T202346Z.tgz)...
 ```
 ```
 
 
 License
 License

+ 32 - 32
platform-upgrade

@@ -11,38 +11,6 @@ md5sums_url="$host$latest_path/md5sums.txt"
 tmp=$(mktemp -d)
 tmp=$(mktemp -d)
 cd "$tmp" || exit -1
 cd "$tmp" || exit -1
 
 
-echo -n "Checking current boot device..."
-if [[ -z $1 ]] ; then
-        removables=($(disklist -r))
-        echo -n " detected ${removables[@]}"
-        if [[ ${#removables[@]} -gt 1 ]]; then
-                  echo
-                  echo "Error: more than one removable device detected."
-		  echo "Specify correct device on the command line."
-                  exit -1
-        fi
-	usb="/dev/dsk/${removables[0]}p1"
-else
-        usb="$1"
-        echo -n " using $usb"
-fi
-
-umount "$usb" 2>/dev/null
-mkdir usb
-if ! mount -F pcfs -o foldcase "$usb" "$tmp/usb" ; then
-        echo ", mount failed"
-        exit -1
-else
-        echo -n ", mounted"
-fi
-
-if [[ ! -d usb/platform ]] ; then
-        echo ", missing platform dir"
-        exit -1
-else
-        echo ", OK"
-fi
-
 echo -n "Downloading latest platform ($platform_file)..."
 echo -n "Downloading latest platform ($platform_file)..."
 if ! curl -sk -o "$platform_file" "$platform_url" ; then
 if ! curl -sk -o "$platform_file" "$platform_url" ; then
         echo " failed"
         echo " failed"
@@ -79,6 +47,38 @@ else
         echo " OK"
         echo " OK"
 fi
 fi
 
 
+echo -n "Checking current boot device..."
+if [[ -z $1 ]] ; then
+        removables=($(disklist -r))
+        echo -n " detected ${removables[@]}"
+        if [[ ${#removables[@]} -gt 1 ]]; then
+                  echo
+                  echo "Error: more than one removable device detected."
+                  echo "Specify correct device on the command line."
+                  exit -1
+        fi
+        usb="/dev/dsk/${removables[0]}p1"
+else
+        usb="$1"
+        echo -n " using $usb"
+fi
+
+umount "$usb" 2>/dev/null
+mkdir usb
+if ! mount -F pcfs -o foldcase "$usb" "$tmp/usb" ; then
+        echo ", mount failed"
+        exit -1
+else
+        echo -n ", mounted"
+fi
+
+if [[ ! -d usb/platform ]] ; then
+        echo ", missing platform dir"
+        exit -1
+else
+        echo ", OK"
+fi
+
 echo -n "Updating platform on boot device..."
 echo -n "Updating platform on boot device..."
 if ! rsync -a "$platform_dir/" usb/platform.new/ ; then
 if ! rsync -a "$platform_dir/" usb/platform.new/ ; then
         echo " failed"
         echo " failed"