From 6682eeedd4be0fa299856f90766da84ea66e3bbc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Mon, 25 Mar 2024 22:40:48 +0100 Subject: [PATCH] revert some changes --- scripts/install | 63 +++++++++++++++++++++++++++++++------------------ 1 file changed, 40 insertions(+), 23 deletions(-) diff --git a/scripts/install b/scripts/install index 846bade..1efc85a 100644 --- a/scripts/install +++ b/scripts/install @@ -28,7 +28,6 @@ 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" chown -R "$app:www-data" "$install_dir" #================================================= @@ -82,26 +81,6 @@ 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 -# Setup HTTP auth in conf -ynh_replace_string --match_string="dolibarr_main_authentication='dolibarr'" --replace_string="dolibarr_main_authentication='http'" --target_file="$install_dir/htdocs/conf/conf.php" - -# Calculate and store the config file checksum into the app settings -ynh_store_file_checksum --file="$install_dir/htdocs/conf/conf.php" -chmod 644 "$install_dir/htdocs/conf/conf.php" - -if [ ! -f "$install_dir/documents/install.lock" ]; then - echo 'This is a lock file to prevent use of install pages (set with permission 440)' > "$install_dir/documents/install.lock" - chown "$app:$app" "$install_dir/documents/install.lock" - 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 IN DATABASE #================================================= @@ -113,10 +92,48 @@ ynh_mysql_connect_as --user="$db_name" --password="$db_pwd" --database="$db_name # Populate the database with YNH users. ynh_mysql_connect_as --user="$db_name" --password="$db_pwd" --database="$db_name" < ../conf/sql/ldap_user.sql -if "php$phpversion" "$install_dir/scripts/user/sync_users_ldap2dolibarr.php" commitiferror --server=localhost -y; then - ynh_print_warn --message="LDAP user update ended with error" +if php$phpversion $install_dir/scripts/user/sync_users_ldap2dolibarr.php commitiferror --server=localhost -y; then + ynh_print_info --message="LDAP user update ok" +else + ynh_print_info --message="LDAP user update ended with error" fi +#================================================= +# MODIFY A CONFIG FILE +#================================================= +ynh_script_progression --message="configuring config file" --weight=1 + +# Setup HTTP auth in conf +ynh_replace_string --match_string="dolibarr_main_authentication='dolibarr'" --replace_string="dolibarr_main_authentication='http'" --target_file="$install_dir/htdocs/conf/conf.php" + +#================================================= +# STORE THE CONFIG FILE CHECKSUM +#================================================= + +# Calculate and store the config file checksum into the app settings +ynh_store_file_checksum --file="$install_dir/htdocs/conf/conf.php" + +#================================================= +# SECURE FILES AND DIRECTORIES +#================================================= +#REMOVEME? ynh_script_progression --message="Configuring permissions..." --weight=1 + +# Set permissions on app files +if [ ! -f "$data_dir/install.lock" ]; then + echo 'This is a lock file to prevent use of install pages (set with permission 440)' > "$data_dir/install.lock" + chown $app:$app "$data_dir/install.lock" + chmod 440 "$data_dir/install.lock" +fi + +chmod 750 "$install_dir" +chmod -R o-rwx "$install_dir" +chown -R $app:www-data "$install_dir" + +chmod 644 "$install_dir/htdocs/conf/conf.php" +mkdir -p "$data_dir" +chown -R $app: "$data_dir" +chmod go-w $data_dir + #================================================= # END OF SCRIPT #=================================================