Kontroly prerekvizit do knihovny

This commit is contained in:
Pavel 'LEdoian' Turinsky 2022-11-15 11:58:22 +01:00
parent f6d939fc31
commit 0458abb419
3 changed files with 22 additions and 22 deletions

View file

@ -3,17 +3,8 @@
set -exuo pipefail
. make/lib.sh
if test "$USER" != "mam-web";
then
echo >&2 "Nasadit web smí jen uživatel mam-web"
exit 1
fi
if test "$(readlink -f .)" != "$TESTWEB";
then
echo >&2 "Nasadit testweb lze jen v jeho složce"
exit 1
fi
gimli_only
only_in_directory "$TESTWEB"
CURRENT_BRANCH="$(git branch --show-current)"
BRANCH="${1:-$CURRENT_BRANCH}"

View file

@ -3,17 +3,8 @@
set -exuo pipefail
. make/lib.sh
if test "$USER" != "mam-web"
then
echo >&2 "Nasadit web smí jen uživatel mam-web"
exit 1
fi
if test "$(readlink -f .)" != "$PRODWEB"
then
echo >&2 "Nasadit testweb lze jen v jeho složce"
exit 1
fi
gimli_only
only_in_directory "$PRODWEB"
CURRENT_BRANCH="$(git branch --show-current)"
BRANCH="${1:-$CURRENT_BRANCH}"

View file

@ -26,6 +26,24 @@ function ensure_venv {
. "$VENV_PATH/bin/activate"
}
function gimli_only {
# Rovnou zkontrolujeme i uživatele
if test "$HOSTNAME" != gimli -o "$USER" != mam-web
then
echo "Tento příkaz se má spouštět na gimlim, chceš pokračovat? Pokud ne, sestřel tento skript."
read
fi
}
function only_in_directory {
DIR="$1"
CURRENT="$(readlink -f .)"
if test "$CURRENT" != "$DIR"
then
echo "Tento příkaz se má spouštět ve složce $DIR, chceš pokračovat? Pokud ne, sestřel tento skript."
read
fi
}
function safe_checkout_branch {
if "$#" -ne 2