1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/ulogger_ynh.git synced 2024-10-01 13:34:45 +02:00
This commit is contained in:
ericgaspar 2021-02-07 11:01:22 +01:00
parent 3959bfe8ac
commit 51d079571c
No known key found for this signature in database
GPG key ID: 574F281483054D44
2 changed files with 34 additions and 36 deletions

View file

@ -50,31 +50,30 @@ admin_pwd=$(openssl passwd -1 -salt xyz $password)
#=================================================
ynh_script_progression --message="Storing installation settings..."
ynh_app_setting_set $app domain $domain
ynh_app_setting_set $app path $path_url
ynh_app_setting_set $app admin $admin
ynh_app_setting_set $app is_public $is_public
ynh_app_setting_set $app language $language
ynh_app_setting_set --app=$app --key=domain --value=$domain
ynh_app_setting_set --app=$app --key=path --value=$path_url
ynh_app_setting_set --app=$app --key=admin --value=$admin
ynh_app_setting_set --app=$app --key=is_public --value=$is_public
ynh_app_setting_set --app=$app --key=language --value=$language
#=================================================
# CREATE A MYSQL DATABASE
#=================================================
ynh_script_progression --message="Creating a MySQL database..."
db_name=$(ynh_sanitize_dbid $app)
ynh_app_setting_set $app db_name $db_name
ynh_mysql_setup_db $db_name $db_name
db_name=$(ynh_sanitize_dbid --db_name=$app)
db_user=$db_name
ynh_app_setting_set --app=$app --key=db_name --value=$db_name
ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_script_progression --message="Setting up source files..."
ynh_app_setting_set $app final_path $final_path
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source "$final_path"
#Copy config.php to the final path
cp -r ../conf/config.php $final_path
ynh_setup_source --dest_dir="$final_path"
#=================================================
# NGINX CONFIGURATION

View file

@ -24,6 +24,12 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
#=================================================
# CHECK VERSION
#=================================================
upgrade_type=$(ynh_check_app_version_changed)
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
@ -77,37 +83,29 @@ ynh_abort_if_errors
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
# Download, check integrity, uncompress and patch the source from app.src
# Create a temporary directory
tmpdir="$(ynh_smart_mktemp 300)"
if [ "$upgrade_type" == "UPGRADE_APP" ]
then
ynh_script_progression --message="Upgrading source files..." --weight=1
# Backup the config file in the temp dir
cp -a "$final_path/config.php" "$tmpdir/config.php"
# Create a temporary directory
tmpdir="$(mktemp -d)"
# Remove the app directory securely
ynh_secure_remove "$final_path"
# Backup the config file in the temp dir
cp -a "$final_path/config.php" "$tmpdir/config.php"
# If final_path doesn't exist, create it
if [ -z $final_path ]; then
final_path=/var/www/$app
ynh_app_setting_set $app final_path $final_path
# Remove the app directory securely
ynh_secure_remove --file="$final_path"
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$final_path"
#copy cofig.php from tmp to final_path
cp -a "$tmpdir/config.php" "$final_path/config.php"
# Remove the tmp directory securely
ynh_secure_remove --file="$tmpdir"
fi
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_script_progression --message="Upgrading source files..."
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source "$final_path"
#copy cofig.php from tmp to final_path
cp -a "$tmpdir/config.php" "$final_path"
#remove tmp dir
ynh_secure_remove "$tmpdir"
#=================================================
# NGINX CONFIGURATION
#=================================================
@ -137,6 +135,7 @@ ynh_add_fpm_config
#=================================================
ynh_backup_if_checksum_is_different "$final_path/conf.php"
# Recalculate and store the config file checksum into the app settings
ynh_store_file_checksum "$final_path/config.php"