mirror of
https://github.com/YunoHost-Apps/lufi_ynh.git
synced 2024-09-03 19:36:28 +02:00
Remove old sqlite db
This commit is contained in:
parent
b3830cacb9
commit
34a10cbbc2
5 changed files with 51 additions and 76 deletions
|
@ -141,12 +141,16 @@ else
|
|||
fi
|
||||
ynh_store_file_checksum --file="$config"
|
||||
|
||||
chmod 600 $final_path/lufi.conf
|
||||
chown $app:$app $final_path/lufi.conf
|
||||
|
||||
#=================================================
|
||||
# UPDATE SSOWAT
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reconfigure SSOwat"
|
||||
ynh_script_progression --message="Reconfiguring permissions..."
|
||||
|
||||
ynh_permission_update --permission="main" --add="visitors"
|
||||
|
||||
ynh_app_setting_set $app unprotected_uris "/"
|
||||
if [ $is_public -eq 0 ]
|
||||
then
|
||||
if [ "$path_url" == "/" ]; then
|
||||
|
|
|
@ -75,6 +75,14 @@ ynh_script_progression --message="Installing dependencies..."
|
|||
|
||||
ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
|
||||
|
||||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring system user..."
|
||||
|
||||
# Create a system user
|
||||
ynh_system_user_create --username=$app
|
||||
|
||||
#=================================================
|
||||
# CREATE A POSTGRESQL DATABASE
|
||||
#=================================================
|
||||
|
@ -105,14 +113,6 @@ ynh_script_progression --message="Configuring NGINX web server..."
|
|||
# Create a dedicated NGINX config
|
||||
ynh_add_nginx_config max_file_size
|
||||
|
||||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring system user..."
|
||||
|
||||
# Create a system user
|
||||
ynh_system_user_create --username=$app
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC SETUP
|
||||
#=================================================
|
||||
|
@ -143,6 +143,9 @@ fi
|
|||
|
||||
ynh_store_file_checksum --file="$config"
|
||||
|
||||
chmod 600 $final_path/lufi.conf
|
||||
chown $app:$app $final_path/lufi.conf
|
||||
|
||||
#=================================================
|
||||
# INSTALL LUFI
|
||||
#=================================================
|
||||
|
@ -157,9 +160,6 @@ popd
|
|||
#=================================================
|
||||
ynh_script_progression --message="Setuping a cron..."
|
||||
|
||||
# cp ../conf/cron_lufi /etc/cron.d/$app
|
||||
# ynh_replace_string --match_string="__FINALPATH__" --replace_string="$final_path/" --target_file="/etc/cron.d/$app"
|
||||
# ynh_replace_string --match_string="__USER__" --replace_string="$app" --target_file="/etc/cron.d/$app"
|
||||
ynh_add_config --template="../conf/cron_lufi" --destination="/etc/cron.d/$app"
|
||||
chmod +x $final_path/script/lufi
|
||||
|
||||
|
|
|
@ -83,16 +83,6 @@ ynh_script_progression --message="Removing logrotate configuration..."
|
|||
# Remove the app-specific logrotate config
|
||||
ynh_remove_logrotate
|
||||
|
||||
#=================================================
|
||||
# CLOSE A PORT
|
||||
#=================================================
|
||||
|
||||
if yunohost firewall list | grep -q "\- $port$"
|
||||
then
|
||||
ynh_script_progression --message="Closing port $port..."
|
||||
ynh_exec_warn_less yunohost firewall disallow TCP $port
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC REMOVE
|
||||
#=================================================
|
||||
|
|
|
@ -53,13 +53,6 @@ ynh_script_progression --message="Restoring NGINX configuration..."
|
|||
|
||||
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE APP MAIN DIR
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the app main directory..."
|
||||
|
||||
ynh_restore_file --origin_path="$final_path"
|
||||
|
||||
#=================================================
|
||||
# RECREATE THE DEDICATED USER
|
||||
#=================================================
|
||||
|
@ -68,6 +61,13 @@ ynh_script_progression --message="Recreating the dedicated system user..."
|
|||
# Create the dedicated user (if not existing)
|
||||
ynh_system_user_create --username=$app
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE APP MAIN DIR
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the app main directory..."
|
||||
|
||||
ynh_restore_file --origin_path="$final_path"
|
||||
|
||||
#=================================================
|
||||
# RESTORE USER RIGHTS
|
||||
#=================================================
|
||||
|
|
|
@ -39,30 +39,28 @@ upgrade_type=$(ynh_check_app_version_changed)
|
|||
#=================================================
|
||||
ynh_script_progression --message="Ensuring downward compatibility..."
|
||||
|
||||
# If db_name doesn't exist, create it
|
||||
if [ -z "$db_name" ]; then
|
||||
db_name=$(ynh_sanitize_dbid --db_name=$app)
|
||||
ynh_app_setting_set --app=$app --key=db_name --value=$db_name
|
||||
fi
|
||||
|
||||
# If final_path doesn't exist, create it
|
||||
if [ -z "$final_path" ]; then
|
||||
final_path=/var/www/$app
|
||||
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
|
||||
fi
|
||||
|
||||
if [ -z "$db_pwd" ]; then
|
||||
# Need to install new dependencies before creating the new database
|
||||
need_migration_from_sqlite_to_psql=1
|
||||
else
|
||||
need_migration_from_sqlite_to_psql=0
|
||||
fi
|
||||
|
||||
if [ -z "$max_file_size" ]; then
|
||||
max_file_size=100 # 100 Mo
|
||||
ynh_app_setting_set --app=$app --key=max_file_size --value=$max_file_size
|
||||
fi
|
||||
|
||||
# Make app public if necessary
|
||||
if [ $is_public -eq 1 ]
|
||||
then
|
||||
# Everyone can access the app.
|
||||
# The "main" permission is automatically created before the install script.
|
||||
ynh_permission_update --permission="main" --add="visitors"
|
||||
# Cleaning legacy permissions
|
||||
if ynh_legacy_permissions_exists; then
|
||||
ynh_legacy_permissions_delete_all
|
||||
|
||||
ynh_app_setting_delete --app=$app --key=is_public
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
|
@ -87,7 +85,15 @@ ynh_abort_if_errors
|
|||
#=================================================
|
||||
ynh_script_progression --message="Stopping a systemd service..."
|
||||
|
||||
ynh_systemd_action --service_name=$app --action="stop" --log_path="$final_path/log/production.log"
|
||||
ynh_systemd_action --service_name=$app --action=stop --log_path="$final_path/log/production.log"
|
||||
|
||||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Making sure dedicated system user exists..."
|
||||
|
||||
# Create a dedicated user (if not existing)
|
||||
ynh_system_user_create --username=$app
|
||||
|
||||
#=================================================
|
||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||
|
@ -116,36 +122,10 @@ ynh_script_progression --message="Upgrading dependencies..."
|
|||
|
||||
ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
|
||||
|
||||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Making sure dedicated system user exists..."
|
||||
|
||||
# Create a dedicated user (if not existing)
|
||||
ynh_system_user_create --username=$app
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC UPGRADE
|
||||
#=================================================
|
||||
# CREATE A POSTGRESQL DATABASE IF NEEDED
|
||||
#=================================================
|
||||
|
||||
if [ $need_migration_from_sqlite_to_psql -eq 1 ]; then
|
||||
ynh_print_info --message="Creating a PostgreSQL database..."
|
||||
# Create postgresql database
|
||||
ynh_psql_test_if_first_run
|
||||
db_name=$(ynh_sanitize_dbid --db_name=$app)
|
||||
db_user=$db_name
|
||||
ynh_app_setting_set --app=$app --key=db_name --value=$db_name
|
||||
# Initialize database and store postgres password for upgrade
|
||||
ynh_psql_setup_db --db_user=$db_user --db_name=$db_name
|
||||
db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd) # Password created in ynh_psql_setup_db function
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# SETUP LUFI
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring lufi..."
|
||||
ynh_script_progression --message="Configuring Lufi..."
|
||||
|
||||
config=${final_path}/lufi.conf
|
||||
ynh_backup_if_checksum_is_different --file="$config"
|
||||
|
@ -171,6 +151,9 @@ fi
|
|||
|
||||
ynh_store_file_checksum --file="$config"
|
||||
|
||||
chmod 600 $final_path/lufi.conf
|
||||
chown $app:$app $final_path/lufi.conf
|
||||
|
||||
#=================================================
|
||||
# BUILD LUFI
|
||||
#=================================================
|
||||
|
@ -200,9 +183,7 @@ popd
|
|||
#=================================================
|
||||
ynh_script_progression --message="Setuping cron..."
|
||||
|
||||
cp ../conf/cron_lufi /etc/cron.d/$app
|
||||
ynh_replace_string --match_string="__FINALPATH__" --replace_string="$final_path/" --target_file="/etc/cron.d/$app"
|
||||
ynh_replace_string --match_string="__USER__" --replace_string="$app" --target_file="/etc/cron.d/$app"
|
||||
ynh_add_config --template="../conf/cron_lufi" --destination="/etc/cron.d/$app"
|
||||
chmod +x $final_path/script/lufi
|
||||
|
||||
#=================================================
|
||||
|
@ -236,12 +217,12 @@ ynh_add_systemd_config
|
|||
ynh_script_progression --message="Securing files and directories..."
|
||||
|
||||
# Set permissions on app files
|
||||
chown -R $app: $final_path
|
||||
chown -R $app:$app $final_path
|
||||
|
||||
#=================================================
|
||||
# SETUP SSOWAT
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading SSOwat configuration..."
|
||||
ynh_script_progression --message="Upgrading permissions..."
|
||||
|
||||
ynh_permission_update --permission="main" --add="visitors"
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue