1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/gemserv_ynh.git synced 2024-09-03 18:36:27 +02:00

Merge pull request #14 from OniriCorpe/fix_config

server.toml should always be at the beginning of config.toml
This commit is contained in:
yalh76 2022-05-10 08:17:10 +02:00 committed by GitHub
commit 61f0f057f0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 7 deletions

View file

@ -8,7 +8,8 @@ User=__APP__
Group=__APP__
WorkingDirectory=__FINALPATH__/
ExecStartPre=-/bin/bash -c 'chown -R __APP__:__APP__ /etc/__APP__/'
ExecStartPre=-/bin/bash -c 'cat /etc/__APP__/config.d/*.toml > /etc/__APP__/config.toml'
ExecStartPre=-/bin/bash -c 'cp /etc/__APP__/config.d/server.toml.head /etc/__APP__/config.toml'
ExecStartPre=-/bin/bash -c 'cat /etc/__APP__/config.d/*.toml >> /etc/__APP__/config.toml'
ExecStart=__FINALPATH__/live/__APP__ /etc/__APP__/config.toml
StandardOutput=append:/var/log/__APP__/__APP__.log
StandardError=inherit

View file

@ -118,10 +118,10 @@ chmod 750 "/etc/$app"
chmod -R o-rwx "/etc/$app"
chown -R "$app":"$app" "/etc/$app"
ynh_add_config --template="../conf/server.toml" --destination="/etc/$app/config.d/server.toml"
ynh_add_config --template="server.toml" --destination="/etc/$app/config.d/server.toml.head"
chmod 400 "/etc/$app/config.d/server.toml"
chown "$app":"$app" "/etc/$app/config.d/server.toml"
chmod 400 "/etc/$app/config.d/server.toml.head"
chown "$app":"$app" "/etc/$app/config.d/server.toml.head"
#=================================================
# SETUP SYSTEMD

View file

@ -53,6 +53,14 @@ ynh_systemd_action --service_name="$app" --action="stop" --line_match="Stopped"
#=================================================
ynh_script_progression --message="Ensuring downward compatibility..."
# Change to head file
if [ -f "/etc/$app/config.d/server.toml" ]
then
ynh_delete_file_checksum --file="/etc/$app/config.d/server.toml"
mv "/etc/$app/config.d/server.toml" "/etc/$app/config.d/server.toml.head"
ynh_store_file_checksum --file="/etc/$app/config.d/server.toml.head"
fi
#=================================================
# CREATE DEDICATED USER
#=================================================
@ -129,10 +137,10 @@ chmod 750 "/etc/$app"
chmod -R o-rwx "/etc/$app"
chown -R "$app":"$app" "/etc/$app"
ynh_add_config --template="../conf/server.toml" --destination="/etc/$app/config.d/server.toml"
ynh_add_config --template="server.toml" --destination="/etc/$app/config.d/server.toml.head"
chmod 400 "/etc/$app/config.d/server.toml"
chown "$app":"$app" "/etc/$app/config.d/server.toml"
chmod 400 "/etc/$app/config.d/server.toml.head"
chown "$app":"$app" "/etc/$app/config.d/server.toml.head"
#=================================================
# SETUP SYSTEMD