homeserver/devspace.sh
2024-07-25 23:37:45 +02:00

31 lines
863 B
Bash
Executable file

#!/bin/bash
IMAGE="registry.mgrote.net/ansible-devspace:latest"
# Farben
# https://stackoverflow.com/questions/5947742/how-to-change-the-output-color-of-echo-in-linux
# todo farben kaputt
RESET='\033[0m'
RED='\033[0;31m'
GREEN='\033[0;32m'
Yellow='\033[0;33m'
echo ${GREEN}Run checks...${RESET}
# TODO ghier noch check output mit haken dran in grün
if ! [ -f "./vault-pass" ]; then
echo "${RED}Vault-Pass File is missing!${RESET}"
exit 1
fi
if ! [ -f "./id_ed25519" ]; then
echo "${RED}SSH-Private-Key is missing!${RESET}"
exit 1
fi
echo ${GREEN}Pull image...${RESET}
docker pull --quiet ${IMAGE}
echo ${GREEN}Start session...${RESET}
docker run -it -v $PWD:/ansible-homeserver -w /ansible-homeserver ${IMAGE} tmux new -t ansible && git rev-parse --abbrev-ref HEAD && git config --global --add safe.directory /ansible-homeserver
# todo shellcheck