1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/headphones_ynh.git synced 2024-09-03 19:26:02 +02:00

Set configuration file into install directory

This commit is contained in:
tituspijean 2024-07-23 23:12:17 +02:00
parent f9a2a9186d
commit 9ba4089486
No known key found for this signature in database
GPG key ID: EF3B0D7CC0A94720
7 changed files with 7 additions and 36 deletions

View file

@ -6,10 +6,7 @@ Type=simple
User=__APP__ User=__APP__
Group=__APP__ Group=__APP__
WorkingDirectory=__INSTALL_DIR__/ WorkingDirectory=__INSTALL_DIR__/
ExecStart=__INSTALL_DIR__/venv/bin/python3 __INSTALL_DIR__/Headphones.py --config /etc/__APP__/headphones.ini --datadir __DATA_DIR__ --nolaunch ExecStart=__INSTALL_DIR__/venv/bin/python3 __INSTALL_DIR__/Headphones.py --config __INSTALL_DIR__/headphones.ini --datadir __DATA_DIR__ --nolaunch
# Allow headphones to write to its configuration directory despite ProtectSystem
ReadWritePaths=/etc/__APP__
# Sandboxing options to harden security # Sandboxing options to harden security
# Depending on specificities of your service/app, you may need to tweak these # Depending on specificities of your service/app, you may need to tweak these

View file

@ -47,12 +47,6 @@ ynh_backup --src_path="/etc/logrotate.d/$app"
ynh_backup --src_path="/etc/systemd/system/$app.service" ynh_backup --src_path="/etc/systemd/system/$app.service"
#=================================================
# BACKUP VARIOUS FILES
#=================================================
ynh_backup --src_path="/etc/$app/"
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================

View file

@ -32,7 +32,7 @@ ynh_change_url_nginx_config
#================================================= #=================================================
ynh_script_progression --message="Updating a configuration file..." ynh_script_progression --message="Updating a configuration file..."
ynh_replace_string --match_string="^http_root = .*" --replace_string="http_root = $new_path" --target_file="/etc/$app/headphones.ini" ynh_replace_string --match_string="^http_root = .*" --replace_string="http_root = $new_path" --target_file="$install_dir/headphones.ini"
#================================================= #=================================================
# GENERIC FINALISATION # GENERIC FINALISATION

View file

@ -43,11 +43,11 @@ python3 -m venv $install_dir/venv
#================================================= #=================================================
ynh_script_progression --message="Adding a configuration file..." ynh_script_progression --message="Adding a configuration file..."
mkdir -p "/etc/$app" ynh_add_config --template="../conf/headphones.ini" --destination="$install_dir/headphones.ini"
ynh_add_config --template="../conf/headphones.ini" --destination="/etc/$app/headphones.ini" ynh_delete_file_checksum --file="$install_dir/headphones.ini"
chmod 650 "/etc/$app/headphones.ini" chmod 650 "$install_dir/headphones.ini"
chown $app:$app "/etc/$app/headphones.ini" chown $app:$app "$install_dir/headphones.ini"
#================================================= #=================================================
# SETUP SYSTEMD # SETUP SYSTEMD

View file

@ -46,16 +46,6 @@ ynh_script_progression --message="Removing NGINX web server configuration..."
# Remove the dedicated NGINX config # Remove the dedicated NGINX config
ynh_remove_nginx_config ynh_remove_nginx_config
#=================================================
# SPECIFIC REMOVE
#=================================================
# REMOVE VARIOUS FILES
#=================================================
ynh_script_progression --message="Removing various files..."
# Remove a directory securely
ynh_secure_remove --file="/etc/$app"
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================

View file

@ -40,16 +40,6 @@ ynh_restore_file --origin_path="$data_dir" --not_mandatory
chown -R $app:$app "$data_dir" chown -R $app:$app "$data_dir"
#=================================================
# RESTORE VARIOUS FILES
#=================================================
ynh_script_progression --message="Restoring various files..."
ynh_restore_file --origin_path="/etc/$app/"
chmod 600 "/etc/$app/headphones.ini"
chown $app:$app "/etc/$app/headphones.ini"
#================================================= #=================================================
# RESTORE SYSTEMD # RESTORE SYSTEMD
#================================================= #=================================================

View file

@ -63,7 +63,7 @@ python3 -m venv $install_dir/venv
#================================================= #=================================================
ynh_script_progression --message="Updating a configuration file..." ynh_script_progression --message="Updating a configuration file..."
ynh_replace_string --match_string="^http_root = .*" --replace_string="http_root = $path" --target_file="/etc/$app/headphones.ini" ynh_replace_string --match_string="^http_root = .*" --replace_string="http_root = $path" --target_file="$install_dir/headphones.ini"
#================================================= #=================================================
# SETUP SYSTEMD # SETUP SYSTEMD