mirror of
https://github.com/YunoHost-Apps/teampass_ynh.git
synced 2024-09-03 20:26:37 +02:00
Simplification
This commit is contained in:
parent
1d775411a8
commit
c9e7571703
3 changed files with 17 additions and 27 deletions
|
@ -12,7 +12,7 @@ $port = 3306;
|
|||
$encoding = "utf8";
|
||||
|
||||
@date_default_timezone_set($_SESSION['settings']['timezone']);
|
||||
@define('SECUREPATH', '__PATH_SK_FILE__');
|
||||
if (file_exists("__PATH_SK_FILE__sk.php")) {
|
||||
require_once "__PATH_SK_FILE__sk.php";
|
||||
@define('SECUREPATH', '/etc/__APP__/');
|
||||
if (file_exists("/etc/__APP__/sk.php")) {
|
||||
require_once "/etc/__APP__/sk.php";
|
||||
}
|
||||
|
|
|
@ -158,9 +158,6 @@ echo ");" >> $tp_config_file
|
|||
#=================================================
|
||||
ynh_script_progression --message="Adding a configuration file..."
|
||||
|
||||
path_sk_file=/etc/$app/
|
||||
mkdir $path_sk_file
|
||||
|
||||
ynh_add_config --template="../conf/settings.php" --destination="$final_path/includes/config/settings.php"
|
||||
|
||||
#=================================================
|
||||
|
@ -169,15 +166,15 @@ ynh_add_config --template="../conf/settings.php" --destination="$final_path/incl
|
|||
ynh_script_progression --message="Creating a saltkey..."
|
||||
|
||||
saltkey=$(ynh_string_random --length=32)
|
||||
ynh_replace_string "__SALTKEY__" "$saltkey" ../conf/sk.php
|
||||
ynh_add_config --template="../conf/sk.php" --destination="$path_sk_file/sk.php"
|
||||
mkdir /etc/$app/
|
||||
ynh_add_config --template="../conf/sk.php" --destination="/etc/$app/sk.php"
|
||||
chown -R $app /etc/$app/
|
||||
chmod 750 /etc/$app/
|
||||
|
||||
#=================================================
|
||||
# COPY THE FILES
|
||||
# CREATE CSRFP
|
||||
#=================================================
|
||||
|
||||
chown -R $app $path_sk_file
|
||||
chmod 750 $path_sk_file
|
||||
ynh_script_progression --message="Creating a csrfp..."
|
||||
|
||||
cp $final_path/includes/libraries/csrfp/libs/csrfp.config.sample.php $final_path/includes/libraries/csrfp/libs/csrfp.config.php # Créer le fichier de config de csrfp
|
||||
ynh_replace_string "CSRFP_TOKEN\" => \"" "&$(head -n40 /dev/urandom | tr -c -d 'a-f0-9' | head -c50)" $final_path/includes/libraries/csrfp/libs/csrfp.config.php # Renseigne un token, valide en hexadécimal
|
||||
|
@ -213,7 +210,6 @@ ynh_replace_string "jsUrl\" => \"" "&includes/libraries/csrfp/js/csrfprotector.j
|
|||
ynh_script_progression --message="Creating a cron file for an automatic backup..."
|
||||
|
||||
echo "0 0 * * 0 $app cd $final_path/backups && php script.backup.php" > /etc/cron.d/$app
|
||||
# Add also a clean of old backup.
|
||||
|
||||
#=================================================
|
||||
# SECURING FILES AND DIRECTORIES
|
||||
|
|
|
@ -87,8 +87,7 @@ then
|
|||
|
||||
# Download, check integrity, uncompress and patch the source from app.src
|
||||
ynh_setup_source --dest_dir="$final_path"
|
||||
# Delete the install directory.
|
||||
# Keep it for the manual upgrade process...
|
||||
# Do not delete the install directory. Keep it for the manual upgrade process...
|
||||
# ynh_secure_remove "$final_path/install"
|
||||
fi
|
||||
|
||||
|
@ -103,6 +102,7 @@ ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=1
|
|||
|
||||
# Create a dedicated PHP-FPM config
|
||||
ynh_add_fpm_config
|
||||
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
||||
|
||||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
|
@ -133,18 +133,13 @@ do
|
|||
done <<< "$(ynh_mysql_execute_as_root "SELECT intitule, valeur FROM teampass_misc" $app)"
|
||||
echo ");" >> $tp_config_file
|
||||
|
||||
#=================================================
|
||||
# CREATE A CRON FILE FOR AUTOMATIC BACKUP
|
||||
#=================================================
|
||||
ynh_script_progression --message="Creating a cron file for an automatic backup..."
|
||||
|
||||
echo "0 0 * * 0 $app cd $final_path/backups && php script.backup.php" > /etc/cron.d/$app
|
||||
|
||||
#=================================================
|
||||
# UPDATE A CONFIG FILE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Updating a configuration file..."
|
||||
|
||||
ynh_add_config --template="../conf/settings.php" --destination="$final_path/includes/config/settings.php"
|
||||
|
||||
if [ "$upgrade_type" == "UPGRADE_APP" ]
|
||||
then
|
||||
# Move settings.php from old teampass version
|
||||
|
@ -173,12 +168,11 @@ then
|
|||
fi
|
||||
|
||||
#=================================================
|
||||
# UPDATE SETTINGS.PHP
|
||||
# CREATE A CRON FILE FOR AN AUTOMATIC BACKUP
|
||||
#=================================================
|
||||
ynh_script_progression --message="Creating a cron file for an automatic backup..."
|
||||
|
||||
path_sk_file="/etc/$app/"
|
||||
|
||||
ynh_add_config --template="../conf/settings.php" --destination="$final_path/includes/config/settings.php"
|
||||
echo "0 0 * * 0 $app cd $final_path/backups && php script.backup.php" > /etc/cron.d/$app
|
||||
|
||||
#=================================================
|
||||
# SECURING FILES AND DIRECTORIES
|
||||
|
|
Loading…
Add table
Reference in a new issue