Files
installer-tool/entrypoint.sh
hael 4088fe252e
All checks were successful
continuous-integration/drone/push Build is passing
registry.format.hu -> safebox
2025-03-05 11:41:05 +01:00

73 lines
1.8 KiB
Bash
Executable File

#!/bin/sh
toUpperCase() {
echo "$*" | tr '[:lower:]' '[:upper:]';
}
#DOCKER_REGISTRY_URL=${DOCKER_REGISTRY_URL:-"registry.format.hu"}
DOCKER_REGISTRY_URL=${DOCKER_REGISTRY_URL:-"safebox"}
GLOBAL_VERSION=${GLOBAL_VERSION:-latest}
version_update() {
for JSON in $(ls /etc/user/config/services/*.json); do
IMAGE_NAMES=$(cat $JSON |grep IMAGE |grep $DOCKER_REGISTRY_URL| cut -d '/' -f2 | cut -d '"' -f1 | uniq)
for IMAGE_NAME in $(echo $IMAGE_NAMES);
do IMAGE_NAME=$(echo $IMAGE_NAME | cut -d ':' -f1);
echo $IMAGE_NAME;
sed -i "/$DOCKER_REGISTRY_URL/s/$IMAGE_NAME.*$/$IMAGE_NAME:$GLOBAL_VERSION\",/g" $JSON ;
done
done
}
GIT_REPO=$GIT_REPO
if [ "$GIT_REPO" == "" ]; then
GIT_REPO=git.format.hu
fi
ORGANIZATION=${ORGANIZATION:-safebox}
SMARTHOST_PROXY=$(toUpperCase $SMARTHOST_PROXY)
LOCAL_PROXY=$(toUpperCase $LOCAL_PROXY)
VPN_PROXY=$(toUpperCase $VPN_PROXY)
CRON=$(toUpperCase $CRON)
HOST=$HOST
PORT=$PORT
cd /root
if [ "$PORT" == "" ]; then
PORT=20202
fi
if [ "$HOST" == "" ]; then
HOST=git.format.hu
fi
# Check git repository permissions"
if [ "$ADDITIONALS" == "true" ]; then
echo "Additional install has started"
sh /additional_install.sh
echo "Additional install has finished"
elif [ -n "$WSL_DISTRO_NAME" ]; then
echo "Download WSL2 systemd scripts"
cp -rv /wsl2-systemd-script.sh /usr/local/bin/wsl2-systemd-script.sh
cp -rv /enter-systemd-namespace.sh /usr/local/bin/enter-systemd-namespace.sh;
cp -rv /start-systemd-namespace.sh /usr/local/bin/start-systemd-namespace.sh;
else # default install
if [[ "$SMARTHOST_PROXY" == "YES" || "$SMARTHOST_PROXY" == "TRUE" ]]; then
PROXY_TYPE=smarthost-proxy" "$PROXY_TYPE;
fi
if [ "$PROXY_TYPE" == "" ] ; then
echo "No proxy type deployment defined, exiting."
exit;
fi
sh /deploy.sh
version_update;
echo "Successfully deployed $PROXY_TYPE"
fi