This commit is contained in:
Florian Hoss 2023-07-04 11:51:13 +02:00
commit f90fdc0598
99 changed files with 15260 additions and 0 deletions

25
scripts/dev.sh Executable file
View file

@ -0,0 +1,25 @@
#!/bin/sh
parse_yaml() {
local prefix=$2
local s='[[:space:]]*' w='[a-zA-Z0-9_]*' fs=$(echo @ | tr @ '\034')
sed -ne "s|^\($s\)\($w\)$s:$s\"\(.*\)\"$s\$|\1$fs\2$fs\3|p" \
-e "s|^\($s\)\($w\)$s:$s\(.*\)$s\$|\1$fs\2$fs\3|p" $1 |
awk -F$fs '{
indent = length($1)/2;
vname[indent] = $2;
for (i in vname) {if (i > indent) {delete vname[i]}}
if (length($3) > 0) {
vn=""; for (i=0; i<indent; i++) {vn=(vn)(vname[i])("_")}
printf("%s%s%s=\"%s\"\n", "'$prefix'",vn, $2, $3);
}
}'
}
eval $(parse_yaml .gitlab/_common.gitlab-ci.yml)
echo "DOCKER_VERSION="$variables_DOCKER_VERSION >.env
echo "GOLANG_VERSION="$variables_GOLANG_VERSION >>.env
echo "NODE_VERSION="$variables_NODE_VERSION >>.env
echo "ALPINE_VERSION="$variables_ALPINE_VERSION >>.env
echo "DEBIAN_VERSION="$variables_DEBIAN_VERSION >>.env
echo "TELEPORT_VERSION="$variables_TELEPORT_VERSION >>.env

34
scripts/entrypoint.sh Executable file
View file

@ -0,0 +1,34 @@
#!/bin/sh
cat logo.txt
echo ""
if [ -n "$PUID" ] || [ -n "$PGID" ]; then
USER=appuser
HOME=/app
if ! grep -q "$USER" /etc/passwd; then
# Usage: addgroup [-g GID] [-S] [USER] GROUP
#
# Add a group or add a user to a group
# -g GID Group id
addgroup -g "$PGID" "$USER"
# Usage: adduser [OPTIONS] USER [GROUP]
# Create new user, or add USER to GROUP
# -h DIR Home directory
# -g GECOS GECOS field
# -G GRP Group
# -D Don't assign a password
# -H Don't create home directory
# -u UID User id
adduser -h "$HOME" -g "" -G "$USER" -D -H -u "$PUID" "$USER"
fi
chown "$USER":"$USER" "$HOME" -R
printf "UID: %s GID: %s\n\n" "$PUID" "$PGID"
exec su -c - $USER ./cafe
else
printf "WARNING: Running docker as root\n\n"
exec ./cafe
fi

15
scripts/swagger.sh Executable file
View file

@ -0,0 +1,15 @@
#!/bin/sh
action=$1
case $action in
"install")
go install github.com/swaggo/swag/cmd/swag@latest
;;
"init")
swag init -g api/swagger.go
;;
*)
exit 0
;;
esac