Changeset 13709 in hybrid for branches


Ignore:
Timestamp:
Jan 17, 2017, 12:31:32 AM (8 years ago)
Author:
rick
Message:

Update support quircks based on releases.

Note: this should technically be based of the WL-version deployed, how-ever
since we never made a stable versioning structure, we end up hacking around
with release versions.

Script largely untested, needs some more images to verify.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/releng-11/nanobsd/tools/image

    r13683 r13709  
    5353  # Release update cycle depends on the release we are coming from
    5454  echo "# Host has FreeBSD Release: $release"
    55   if echo $release | grep -q '^[1234567]\.*-RELEASE'; then
     55  updatecmd="/tmp/update$$"
     56  cat >> $updatecmd <<'EOF'
     57#
     58# Pre-cleaning of /cfg
     59#
     60mount -wo noatime /cfg || exit 1
     61find /cfg -type f | grep -v -e '^/cfg/\(pf.hybrid.conf.local\|resolv.conf\|motd\|rc.conf.local\)$' \
     62        -e '^/cfg/local/\(ntp.drift\|dhcpd.conf\|dnsmasq.conf\|unbound.wleiden.conf\|wleiden.yaml\)$' \
     63        -e '^/cfg/ssh/ssh_host_*' \
     64        -e '^/cfg/ssh/authorized_keys$' \
     65        | xargs rm -v || exit 1
     66umount /cfg || exit 1
     67
     68#
     69# Release specific update
     70#
     71EOF
     72  if echo $release | grep -q -e '^9\.[0-9]-RELEASE[-$]'; then
     73    cat >> $updatecmd <<'EOF'
     74tunefs -L WLIMGs3 /dev/ada0s3 || exit 1
     75echo /tools/update || exit 1
     76EOF
     77  elif echo $release | grep -q -e '^11\.[0-9]-RELEASE[-$]'; then
     78    cat >> $updatecmd <<'EOF'
     79echo /tools/update || exit 1
     80EOF
     81  else
    5682    p_err "$release not supported for upgrade"
    5783    exit 1
    58   elif echo $release | grep -q '^8\.*-RELEASE'; then
    59     # Hack to make sure we update the fstab the right way when converting from
    60     # 8.X-RELEASE to 9.X-RELEASE. ad0 naming changed to ada0, secondly an
    61     # specific update script had to be called.
    62     command="/tmp/update$$"
    63     cat > $command <<'EOF'
    64 # Write new image
    65 echo "FreeBSD Release : `uname -r`"
    66 echo "Active Partition: `df -H / | tail -1`"
    67 if [ "`uname -r`" = "9.0-RELEASE" ]; then
    68   echo "Error not valid update cycle!"
    69   exit 1
    70 else
    71   if df / | grep -q '1a ' ; then
    72     echo  "New Partition   : /dev/ad0s2a"
    73     echo /tools/updatep2
    74 
    75     # Quirck to fix partitions
    76     # mount -uwo noatime /dev/ad0s2a
    77     # sed -i "" "s/ada0s1/ada0s2/" /mnt/conf/base/etc/fstab /mnt/etc/fstab
    78     # umount
    79   else
    80     echo  "New Partition   : /dev/ad0s1a"
    81     echo /tools/updatep1
    82   fi
    83 fi
    84 EOF
    85     cat $command | ssh $host "cat > $command" || exit 1
    86     cat $img | ssh $host "sh $command" || exit 1
    87   else
    88     cat $img | ssh $host /tools/update || exit 1
    89   fi
     84  fi
     85
     86  cat $updatecmd | ssh $host "cat > $updatecmd" || exit 1
     87  cat $img | ssh $host "sh -x $updatecmd" || exit 1
    9088
    9189  if $do_reboot; then
Note: See TracChangeset for help on using the changeset viewer.