Commit Diff
Diff:
cb5aae9980d41a855a64438f68c1cf99791867c0
482df36b6d050569a9849a7995531448fbc8448f
Commit:
482df36b6d050569a9849a7995531448fbc8448f
Tree:
3aaab193fe3aebc3b9c4136c63652f913aecc143
Author:
Fred. Galusik <f@galusik.fr>
Committer:
Fred. Galusik <f@galusik.fr>
Date:
Sat May 9 15:04:12 2020 UTC
Message:
last fixes hopefully
blob - 28d2553ce56b92da0a16b801cc428dfed3fb0ce1
blob + 3c207bb993712a016fe9acd850926f75fd1a28c7
--- snaps
+++ snaps
@@ -2,7 +2,7 @@
#
########################################################################
#
-# snaps.sh - Check if you can upgrade your OpenBSD OS base to
+# snaps - Check if you can upgrade your OpenBSD OS base to
# last -current snapshot
#
# Copyright (c) 2017-2020, Fred Galusik <f AT galusik.fr>
@@ -51,8 +51,9 @@ true "${MIRROR:=$(grep -v "^#" /etc/installurl)}"
# curl is mandatory
if [ ! "$(which curl 2>/dev/null)" ]; then
echo "WARNING: 'curl' is requested to run this program. Aborting..."
- exit 1
+ exit 1
fi
+CURL=$(whereis curl)
#
ARCH=$(uname -m)
@@ -61,7 +62,7 @@ BASE=/snapshots/${ARCH}/
BASEF=/snapshots/${ARCH}/${SHA}
PKGSF=/snapshots/packages/${ARCH}/${SHA}
-GET='ftp -n -m -C'
+GET='/usr/bin/ftp -n -m -C'
LOGF=/var/log/snaps.log
@@ -72,15 +73,15 @@ LOGF=/var/log/snaps.log
usage() {
echo "${0##*/} ${VERSION}"
- echo "Usage: ${0##*/} [-scaplfuh]"
+ echo "Usage: ${0##*/} [-scalfuph]"
echo ""
echo " -s check \$MIRROR freshness & choose to sysupgrade or not"
- echo " -c check BASE and PACKAGES build date from \$MIRROR"
- echo " -a check BASE and PACKAGES build date from all available https mirrors"
- echo " -p update port tree to -current"
- echo " -l list date and \$MIRROR of the 3 last upgrade with this script"
+ echo " -c check BASE and PACKAGES build dates from \$MIRROR"
+ echo " -a check BASE and PACKAGES build dates from all available mirrors"
+ echo " -l list date and \$MIRROR of the 3 last upgrade using this script"
echo " -f read the online FAQ : Following -current and using snapshots"
echo " -u upgrade snaps to last version"
+ echo " -p update ports tree to -current"
echo " -h print this help and exit"
echo ""
echo "MIRROR is based upon /etc/installurl and set to: ${MIRROR}"
@@ -142,7 +143,7 @@ get_log() {
s_upports() {
echo "Updating Ports tree..."
cd /usr/ports || exit 1
- cvs up -Pd || exit 1
+ /usr/bin/cvs up -Pd || exit 1
echo "New Ports tree fetched!"
}
@@ -155,9 +156,9 @@ s_cur() {
s_when() {
- CURLB="$(curl -sI "${MIRROR}${BASEF}" | grep Last-Modified)"
- CURLP="$(curl -sI "${MIRROR}${PKGSF}" | grep Last-Modified)"
- echo "=== ONLINE BASE AND PACKAGES BUILD DATE ==="
+ CURLB="$(${CURL} -sI "${MIRROR}${BASEF}" | grep Last-Modified)"
+ CURLP="$(${CURL} -sI "${MIRROR}${PKGSF}" | grep Last-Modified)"
+ echo "=== ONLINE BASE AND PACKAGES BUILD DATES ==="
echo "From ${MIRROR}"
echo "Base (${ARCH}) => ${CURLB}"
echo "Packages (${ARCH}) => ${CURLP}"
@@ -178,7 +179,7 @@ s_sysup() {
;;
esac
echo "${NOW} FROM ${MIRROR}${BASE}" >> ${LOGF}
- sysupgrade -s
+ /usr/sbin/sysupgrade -s
}
@@ -196,13 +197,15 @@ read_faq() {
}
all_mirrors() {
+ echo "Checking mirrors..."
HTTPSLIST='https://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/www/httpslist'
- MIRRORLIST=$(curl ${HTTPSLIST} | awk '{print $1}')
+ MIRRORLIST=$(${CURL} ${HTTPSLIST} | awk '{print $1}')
+ echo ""
for _m in ${MIRRORLIST}
do
- CB="$(curl -sI "${_m}${BASEF}" | grep Last-Modified |\
+ CB="$(${CURL} -sI "${_m}${BASEF}" | grep Last-Modified |\
sed 's/Last-Modified: //')"
- CP="$(curl -sI "${_m}${PKGSF}" | grep Last-Modified |\
+ CP="$(${CURL} -sI "${_m}${PKGSF}" | grep Last-Modified |\
sed 's/Last-Modified: //')"
# only print mirror which give an answer
# FIXME try to figure out how to print 1 mirror per line
@@ -237,21 +240,21 @@ case $1 in
-c)
s_when
;;
- -f)
- read_faq
- ;;
-a)
all_mirrors
;;
- -p)
- s_upports
- ;;
-l)
get_log
;;
+ -f)
+ read_faq
+ ;;
-u)
s_upgrade
;;
+ -p)
+ s_upports
+ ;;
-h|*)
usage
exit 1
Frédéric Galusik