github.com/dahs81/otto@v0.2.1-0.20160126165905-6400716cf085/images/scripts/freebsd/update.sh (about)

     1  #!/bin/sh -eux
     2  
     3  # Unset these as if they're empty it'll break freebsd-update
     4  [ -z "$no_proxy" ] && unset no_proxy
     5  [ -z "$http_proxy" ] && unset http_proxy
     6  [ -z "$https_proxy" ] && unset https_proxy
     7  
     8  major_version="`uname -r | awk -F. '{print $1}'`";
     9  
    10  if [ "$major_version" -lt 10 ]; then
    11    # Allow freebsd-update to run fetch without stdin attached to a terminal
    12    sed 's/\[ ! -t 0 \]/false/' /usr/sbin/freebsd-update >/tmp/freebsd-update;
    13    chmod +x /tmp/freebsd-update;
    14  
    15    freebsd_update="/tmp/freebsd-update";
    16  else
    17    freebsd_update="/usr/sbin/freebsd-update --not-running-from-cron";
    18  fi
    19  
    20  # Update FreeBSD
    21  # NOTE: this will fail if there aren't any patches available for the release yet
    22  env PAGER=/bin/cat $freebsd_update fetch;
    23  env PAGER=/bin/cat $freebsd_update install;
    24  
    25  # Always use pkgng - pkg_add is EOL as of 1 September 2014
    26  env ASSUME_ALWAYS_YES=true pkg bootstrap;
    27  if [ "$major_version" -lt 10 ]; then
    28      echo "WITH_PKGNG=yes" >>/etc/make.conf;
    29  fi
    30  
    31  pkg update;