mirror of
https://github.com/YunoHost-Apps/invidious_ynh.git
synced 2024-09-03 19:15:55 +02:00
Preserve config file and protect it
This commit is contained in:
parent
54f366c6ea
commit
d5a8c8d13b
2 changed files with 14 additions and 7 deletions
|
@ -166,6 +166,7 @@ ynh_script_progression --message="Securing files and directories..." --weight=1
|
||||||
# Set permissions to app files
|
# Set permissions to app files
|
||||||
chown -R $app: $final_path
|
chown -R $app: $final_path
|
||||||
chmod 0644 /etc/logrotate.d/$app
|
chmod 0644 /etc/logrotate.d/$app
|
||||||
|
chmod 600 $final_path/config/config.yml
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# INTEGRATE SERVICE IN YUNOHOST
|
# INTEGRATE SERVICE IN YUNOHOST
|
||||||
|
|
|
@ -87,13 +87,25 @@ if [ "$upgrade_type" == "UPGRADE_APP" ]
|
||||||
then
|
then
|
||||||
ynh_script_progression --message="Upgrading source files..." --weight=5
|
ynh_script_progression --message="Upgrading source files..." --weight=5
|
||||||
|
|
||||||
|
tmpdir="$(mktemp -d)"
|
||||||
|
|
||||||
|
# Backup the config file in the temp dir
|
||||||
|
cp -a "$final_path/config/config.yml" "$tmpdir/config.yml"
|
||||||
|
|
||||||
# Remove the app directory securely
|
# Remove the app directory securely
|
||||||
ynh_secure_remove --file=$final_path
|
ynh_secure_remove --file=$final_path
|
||||||
|
|
||||||
git clone https://github.com/iv-org/invidious "$final_path" --quiet
|
git clone https://github.com/iv-org/invidious "$final_path" --quiet
|
||||||
pushd "$final_path" || ynh_die
|
pushd "$final_path" || ynh_die
|
||||||
shards update && shards install
|
shards update && shards install
|
||||||
crystal build $final_path/src/invidious.cr --release
|
crystal build $final_path/src/invidious.cr --release
|
||||||
popd || ynh_die
|
popd || ynh_die
|
||||||
|
|
||||||
|
# Copy the admin saved settings from tmp directory to final path
|
||||||
|
cp -a "$tmpdir/config.yml" "$final_path/config/config.yml"
|
||||||
|
|
||||||
|
# Remove the tmp directory securely
|
||||||
|
ynh_secure_remove --file="$tmpdir"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -112,13 +124,6 @@ ynh_script_progression --message="Making sure dedicated system user exists..." -
|
||||||
# Create a dedicated user (if not existing)
|
# Create a dedicated user (if not existing)
|
||||||
ynh_system_user_create --username=$app
|
ynh_system_user_create --username=$app
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# MODIFY A CONFIG FILE
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Modifying a config file..." --weight=3
|
|
||||||
|
|
||||||
ynh_add_config --template="../conf/config.yml" --destination="$final_path/config/config.yml"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP SYSTEMD
|
# SETUP SYSTEMD
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -145,6 +150,7 @@ ynh_script_progression --message="Securing files and directories..." --weight=1
|
||||||
# Set permissions on app files
|
# Set permissions on app files
|
||||||
chown -R $app: $final_path
|
chown -R $app: $final_path
|
||||||
chmod 0644 /etc/logrotate.d/$app
|
chmod 0644 /etc/logrotate.d/$app
|
||||||
|
chmod 600 $final_path/config/config.yml
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# INTEGRATE SERVICE IN YUNOHOST
|
# INTEGRATE SERVICE IN YUNOHOST
|
||||||
|
|
Loading…
Add table
Reference in a new issue