From d1193cd07a5c0b96a0f584deefbcb99c362efdfd Mon Sep 17 00:00:00 2001 From: navanchauhan Date: Wed, 15 Jun 2022 19:29:09 +0530 Subject: [PATCH] removed app_main_dir --- manifest.json | 2 +- scripts/backup | 7 ------- scripts/install | 13 +------------ scripts/remove | 4 ---- scripts/restore | 28 +--------------------------- scripts/upgrade | 19 +------------------ 6 files changed, 4 insertions(+), 69 deletions(-) diff --git a/manifest.json b/manifest.json index e4d7133..c956840 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "App to setup the server as a Time Machine backup target", "fr": "Expliquez en *quelques* (10~15) mots l'utilité de l'app ou ce qu'elle fait (l'objectif est de donner une idée grossière pour des utilisateurs qui naviguent dans un catalogue de 100+ apps)" }, - "version": "1.0~ynh2", + "version": "1.0~ynh3", "url": "https://example.com", "upstream": { "license": "free", diff --git a/scripts/backup b/scripts/backup index bdc3744..473cc8c 100755 --- a/scripts/backup +++ b/scripts/backup @@ -27,7 +27,6 @@ ynh_abort_if_errors ynh_print_info --message="Loading installation settings..." app=$YNH_APP_INSTANCE_NAME -final_path=$(ynh_app_setting_get --app=$app --key=final_path) datadir=$(ynh_app_setting_get --app=$app --key=datadir) #================================================= @@ -35,12 +34,6 @@ datadir=$(ynh_app_setting_get --app=$app --key=datadir) #================================================= ynh_print_info --message="Declaring files to be backed up..." -#================================================= -# BACKUP THE APP MAIN DIR -#================================================= - -ynh_backup --src_path="$final_path" - #================================================= # BACKUP THE DATA DIR #================================================= diff --git a/scripts/install b/scripts/install index 67e6792..1e0e16e 100755 --- a/scripts/install +++ b/scripts/install @@ -32,17 +32,6 @@ admin_mail=$(ynh_user_get_info --username=$admin --key=mail) app=$YNH_APP_INSTANCE_NAME -#================================================= -# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS -#================================================= - -ynh_script_progression --message="Validating installation parameters..." --time --weight=1 - -### If the app uses NGINX as web server (written in HTML/PHP in most cases), the final path should be "/var/www/$app". -### If the app provides an internal web server (or uses another application server such as uWSGI), the final path should be "/opt/yunohost/$app" -final_path=/opt/yunohost/$app -test ! -e "$final_path" || ynh_die --message="This path already contains a folder" - #================================================= # STORE SETTINGS FROM MANIFEST #================================================= @@ -73,7 +62,7 @@ ynh_install_app_dependencies $pkg_dependencies ynh_script_progression --message="Configuring system user..." --time --weight=1 # Create a system user -ynh_system_user_create --username=$app --home_dir="$final_path" +ynh_system_user_create --username=$app # Createa samba user (echo "$password"; echo "$password") | ynh_exec_warn_less smbpasswd -s -a "$app" diff --git a/scripts/remove b/scripts/remove index 0d864ab..e8366d2 100755 --- a/scripts/remove +++ b/scripts/remove @@ -16,7 +16,6 @@ ynh_script_progression --message="Loading installation settings..." --time --wei app=$YNH_APP_INSTANCE_NAME -final_path=$(ynh_app_setting_get --app=$app --key=final_path) datadir=$(ynh_app_setting_get --app=$app --key=datadir) #================================================= @@ -24,9 +23,6 @@ datadir=$(ynh_app_setting_get --app=$app --key=datadir) #================================================= ynh_script_progression --message="Removing app main directory..." --time --weight=1 -# Remove the app directory securely -ynh_secure_remove --file="$final_path" - #================================================= # REMOVE DATA DIR #================================================= diff --git a/scripts/restore b/scripts/restore index 9223574..32667eb 100755 --- a/scripts/restore +++ b/scripts/restore @@ -28,18 +28,9 @@ ynh_script_progression --message="Loading installation settings..." --time --wei app=$YNH_APP_INSTANCE_NAME -final_path=$(ynh_app_setting_get --app=$app --key=final_path) datadir=$(ynh_app_setting_get --app=$app --key=datadir) password=$(ynh_app_setting_get --app=$app --key=password) -#================================================= -# CHECK IF THE APP CAN BE RESTORED -#================================================= -ynh_script_progression --message="Validating restoration parameters..." --time --weight=1 - -test ! -d $final_path \ - || ynh_die --message="There is already a directory: $final_path " - #================================================= # STANDARD RESTORATION STEPS #================================================= @@ -48,28 +39,11 @@ test ! -d $final_path \ ynh_script_progression --message="Recreating the dedicated system user..." --time --weight=1 # Create the dedicated user (if not existing) -ynh_system_user_create --username=$app --home_dir="$final_path" +ynh_system_user_create --username=$app # Create the samba user (echo "$password"; echo "$password") | ynh_exec_warn_less smbpasswd -s -a "$app" -#================================================= -# RESTORE THE APP MAIN DIR -#================================================= -ynh_script_progression --message="Restoring the app main directory..." --time --weight=1 - -ynh_restore_file --origin_path="$final_path" - -# FIXME: this should be managed by the core in the future -# Here, as a packager, you may have to tweak the ownerhsip/permissions -# such that the appropriate users (e.g. maybe www-data) can access -# files in some cases. -# But FOR THE LOVE OF GOD, do not allow r/x for "others" on the entire folder - -# this will be treated as a security issue. -chmod 750 "$final_path" -chmod -R o-rwx "$final_path" -chown -R $app:www-data "$final_path" - #================================================= # RESTORE THE DATA DIRECTORY #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 7ffea6a..121d72e 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -17,7 +17,6 @@ ynh_script_progression --message="Loading installation settings..." --time --wei app=$YNH_APP_INSTANCE_NAME admin=$(ynh_app_setting_get --app=$app --key=admin) -final_path=$(ynh_app_setting_get --app=$app --key=final_path) #================================================= # CHECK VERSION @@ -89,7 +88,7 @@ fi ynh_script_progression --message="Making sure dedicated system user exists..." --time --weight=1 # Create a dedicated user (if not existing) -ynh_system_user_create --username=$app --home_dir="$final_path" +ynh_system_user_create --username=$app #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE @@ -103,16 +102,6 @@ then # ynh_setup_source --dest_dir="$final_path" fi -# FIXME: this should be managed by the core in the future -# Here, as a packager, you may have to tweak the ownerhsip/permissions -# such that the appropriate users (e.g. maybe www-data) can access -# files in some cases. -# But FOR THE LOVE OF GOD, do not allow r/x for "others" on the entire folder - -# this will be treated as a security issue. -chmod 750 "$final_path" -chmod -R o-rwx "$final_path" -chown -R $app:www-data "$final_path" - #================================================= # UPGRADE DEPENDENCIES #================================================= @@ -142,12 +131,6 @@ ynh_add_config --template="../conf/avahi-samba.service" --destination="/etc/avah samba_sysadmin_update samba_sysadmin_add -# FIXME: this should be handled by the core in the future -# You may need to use chmod 600 instead of 400, -# for example if the app is expected to be able to modify its own config -chmod 400 "$final_path/some_config_file" -chown $app:$app "$final_path/some_config_file" - ### For more complex cases where you want to replace stuff using regexes, ### you shoud rely on ynh_replace_string (which is basically a wrapper for sed) ### When doing so, you also need to manually call ynh_store_file_checksum