1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/lufi_ynh.git synced 2024-09-03 19:36:28 +02:00

Revert "Fix upgrade from the old version"

This reverts commit 25d73a472c.
This commit is contained in:
Kayou 2019-03-26 23:14:43 +01:00
parent 122686e78f
commit 9cc43c0f5a
No known key found for this signature in database
GPG key ID: 823A2CBE071D3126
7 changed files with 11 additions and 43 deletions

View file

@ -117,7 +117,7 @@
# choose what database you want to use
# valid choices are sqlite, postgresql and mysql (all lowercase)
# optional, default is sqlite
dbtype => '__DB_MANAGER__',
dbtype => 'postgresql',
# SQLite ONLY - only used if dbtype is set to sqlite
# define a path to the SQLite database

View file

@ -30,7 +30,6 @@ app=$YNH_APP_INSTANCE_NAME
final_path=$(ynh_app_setting_get $app final_path)
domain=$(ynh_app_setting_get $app domain)
db_name=$(ynh_app_setting_get $app db_name)
db_manager=$(ynh_app_setting_get $app db_manager)
#=================================================
# STANDARD BACKUP STEPS
@ -53,9 +52,7 @@ ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
ynh_print_info "Backing up the PostgreSQL database..."
if [ $db_manager = "postgresql" ]; then
ynh_psql_dump_db "$db_name" > db.sql
fi
ynh_psql_dump_db "$db_name" > db.sql
#=================================================
# SPECIFIC BACKUP

View file

@ -37,7 +37,6 @@ db_pwd=$(ynh_app_setting_get $app psqlpwd)
db_user=$db_name
secret=$(ynh_app_setting_get $app secret)
max_file_size=$(ynh_app_setting_get $app max_file_size)
db_manager=$(ynh_app_setting_get $app db_manager)
#=================================================
# CHECK THE SYNTAX OF THE PATHS
@ -113,7 +112,6 @@ ynh_replace_string "__DB_NAME__" "$db_name" "${final_path}/lufi.conf"
ynh_replace_string "__DB_USER__" "$db_user" "${final_path}/lufi.conf"
ynh_replace_string "__DB_PWD__" "$db_pwd" "${final_path}/lufi.conf"
ynh_replace_string "__MAX_FILE_SIZE__" "$max_file_size" "${final_path}/lufi.conf"
ynh_replace_string "__DB_MANAGER__" "$db_manager" "${final_path}/lufi.conf"
if [ $max_file_size -eq 0 ]; then # Comment the limitation line if no limit
ynh_replace_string "max_file_size" "#max_file_size" "${final_path}/lufi.conf"
fi

View file

@ -48,9 +48,6 @@ if ! [[ $max_file_size =~ "^[\-0-9]+$" ]] && [ $max_file_size -lt 0 ]; then
ynh_die "Max file must be a number positive or zero"
fi
# Use postgresql by default
db_manager="postgresql"
# Check web path availability
ynh_webpath_available $domain $path_url
# Register (book) web path
@ -76,7 +73,6 @@ ynh_app_setting_set $app is_public $is_public
ynh_app_setting_set $app port $port
ynh_app_setting_set $app path $path_url
ynh_app_setting_set $app max_file_size $max_file_size
ynh_app_setting_set $app db_manager $db_manager
#=================================================
# STANDARD MODIFICATIONS
@ -141,7 +137,6 @@ ynh_replace_string "__DB_NAME__" "$db_name" "${final_path}/lufi.conf"
ynh_replace_string "__DB_USER__" "$db_user" "${final_path}/lufi.conf"
ynh_replace_string "__DB_PWD__" "$db_pwd" "${final_path}/lufi.conf"
ynh_replace_string "__MAX_FILE_SIZE__" "$max_file_size" "${final_path}/lufi.conf"
ynh_replace_string "__DB_MANAGER__" "$db_manager" "${final_path}/lufi.conf"
if [ $max_file_size -eq 0 ]; then # Comment the limitation line if no limit
ynh_replace_string "max_file_size" "#max_file_size" "${final_path}/lufi.conf"
fi

View file

@ -63,7 +63,7 @@ ynh_remove_nginx_config
# DELETE LOG
#=================================================
ynh_secure_remove "/var/log/$app"
ynh_secure_remove "/var/log/$app/"
#=================================================
# REMOVE LOGROTATE CONFIGURATION

View file

@ -32,7 +32,6 @@ domain=$(ynh_app_setting_get $app domain)
path_url=$(ynh_app_setting_get $app path)
final_path=$(ynh_app_setting_get $app final_path)
db_name=$(ynh_app_setting_get $app db_name)
db_manager=$(ynh_app_setting_get $app db_manager)
#=================================================
# CHECK IF THE APP CAN BE RESTORED
@ -80,15 +79,12 @@ ynh_system_user_create $app
#=================================================
# RESTORE THE POSTGRESQL DATABASE
#=================================================
ynh_print_info "Restoring the PostregSQL database..."
if [ $db_manager = "postgresql" ]; then
ynh_print_info "Restoring the PostregSQL database..."
db_pwd=$(ynh_app_setting_get $app psqlpwd)
ynh_psql_test_if_first_run
ynh_psql_setup_db $db_name $db_name $db_pwd
ynh_psql_connect_as $db_name $db_pwd $db_name < ./db.sql
fi
db_pwd=$(ynh_app_setting_get $app psqlpwd)
ynh_psql_test_if_first_run
ynh_psql_setup_db $db_name $db_name $db_pwd
ynh_psql_connect_as $db_name $db_pwd $db_name < ./db.sql
#=================================================
# RESTORE USER RIGHTS

View file

@ -26,7 +26,6 @@ db_name=$(ynh_app_setting_get $app db_name)
db_user=$db_name
db_pwd=$(ynh_app_setting_get $app psqlpwd)
max_file_size=$(ynh_app_setting_get $app max_file_size)
db_manager=$(ynh_app_setting_get $app db_manager)
#=================================================
# FIX OLD THINGS
@ -60,11 +59,6 @@ if [ -z "$max_file_size" ]; then
max_file_size=100 # 100 Mo
fi
# If db_manager is empty, use sqlite for a backward compatibility
if [ -z "$db_manager" ]; then
db_manager="sqlite"
fi
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
@ -122,7 +116,6 @@ ynh_replace_string "__DB_NAME__" "$db_name" "${final_path}/lufi.conf"
ynh_replace_string "__DB_USER__" "$db_user" "${final_path}/lufi.conf"
ynh_replace_string "__DB_PWD__" "$db_pwd" "${final_path}/lufi.conf"
ynh_replace_string "__MAX_FILE_SIZE__" "$max_file_size" "${final_path}/lufi.conf"
ynh_replace_string "__DB_MANAGER__" "$db_manager" "${final_path}/lufi.conf"
if [ $max_file_size -eq 0 ]; then # Comment the limitation line if no limit
ynh_replace_string "max_file_size" "#max_file_size" "${final_path}/lufi.conf"
fi
@ -148,7 +141,7 @@ chmod +x $final_path/script/lufi
# SECURING FILES AND DIRECTORIES
#=================================================
chown -R $app: "$final_path"
chown -R $app:$app "$final_path"
#=================================================
# SETUP SYSTEMD
@ -163,11 +156,7 @@ ynh_add_systemd_config
#=================================================
pushd $final_path
if [ $db_manager = "postgresql" ]; then
carton install --deployment --without=sqlite --without=mysql
else
carton install --deployment --without=postgresql --without=mysql
fi
carton install --deployment --without=sqlite --without=mysql
popd
#=================================================
@ -182,21 +171,14 @@ ynh_use_logrotate --non-append
# ADVERTISE SERVICE IN ADMIN PANEL
#=================================================
# if /var/log/$app/production.log is a symbolic link, then move it to $final_path/log/production.log
if [ ! -L "/var/log/$app/production.log" ]
then
mv "/var/log/$app/production.log" "$final_path/log/production.log"
chown -R $app: "$final_path/log/production.log"
fi
yunohost service add $app --log "$final_path/log/production.log"
#=================================================
# RESTART LUFI
#=================================================
ynh_systemd_action -n $app -a reload -l "Creating process id file" -p "$final_path/log/production.log"
ln -sf "$final_path/log/production.log" "/var/log/$app/production.log"
ynh_systemd_action -n $app -a restart -l "Creating process id file" -p "$final_path/log/production.log"
#=================================================
# SETUP SSOWAT