Align shell style all over the repo

This commit is contained in:
Lucas 2020-05-03 14:47:27 +00:00
parent afb13d9c9c
commit d5e71c46f7
16 changed files with 113 additions and 86 deletions

View file

@ -1,4 +1,15 @@
#!/bin/sh
# env
# Written in 2020 by Lucas
# CC0 1.0 Universal/Public domain - No rights reserved
#
# To the extent possible under law, the author(s) have dedicated all
# copyright and related and neighboring rights to this software to the
# public domain worldwide. This software is distributed without any
# warranty. You should have received a copy of the CC0 Public Domain
# Dedication along with this software. If not, see
# <http://creativecommons.org/publicdomain/zero/1.0/>.
usage()
{
printf "Usage: %s version\n" "${0##*/}" >&2
@ -16,19 +27,14 @@ isversion()
printf "%s\n" "$*" | grep -Eq "^v[0-9]+\.[0-9]+\.[0-9]+$"
}
if [ -z "${RIOT_WEB_UI_DIR:-}" ]; then
err "Environment RIOT_WEB_UI_DIR unset"
fi
if [ $# -ne 1 ] || ! isversion "$1"; then
usage
fi
[ -n "${RIOT_WEB_UI_DIR:-}" ] || err "environment var RIOT_WEB_UI_DIR unset"
[ $# -eq 1 ] && isversion "$1" || usage
ver=$1
GH_BASE_URL=https://github.com/vector-im/riot-web/releases/download
cd "$RIOT_WEB_UI_DIR" || err "Can't cd to web UI directory"
cd "$RIOT_WEB_UI_DIR" || err "can't cd to web UI directory"
ftp -o - "$GH_BASE_URL/$ver/riot-$ver.tar.gz" | pax -rz ||
err "Can't fetch and extract release"
err "can't fetch and extract release"
rm -f riot && ln -s "riot-$ver" riot ||
err "Can't point web UI directory to new release"
err "can't point web UI directory to new release"