From 41a66e36f2ca14cf6befabf2f6ee1c7d3fa29c92 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Wed, 15 Jul 2020 17:07:20 +0200 Subject: [PATCH] Update install --- scripts/install | 59 ++++++++++++++----------------------------------- 1 file changed, 17 insertions(+), 42 deletions(-) diff --git a/scripts/install b/scripts/install index 085658d..1e92dfd 100644 --- a/scripts/install +++ b/scripts/install @@ -28,16 +28,6 @@ path_url=$YNH_APP_ARG_PATH is_public=$YNH_APP_ARG_IS_PUBLIC root_access=$YNH_APP_ARG_ROOT_ACCESS -### If it's a multi-instance app, meaning it can be installed several times independently -### The id of the app as stated in the manifest is available as $YNH_APP_ID -### The instance number is available as $YNH_APP_INSTANCE_NUMBER (equals "1", "2", ...) -### The app instance name is available as $YNH_APP_INSTANCE_NAME -### - the first time the app is installed, YNH_APP_INSTANCE_NAME = ynhexample -### - the second time the app is installed, YNH_APP_INSTANCE_NAME = ynhexample__2 -### - ynhexample__{N} for the subsequent installations, with N=3,4, ... -### The app instance name is probably what interests you most, since this is -### guaranteed to be unique. This is a good unique identifier to define installation path, -### db names, ... app=$YNH_APP_INSTANCE_NAME #================================================= @@ -67,17 +57,8 @@ ynh_app_setting_set --app=$app --key=root_access --value=$root_access #================================================= ynh_script_progression --message="Installing dependencies..." --time --weight=1 -### `ynh_install_app_dependencies` allows you to add any "apt" dependencies to the package. -### Those deb packages will be installed as dependencies of this package. -### If you're not using this helper: -### - Remove the section "REMOVE DEPENDENCIES" in the remove script -### - Remove the variable "pkg_dependencies" in _common.sh -### - As well as the section "REINSTALL DEPENDENCIES" in the restore script -### - And the section "UPGRADE DEPENDENCIES" in the upgrade script - ynh_install_app_dependencies $pkg_dependencies - #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= @@ -85,14 +66,15 @@ ynh_script_progression --message="Setting up source files..." --time --weight=1 ynh_app_setting_set --app=$app --key=final_path --value=$final_path # Download, check integrity, uncompress and patch the source from app.src + mkdir -p $final_path if [[ $root_access -eq 1 ]]; then -#copy files from with_root_access folder to the final_path - cp -a ../sources/with_root_access/. $final_path + #copy files from with_root_access folder to the final_path + cp -a ../sources/with_root_access/. $final_path else -#copy files from root_access_disabled folder to the final_path -cp -a ../sources/root_access_disabled/. $final_path + #copy files from root_access_disabled folder to the final_path + cp -a ../sources/root_access_disabled/. $final_path fi #================================================= @@ -103,40 +85,29 @@ ynh_script_progression --message="Configuring system user..." --time --weight=1 # Create a system user ynh_system_user_create --username=$app +#================================================= +# GENERIC FINALIZATION +#================================================= +# SECURE FILES AND DIRECTORIES +#================================================= # Set permissions to app files -# Make some file and/or directory writeable by app user (nginx user) -find $final_path -type f | xargs sudo chmod 644 -find $final_path -type d | xargs sudo chmod 755 -chown -R $app: $final_path +chmod 755 -R $final_path/adminer.php +chown -R www-data:www-data $final_path #================================================= # NGINX CONFIGURATION #================================================= ynh_script_progression --message="Configuring nginx web server..." --time --weight=1 -### `ynh_add_nginx_config` will use the file conf/nginx.conf - # Create a dedicated nginx config ynh_add_nginx_config - #================================================= # PHP-FPM CONFIGURATION #================================================= ynh_script_progression --message="Configuring php-fpm..." --time --weight=1 -### `ynh_add_fpm_config` is used to set up a PHP config. -### You can remove it if your app doesn't use PHP. -### `ynh_add_fpm_config` will use the files conf/php-fpm.conf -### If you're not using these lines: -### - You can remove these files in conf/. -### - Remove the section "BACKUP THE PHP-FPM CONFIGURATION" in the backup script -### - Remove also the section "REMOVE PHP-FPM CONFIGURATION" in the remove script -### - As well as the section "RESTORE THE PHP-FPM CONFIGURATION" in the restore script -### With the reload at the end of the script. -### - And the section "PHP-FPM CONFIGURATION" in the upgrade script - # Create a dedicated php-fpm config ynh_add_fpm_config @@ -145,7 +116,6 @@ ynh_add_fpm_config #================================================= ynh_script_progression --message="Configuring SSOwat..." --time --weight=1 - # Make app public if necessary if [ $is_public -eq 1 ] then @@ -160,3 +130,8 @@ ynh_script_progression --message="Reloading nginx web server..." --time --weight ynh_systemd_action --service_name=nginx --action=reload +#================================================= +# END OF SCRIPT +#================================================= + +ynh_script_progression --message="Installation of $app completed" --time --last