From 5d6bc9284098b98c1b5feafb0322efcc6d10147a Mon Sep 17 00:00:00 2001 From: Kay0u Date: Fri, 25 Oct 2019 08:55:03 +0900 Subject: [PATCH] fixing home_path --- scripts/backup | 3 ++- scripts/change_url | 3 ++- scripts/install | 14 ++++++++------ scripts/remove | 3 ++- scripts/restore | 5 +++-- scripts/upgrade | 8 ++++---- 6 files changed, 21 insertions(+), 15 deletions(-) diff --git a/scripts/backup b/scripts/backup index 635b6cc..83c3eb1 100755 --- a/scripts/backup +++ b/scripts/backup @@ -29,6 +29,7 @@ ynh_print_info --message="Loading installation settings..." app=$YNH_APP_INSTANCE_NAME final_path=$(ynh_app_setting_get --app=$app --key=final_path) +home_path=$(ynh_app_setting_get --app=$app --key=home_path) domain=$(ynh_app_setting_get --app=$app --key=domain) #================================================= @@ -55,7 +56,7 @@ ynh_backup --src_path="$final_path" #================================================= ynh_print_info --message="Backing up Minetest data..." -ynh_backup --src_path="/home/yunohost.app/$app" +ynh_backup --src_path="$home_path" #================================================= # SPECIFIC BACKUP diff --git a/scripts/change_url b/scripts/change_url index e1bf314..d37a27d 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -26,6 +26,7 @@ ynh_print_info --message="Loading installation settings..." # Needed for helper "ynh_add_nginx_config" final_path=$(ynh_app_setting_get --app=$app --key=final_path) +home_path=$(ynh_app_setting_get --app=$app --key=home_path) # Add settings here as needed by your application #db_name=$(ynh_app_setting_get --app=$app --key=db_name) @@ -51,7 +52,7 @@ change_path=0 #================================================= ynh_print_info --message="Stop Minetest..." ynh_systemd_action --action=restart -ynh_replace_string --match_string="$old_domain" --replace_string="$new_domain" --target_file="/home/yunohost.app/$app/.minetest/minetest.conf" +ynh_replace_string --match_string="$old_domain" --replace_string="$new_domain" --target_file="$home_path/.minetest/minetest.conf" #================================================= # GENERIC FINALISATION diff --git a/scripts/install b/scripts/install index f69a167..42771f3 100755 --- a/scripts/install +++ b/scripts/install @@ -121,23 +121,25 @@ ynh_setup_source --dest_dir="$final_path" #================================================= ynh_print_info --message="Configuring system user..." -# Create a system user -ynh_system_user_create --username=$app --home_dir=/home/yunohost.app/$app --use_shell home_path=/home/yunohost.app/$app +ynh_app_setting_set --app=$app --key=home_path --value=$home_path + +# Create a system user +ynh_system_user_create --username=$app --home_dir=$home_path --use_shell #================================================= # COPY CONFIG FILE #================================================= -if [ -e /home/yunohost.app/$app ] +if [ -e $home_path ] then echo "Nothing to do..." else -mkdir -p /home/yunohost.app/$app/.minetest/ -mkdir /home/yunohost.app/$app/.minetest/worlds/ +mkdir -p $home_path/.minetest/ +mkdir $home_path/.minetest/worlds/ fi -cp -a ../conf/minetest.conf /home/yunohost.app/$app/.minetest/ +cp -a ../conf/minetest.conf $home_path/.minetest/ #================================================= # SETUP SYSTEMD diff --git a/scripts/remove b/scripts/remove index 898aeb0..5fa3bc7 100755 --- a/scripts/remove +++ b/scripts/remove @@ -19,6 +19,7 @@ app=$YNH_APP_INSTANCE_NAME domain=$(ynh_app_setting_get --app=$app --key=domain) port=$(ynh_app_setting_get --app=$app --key=port) final_path=$(ynh_app_setting_get --app=$app --key=final_path) +home_path=$(ynh_app_setting_get --app=$app --key=home_path) #================================================= # STANDARD REMOVE @@ -56,7 +57,7 @@ ynh_print_info --message="Removing app main directory" # Remove the app directory securely ynh_secure_remove --file="$final_path" -ynh_secure_remove --file="/home/yunohost.app/$app" +ynh_secure_remove --file="$home_path" #================================================= # REMOVE LOGROTATE CONFIGURATION diff --git a/scripts/restore b/scripts/restore index 2bd1af0..0a1449c 100755 --- a/scripts/restore +++ b/scripts/restore @@ -31,6 +31,7 @@ app=$YNH_APP_INSTANCE_NAME domain=$(ynh_app_setting_get --app=$app --key=domain) path_url=$(ynh_app_setting_get --app=$app --key=path) final_path=$(ynh_app_setting_get --app=$app --key=final_path) +home_path=$(ynh_app_setting_get --app=$app --key=home_path) #================================================= # CHECK IF THE APP CAN BE RESTORED @@ -58,7 +59,7 @@ ynh_restore_file --origin_path="$final_path" ynh_print_info --message="Recreating the dedicated system user..." # Create the dedicated user (if not existing) -ynh_system_user_create --username=$app --home_dir=/home/yunohost.app/$app --use_shell +ynh_system_user_create --username=$app --home_dir=$home_path --use_shell # Restore home_path ynh_restore_file --origin_path="$home_path" @@ -69,7 +70,7 @@ ynh_restore_file --origin_path="$home_path" # Restore permissions on app files chown -R root: $final_path -chown -R $app: /home/yunohost.app/$app +chown -R $app: $home_path #================================================= # SPECIFIC RESTORATION diff --git a/scripts/upgrade b/scripts/upgrade index 945ea2d..0ad4f78 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -97,7 +97,7 @@ ynh_install_app_dependencies $pkg_dependencies ynh_print_info --message="Making sure dedicated system user exists..." # Create a dedicated user (if not existing) -ynh_system_user_create --username=$app --home_dir=/home/yunohost.app/$app --use_shell +ynh_system_user_create --username=$app --home_dir=$home_path --use_shell #================================================= # SETUP SYSTEMD @@ -111,12 +111,12 @@ ynh_add_systemd_config # COPY CONFIG FILE #================================================= -if [ -e /home/yunohost.app/$app ] +if [ -e $home_path ] then echo "Nothing to do..." else -mkdir -p /home/yunohost.app/$app/.minetest/ -mkdir /home/yunohost.app/$app/.minetest/worlds/ +mkdir -p $home_path/.minetest/ +mkdir $home_path/.minetest/worlds/ fi #=================================================