diff --git a/openup b/openup index be3410b..d9f0b27 100755 --- a/openup +++ b/openup @@ -17,7 +17,7 @@ # Author: Antoine Jacoutot # ChangeLog -# https://gitlab.com/mtier/openup +# http://cgit.mtier.org:8000/openup/log/ ######################################################################## ### DO NOT EDIT THIS FILE!!! ### @@ -54,12 +54,13 @@ EXCLUDE_PKG="" usage() { echo - echo "Usage: ${0##*/} [-K][-S|c]" >&2 + echo "Usage: ${0##*/} [-K][-Se|c]" >&2 echo echo "Options:" echo " -K do not check for kernel binpatches (when running non GENERIC)" echo " -S ignore binpatch/package signatures" echo " -c check/cron mode, report only (cannot be used with -S)" + echo " -e echo the PKG_PATH that ${0##*/} would use" echo exit 1 } @@ -87,6 +88,11 @@ get_key() { install -m0644 ${_TMPKEY} /etc/signify/mtier-${_REL_INT}-pkg.pub || bye_bye } +show_env() { + echo PKG_PATH=${PKG_PATH_UPDATE_LTS}:${PKG_PATH_UPDATE}:${PKG_PATH_MAIN} + exit 0 +} + check_openupd() { local _U @@ -216,11 +222,6 @@ do_i_need_to_reboot() { trap "bye_bye" 1 2 3 13 15 -if [ "$(id -u)" -ne 0 ]; then - pr_err "Need root privileges to run this script" - usage -fi - if [ -f /etc/openup.conf ]; then if [ $(stat -f "%SMp%SLp" /etc/openup.conf) != "------" ]; then pr_err "Unsecure permissions on /etc/openup.conf; please run:" @@ -233,8 +234,8 @@ fi # regex taken from fw_update(1) set -A _REL -- $(sysctl -n kern.version | sed 's/^OpenBSD \([0-9]\.[0-9]\)\([^ ]*\).*/\1 \2/;q') _REL_INT="$(echo ${_REL[0]} | tr -d '.')" -_OPENUP_MINREL=56 -_OPENUP_VERSION=21 +_OPENUP_MINREL=58 +_OPENUP_VERSION=23 if [ -n "${_REL[1]}" -a "${_REL[1]}" != "-stable" ]; then _badrel=1; fi if [ "${_REL_INT}" -lt "${_OPENUP_MINREL}" ]; then _badrel=1; fi if [ -n "${_badrel}" ]; then @@ -247,17 +248,25 @@ if [ "${_REL_INT}" -ge 57 ]; then FETCH="ftp -MVo" fi -while getopts 'KSc' arg; do +while getopts 'KSce' arg; do case ${arg} in K) nokrn=1 ;; S) nosig=1; pkgopt="${pkgopt} -Dnosig -Dunsigned" ;; c) checkrun=1 ;; + e) showenv=1 ;; *) usage ;; esac done [ $# = $(($OPTIND-1)) ] || usage -[ -n "${checkrun}" -a -n "${nosig}" ] && usage +[ -n "${showenv}" ] && show_env + +if [ "$(id -u)" -ne 0 ]; then + pr_err "Need root privileges to run this script" + usage +fi + +[ -n "${checkrun}" -a -n "${nosig}" -a -n "${showenv}" ] && usage _ARCH=$(arch -s) _PID="/var/run/${0##*/}.pid" @@ -296,4 +305,4 @@ fi do_i_need_to_reboot rm -rf ${_TMPDIR} -rm ${_PID} +rm ${_PID} \ No newline at end of file