From 386490336accca0c81a70038a253169bafe4e8e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Mon, 25 Mar 2024 23:56:10 +0100 Subject: [PATCH] Update, cleanup --- scripts/install | 30 ++++++++++-------------------- 1 file changed, 10 insertions(+), 20 deletions(-) diff --git a/scripts/install b/scripts/install index 85be84d..95d7939 100644 --- a/scripts/install +++ b/scripts/install @@ -28,6 +28,8 @@ ynh_script_progression --message="Setting up source files..." --weight=1 # Download, check integrity, uncompress and patch the source from app.src ynh_setup_source --source_id="main" --dest_dir="$install_dir" +chmod 750 "$install_dir" + #================================================= # PREPARE AND INSTALL APP #================================================= @@ -52,8 +54,7 @@ ynh_use_logrotate --logfile="$install_dir/documents/dolibarr.log" #================================================= # SETUP APPLICATION WITH CURL #================================================= -# Installation with curl -ynh_script_progression --message="Configuring $app..." --weight=1 +ynh_script_progression --message="Configuring $app ..." --weight=1 # Create necessary files touch "$install_dir/htdocs/conf/conf.php" @@ -61,25 +62,20 @@ touch "$install_dir/htdocs/conf/conf.php" # Set right permissions for curl install chown -R "$app:" "$install_dir" -ynh_script_progression --message="Generate fileconf" --weight=1 ynh_local_curl "/install/fileconf.php" "testpost=ok" ynh_exec_fully_quiet sleep 5 -ynh_script_progression --message="installation - step 1" --weight=3 ynh_local_curl "/install/step1.php" "testpost=ok" "action=set" ynh_exec_fully_quiet sleep 5 -ynh_script_progression --message="installation - step 2 (may take a while)..." --weight=72 ynh_local_curl "/install/step2.php" "testpost=ok" "action=set" ynh_exec_fully_quiet sleep 5 -ynh_script_progression --message="installation - step 4" --weight=3 ynh_local_curl "/install/step4.php" "testpost=ok" "action=set" ynh_exec_fully_quiet sleep 5 # Generate a random password for the admin user (will be ignored because of LDAP) password=$(ynh_string_random 8) -ynh_script_progression --message="installation - step 5" --weight=4 ynh_local_curl "/install/step5.php" "testpost=ok" "action=set" "pass=$password" "pass_verif=$password" ynh_exec_fully_quiet sleep 5 @@ -99,6 +95,13 @@ if [ ! -f "$install_dir/documents/install.lock" ]; then chmod 440 "$install_dir/documents/install.lock" fi +chmod -R o-rwx "$install_dir" +chown -R "$app:www-data" "$install_dir" + +mkdir -p "$install_dir/documents" +chown -R "$app:" "$install_dir/documents" +chmod go-w "$install_dir/documents" + #================================================= # SETUP LDAP #================================================= @@ -116,19 +119,6 @@ else ynh_print_info --message="LDAP user update ended with error" fi -#================================================= -# SECURE FILES AND DIRECTORIES -#================================================= -#REMOVEME? ynh_script_progression --message="Configuring permissions..." --weight=1 - -chmod 750 "$install_dir" -chmod -R o-rwx "$install_dir" -chown -R "$app:www-data" "$install_dir" - -mkdir -p "$install_dir/documents" -chown -R "$app:" "$install_dir/documents" -chmod go-w "$install_dir/documents" - #================================================= # END OF SCRIPT #=================================================