~fredg/snaps

9e4512cd77a176899177e695fbfa4a60ed347d72 — Fred. Galusik 2 years ago c5a4674
last fixes
1 files changed, 13 insertions(+), 8 deletions(-)

M snaps
M snaps => snaps +13 -8
@@ 46,7 46,7 @@ set -ue
VERSION=1.3

# choose your MIRROR
true ${MIRROR:=$(grep -v "^#" /etc/installurl)}
true "${MIRROR:=$(grep -v "^#" /etc/installurl)}"

# curl is mandatory
if [ ! "$(which curl 2>/dev/null)" ]; then


@@ 99,7 99,7 @@ s_root() {
}


toupgrade() {
s_toupgrade() {
    REMOTESNAPS='https://framagit.org/fredg/snaps/raw/master/snaps'
    LASTSNAPS=/tmp/snaps
    echo "Checking snaps release..."


@@ 122,7 122,7 @@ toupgrade() {
}


upgrade() {
s_upgrade() {
    SELFPATH=$(dirname "$(readlink -f -- "$0")")
    echo "Downloading last snaps version..."
    $GET -o "${SELFPATH}" "${REMOTESNAPS}"


@@ 182,14 182,14 @@ s_sysup() {
}


read_cur() {
read_faq() {
    FAQ='https://www.openbsd.org/faq/current.html'
    if [ "$(which links 2>/dev/null)" ]; then
        READ='links -dump'
    elif [ "$(which lynx 2>/dev/null)" ]; then
        READ='lynx --dump'
    else
        echo "You need 'links' or 'lynx' to read the online FAQ/CURRENT. Aborting..."
        echo "WARNING: You need 'links' or 'lynx' to read the online FAQ/CURRENT. Aborting..."
        exit 1
    fi
    ${READ} ${FAQ} | less


@@ 220,10 220,15 @@ all_mirrors() {
## Run
##

if [ $# -eq 0 ]; then
    usage
    exit 1
fi

case $1 in
    -s)
        s_root
        toupgrade
        s_toupgrade
        s_cur
        echo ""
        s_when


@@ 233,7 238,7 @@ case $1 in
        s_when
        ;;
    -f)
        read_cur
        read_faq
        ;;
    -a)
        all_mirrors


@@ 245,7 250,7 @@ case $1 in
        get_log
        ;;
    -u)
        upgrade
        s_upgrade
        ;;
    -h|*)
        usage