1
0
Fork 0
mirror of https://codeberg.org/icewind/haze.git synced 2026-10-01 16:54:08 +02:00

feat(bootstrap): Make the bootsrap script idempotent

Signed-off-by: Louis Chmn <louis@chmn.me>
This commit is contained in:
Louis Chmn 2026-08-22 21:36:58 +02:00
commit b1fac05d57
2 changed files with 22 additions and 12 deletions

View file

@ -5,12 +5,14 @@ touch /var/log/nginx/error.log
touch /var/log/cron/owncloud.log
mkdir /config
echo "# Options in here overwrite the builtin php.ini\n" | save /config/php.ini
echo "# xdebug.mode = debug\n" | save -a /config/php.ini
echo "# xdebug.start_with_request = yes\n\n" | save -a /config/php.ini
if not ("/config/php.ini" | path exists) {
echo "# Options in here overwrite the builtin php.ini\n" | save /config/php.ini
echo "# xdebug.mode = debug\n" | save -a /config/php.ini
echo "# xdebug.start_with_request = yes\n\n" | save -a /config/php.ini
}
chmod 0777 /config/php.ini
let PHP_INI_DIR = php --ini | grep 'Scan' | cut -d ' ' -f7 | tr -d '"'
ln -s /config/php.ini $"($PHP_INI_DIR)/zz_extra.ini"
ln -sf /config/php.ini $"($PHP_INI_DIR)/zz_extra.ini"
let HAZE_UID = $env.HAZE_UID | default "1000"
let HAZE_GID = $env.HAZE_GID | default "1000"
@ -51,19 +53,23 @@ mkdir /var/log/nginx /tmp /var/run/blackfire
touch /var/log/nginx/access.log
touch /var/log/nginx/error.log
if ((getent group $HAZE_GID | length) > 0) {
groupadd haze
useradd -u $HAZE_UID -g $HAZE_GID -G haze haze
} else {
groupadd -g $HAZE_GID haze
useradd -u $HAZE_UID -g $HAZE_GID haze
if ((getent group "haze" | length) == 0) {
if ((getent group $HAZE_GID | length) > 0) {
groupadd haze
useradd -u $HAZE_UID -g $HAZE_GID -G haze haze
} else {
groupadd -g $HAZE_GID haze
useradd -u $HAZE_UID -g $HAZE_GID haze
}
}
chown -R $"haze:($HAZE_GID)" /home/haze
ls -af /etc/home | each {|file| ln -s $file.name $"/home/haze/($file.name | path basename)" }
ls -af /etc/home | each {|file| ln -sf $file.name $"/home/haze/($file.name | path basename)" }
if ("/var/run/docker.sock" | path exists) {
let dockerGid = stat --format "%g" /var/run/docker.sock
groupadd docker -g $dockerGid
if ((getent group "docker" | length) == 0) {
groupadd docker -g $dockerGid
}
usermod -a -G docker haze
}