mirror of
https://codeberg.org/icewind/haze.git
synced 2026-10-01 08:44:09 +02:00
feat(bootstrap): Make the bootsrap script idempotent
Signed-off-by: Louis Chmn <louis@chmn.me>
This commit is contained in:
parent
65d4d5d83c
commit
b1fac05d57
2 changed files with 22 additions and 12 deletions
|
|
@ -5,12 +5,14 @@ touch /var/log/nginx/error.log
|
||||||
touch /var/log/cron/owncloud.log
|
touch /var/log/cron/owncloud.log
|
||||||
|
|
||||||
mkdir /config
|
mkdir /config
|
||||||
echo "# Options in here overwrite the builtin php.ini\n" | save /config/php.ini
|
if not ("/config/php.ini" | path exists) {
|
||||||
echo "# xdebug.mode = debug\n" | save -a /config/php.ini
|
echo "# Options in here overwrite the builtin php.ini\n" | save /config/php.ini
|
||||||
echo "# xdebug.start_with_request = yes\n\n" | save -a /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
|
chmod 0777 /config/php.ini
|
||||||
let PHP_INI_DIR = php --ini | grep 'Scan' | cut -d ' ' -f7 | tr -d '"'
|
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_UID = $env.HAZE_UID | default "1000"
|
||||||
let HAZE_GID = $env.HAZE_GID | 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/access.log
|
||||||
touch /var/log/nginx/error.log
|
touch /var/log/nginx/error.log
|
||||||
|
|
||||||
if ((getent group $HAZE_GID | length) > 0) {
|
if ((getent group "haze" | length) == 0) {
|
||||||
|
if ((getent group $HAZE_GID | length) > 0) {
|
||||||
groupadd haze
|
groupadd haze
|
||||||
useradd -u $HAZE_UID -g $HAZE_GID -G haze haze
|
useradd -u $HAZE_UID -g $HAZE_GID -G haze haze
|
||||||
} else {
|
} else {
|
||||||
groupadd -g $HAZE_GID haze
|
groupadd -g $HAZE_GID haze
|
||||||
useradd -u $HAZE_UID -g $HAZE_GID haze
|
useradd -u $HAZE_UID -g $HAZE_GID haze
|
||||||
|
}
|
||||||
}
|
}
|
||||||
chown -R $"haze:($HAZE_GID)" /home/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) {
|
if ("/var/run/docker.sock" | path exists) {
|
||||||
let dockerGid = stat --format "%g" /var/run/docker.sock
|
let dockerGid = stat --format "%g" /var/run/docker.sock
|
||||||
|
if ((getent group "docker" | length) == 0) {
|
||||||
groupadd docker -g $dockerGid
|
groupadd docker -g $dockerGid
|
||||||
|
}
|
||||||
usermod -a -G docker haze
|
usermod -a -G docker haze
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,10 @@ touch /var/log/nginx/access.log
|
||||||
touch /var/log/nginx/error.log
|
touch /var/log/nginx/error.log
|
||||||
touch /var/log/cron/owncloud.log
|
touch /var/log/cron/owncloud.log
|
||||||
|
|
||||||
|
if ("/var/www/html/config/config.php" | path exists) {
|
||||||
|
exit 0
|
||||||
|
}
|
||||||
|
|
||||||
cp /etc/nc/config.php /var/www/html/config/config.php
|
cp /etc/nc/config.php /var/www/html/config/config.php
|
||||||
chmod 0755 /var/www/html/config/config.php
|
chmod 0755 /var/www/html/config/config.php
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue