1
0
Fork 0
forked from mirrors/openup

Merge back changes from local GitLab:

- set minrel to 5.8
- add support for echoing the PKG_PATH
This commit is contained in:
Jasper Lievisse Adriaanse 2016-05-03 16:50:27 +02:00
commit 68bb007436

31
openup
View file

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