Browse Source

Kontroly prerekvizit do knihovny

pull/11/head
Pavel 'LEdoian' Turinsky 2 years ago
parent
commit
0458abb419
  1. 13
      make/deploy
  2. 13
      make/deploy_prod
  3. 18
      make/lib.sh

13
make/deploy

@ -3,17 +3,8 @@
set -exuo pipefail set -exuo pipefail
. make/lib.sh . make/lib.sh
if test "$USER" != "mam-web"; gimli_only
then only_in_directory "$TESTWEB"
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
CURRENT_BRANCH="$(git branch --show-current)" CURRENT_BRANCH="$(git branch --show-current)"
BRANCH="${1:-$CURRENT_BRANCH}" BRANCH="${1:-$CURRENT_BRANCH}"

13
make/deploy_prod

@ -3,17 +3,8 @@
set -exuo pipefail set -exuo pipefail
. make/lib.sh . make/lib.sh
if test "$USER" != "mam-web" gimli_only
then only_in_directory "$PRODWEB"
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
CURRENT_BRANCH="$(git branch --show-current)" CURRENT_BRANCH="$(git branch --show-current)"
BRANCH="${1:-$CURRENT_BRANCH}" BRANCH="${1:-$CURRENT_BRANCH}"

18
make/lib.sh

@ -26,6 +26,24 @@ function ensure_venv {
. "$VENV_PATH/bin/activate" . "$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 { function safe_checkout_branch {
if "$#" -ne 2 if "$#" -ne 2

Loading…
Cancel
Save