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

Merge pull request #42 from grenagit/testing

Add script progression
This commit is contained in:
frju365 2020-05-20 01:48:01 +02:00 committed by GitHub
commit bf5e28ff43
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 58 additions and 58 deletions

View file

@ -23,7 +23,7 @@ ynh_abort_if_errors
#=================================================
# LOAD SETTINGS
#=================================================
ynh_print_info "Loading installation settings..."
ynh_script_progression --message="Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME
@ -36,21 +36,21 @@ db_name=$(ynh_app_setting_get $app db_name)
#=================================================
# BACKUP THE APP MAIN DIR
#=================================================
ynh_print_info "Backing up the main app directory..."
ynh_script_progression --message="Backing up the main app directory..."
ynh_backup "$final_path"
#=================================================
# BACKUP THE NGINX CONFIGURATION
#=================================================
ynh_print_info "Backing up nginx web server configuration..."
ynh_script_progression --message="Backing up nginx web server configuration..."
ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# BACKUP THE POSTGRESQL DATABASE
#=================================================
ynh_print_info "Backing up the PostgreSQL database..."
ynh_script_progression --message="Backing up the PostgreSQL database..."
ynh_psql_dump_db "$db_name" > db.sql
@ -59,14 +59,14 @@ ynh_psql_dump_db "$db_name" > db.sql
#=================================================
# BACKUP LOGROTATE
#=================================================
ynh_print_info "Backing up logrotate configuration..."
ynh_script_progression --message="Backing up logrotate configuration..."
ynh_backup "/etc/logrotate.d/$app"
#=================================================
# BACKUP SYSTEMD
#=================================================
ynh_print_info "Backing up systemd configuration..."
ynh_script_progression --message="Backing up systemd configuration..."
ynh_backup "/etc/systemd/system/$app.service"
@ -74,5 +74,5 @@ ynh_backup "/etc/systemd/system/$app.service"
# END OF SCRIPT
#=================================================
ynh_print_info "Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."
ynh_script_progression --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."

View file

@ -24,7 +24,7 @@ app=$YNH_APP_INSTANCE_NAME
#=================================================
# LOAD SETTINGS
#=================================================
ynh_print_info "Loading installation settings..."
ynh_script_progression --message="Loading installation settings..."
# Needed for helper "ynh_add_nginx_config"
final_path=$(ynh_app_setting_get $app final_path)
@ -69,7 +69,7 @@ fi
#=================================================
# MODIFY URL IN NGINX CONF
#=================================================
ynh_print_info "Updating nginx web server configuration..."
ynh_script_progression --message="Updating nginx web server configuration..."
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
@ -100,7 +100,7 @@ fi
#=================================================
# SETUP LSTU
#=================================================
ynh_print_info "Updating lstu configuration..."
ynh_script_progression --message="Updating lstu configuration..."
domain="$new_domain"
path_url="$new_path"
@ -130,7 +130,7 @@ ynh_store_file_checksum "${final_path}/lstu.conf"
#=================================================
# UPDATE SSOWAT
#=================================================
ynh_print_info "Reconfigure SSOwat"
ynh_script_progression --message="Reconfigure SSOwat"
if [ $is_public -eq 0 ]
then
@ -153,7 +153,7 @@ ynh_systemd_action -n $app -a reload -l "Starting hot deployment for Hypnotoad s
#=================================================
# RELOAD NGINX
#=================================================
ynh_print_info "Reloading nginx web server..."
ynh_script_progression --message="Reloading nginx web server..."
systemctl reload nginx
@ -161,4 +161,4 @@ systemctl reload nginx
# END OF SCRIPT
#=================================================
ynh_print_info "Change of URL completed for $app"
ynh_script_progression --message="Change of URL completed for $app"

View file

@ -36,7 +36,7 @@ app=$YNH_APP_INSTANCE_NAME
#=================================================
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
#=================================================
ynh_print_info "Validating installation parameters..."
ynh_script_progression --message="Validating installation parameters..."
final_path=/var/www/$app
test ! -e "$final_path" || ynh_die "This path already contains a folder"
@ -52,7 +52,7 @@ ynh_webpath_register $app $domain $path_url
#=================================================
# FIND AND OPEN A PORT
#=================================================
ynh_print_info "Configuring firewall..."
ynh_script_progression --message="Configuring firewall..."
# Find a free port
port=$(ynh_find_port 8095)
@ -62,7 +62,7 @@ yunohost firewall allow --no-upnp TCP $port 2>&1
#=================================================
# STORE SETTINGS FROM MANIFEST
#=================================================
ynh_print_info "Storing installation settings..."
ynh_script_progression --message="Storing installation settings..."
ynh_app_setting_set $app domain $domain
ynh_app_setting_set $app is_public $is_public
@ -75,7 +75,7 @@ ynh_app_setting_set $app hashed_password $hashed_password
#=================================================
# INSTALL DEPENDENCIES
#=================================================
ynh_print_info "Installing dependencies..."
ynh_script_progression --message="Installing dependencies..."
ynh_install_app_dependencies build-essential libssl-dev zlib1g-dev libpng-dev libpq-dev memcached postgresql cpanminus
# Install Carton
@ -84,7 +84,7 @@ echo yes | cpanm Carton
#=================================================
# CREATE A POSTGRESQL DATABASE
#=================================================
ynh_print_info "Creating a PostgreSQL database..."
ynh_script_progression --message="Creating a PostgreSQL database..."
# Create postgresql database
ynh_psql_test_if_first_run
@ -98,7 +98,7 @@ db_pwd=$(ynh_app_setting_get $app psqlpwd) # Password created in ynh_psql_setup_
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_print_info "Setting up source files..."
ynh_script_progression --message="Setting up source files..."
ynh_app_setting_set $app final_path $final_path
# Download, check integrity, uncompress and patch the source from app.src
@ -107,7 +107,7 @@ ynh_setup_source "$final_path"
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_print_info "Configuring nginx web server..."
ynh_script_progression --message="Configuring nginx web server..."
# Create a dedicated nginx config
ynh_add_nginx_config
@ -115,7 +115,7 @@ ynh_add_nginx_config
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_print_info "Configuring system user..."
ynh_script_progression --message="Configuring system user..."
# Create a system user
ynh_system_user_create $app
@ -123,7 +123,7 @@ ynh_system_user_create $app
#=================================================
## Copy and fix variable into lstu config
#=================================================
ynh_print_info "Configuring lstu..."
ynh_script_progression --message="Configuring lstu..."
cp ../conf/lstu.conf.template "${final_path}/lstu.conf"
ynh_replace_string "__DOMAIN__" "$domain" "${final_path}/lstu.conf"
@ -149,7 +149,7 @@ ynh_store_file_checksum "${final_path}/lstu.conf"
#=================================================
# SETUP SYSTEMD
#=================================================
ynh_print_info "Configuring a systemd service..."
ynh_script_progression --message="Configuring a systemd service..."
# Create a dedicated systemd config
ynh_add_systemd_config
@ -157,7 +157,7 @@ ynh_add_systemd_config
#=================================================
# Install lstu's dependencies via carton
#=================================================
ynh_print_info "Installing lstu..."
ynh_script_progression --message="Installing lstu..."
pushd $final_path
carton install --deployment --without=sqlite --without=mysql
@ -166,7 +166,7 @@ popd
#=================================================
# SETUP LOGROTATE
#=================================================
ynh_print_info "Configuring log rotation..."
ynh_script_progression --message="Configuring log rotation..."
# Use logrotate to manage application logfile(s)
ynh_use_logrotate
@ -180,7 +180,7 @@ yunohost service add $app --log "/var/log/$app.log" --log "/var/www/$app/log/pro
#=================================================
# SETUP SSOWAT
#=================================================
ynh_print_info "Configuring SSOwat..."
ynh_script_progression --message="Configuring SSOwat..."
ynh_app_setting_set $app unprotected_uris "/"
if [ $is_public -eq 0 ]
@ -211,7 +211,7 @@ ynh_systemd_action -n $app -a start -l "Server available at" -p "systemd"
#=================================================
# RELOAD NGINX
#=================================================
ynh_print_info "Reloading nginx web server..."
ynh_script_progression --message="Reloading nginx web server..."
# Reload Nginx
systemctl reload nginx
@ -221,4 +221,4 @@ yunohost app ssowatconf
# END OF SCRIPT
#=================================================
ynh_print_info "Installation of $app completed"
ynh_script_progression --message="Installation of $app completed"

View file

@ -12,7 +12,7 @@ source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
ynh_print_info "Loading installation settings..."
ynh_script_progression --message="Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME
@ -38,7 +38,7 @@ fi
#=================================================
# STOP AND REMOVE SERVICE
#=================================================
ynh_print_info "Stopping and removing the systemd service"
ynh_script_progression --message="Stopping and removing the systemd service"
# Remove the dedicated systemd config
ynh_remove_systemd_config
@ -46,7 +46,7 @@ ynh_remove_systemd_config
#=================================================
# REMOVE APP MAIN DIR
#=================================================
ynh_print_info "Removing app main directory"
ynh_script_progression --message="Removing app main directory"
# Remove the app directory securely
ynh_secure_remove "$final_path"
@ -54,7 +54,7 @@ ynh_secure_remove "$final_path"
#=================================================
# REMOVE NGINX CONFIGURATION
#=================================================
ynh_print_info "Removing nginx web server configuration"
ynh_script_progression --message="Removing nginx web server configuration"
# Remove the dedicated nginx config
ynh_remove_nginx_config
@ -68,7 +68,7 @@ ynh_secure_remove "/var/log/$app.log"
#=================================================
# REMOVE LOGROTATE CONFIGURATION
#=================================================
ynh_print_info "Removing logrotate configuration"
ynh_script_progression --message="Removing logrotate configuration"
# Remove the app-specific logrotate config
ynh_remove_logrotate
@ -86,7 +86,7 @@ fi
#=================================================
# REMOVE DEPENDENCIES
#=================================================
ynh_print_info "Removing dependencies"
ynh_script_progression --message="Removing dependencies"
# Remove metapackage and its dependencies
ynh_remove_app_dependencies
@ -94,7 +94,7 @@ ynh_remove_app_dependencies
#=================================================
# REMOVE THE POSTGRESQL DATABASE
#=================================================
ynh_print_info "Removing the PostgreSQL database"
ynh_script_progression --message="Removing the PostgreSQL database"
ynh_psql_remove_db $db_name $db_user
@ -103,7 +103,7 @@ ynh_psql_remove_db $db_name $db_user
#=================================================
# REMOVE DEDICATED USER
#=================================================
ynh_print_info "Removing the dedicated system user"
ynh_script_progression --message="Removing the dedicated system user"
# Delete a system user
ynh_system_user_delete $app
@ -112,4 +112,4 @@ ynh_system_user_delete $app
# END OF SCRIPT
#=================================================
ynh_print_info "Removal of $app completed"
ynh_script_progression --message="Removal of $app completed"

View file

@ -24,7 +24,7 @@ ynh_abort_if_errors
#=================================================
# LOAD SETTINGS
#=================================================
ynh_print_info "Loading settings..."
ynh_script_progression --message="Loading settings..."
app=$YNH_APP_INSTANCE_NAME
@ -36,7 +36,7 @@ db_name=$(ynh_app_setting_get $app db_name)
#=================================================
# CHECK IF THE APP CAN BE RESTORED
#=================================================
ynh_print_info "Validating restoration parameters..."
ynh_script_progression --message="Validating restoration parameters..."
ynh_webpath_available $domain $path_url \
|| ynh_die "Path not available: ${domain}${path_url}"
@ -48,7 +48,7 @@ test ! -d $final_path \
#=================================================
# REINSTALL DEPENDENCIES
#=================================================
ynh_print_info "Reinstalling dependencies..."
ynh_script_progression --message="Reinstalling dependencies..."
# Define and install dependencies
ynh_install_app_dependencies build-essential libssl-dev zlib1g-dev libpng-dev libpq-dev memcached postgresql cpanminus
@ -64,14 +64,14 @@ ynh_restore_file "/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# RESTORE THE APP MAIN DIR
#=================================================
ynh_print_info "Restoring the app main directory..."
ynh_script_progression --message="Restoring the app main directory..."
ynh_restore_file "$final_path"
#=================================================
# RECREATE THE DEDICATED USER
#=================================================
ynh_print_info "Recreating the dedicated system user..."
ynh_script_progression --message="Recreating the dedicated system user..."
# Create the dedicated user (if not existing)
ynh_system_user_create $app
@ -79,7 +79,7 @@ ynh_system_user_create $app
#=================================================
# RESTORE THE POSTGRESQL DATABASE
#=================================================
ynh_print_info "Restoring the PostregSQL database..."
ynh_script_progression --message="Restoring the PostregSQL database..."
db_pwd=$(ynh_app_setting_get $app psqlpwd)
ynh_psql_test_if_first_run
@ -98,7 +98,7 @@ chown -R www-data $final_path
#=================================================
# RESTORE SYSTEMD
#=================================================
ynh_print_info "Restoring the systemd configuration..."
ynh_script_progression --message="Restoring the systemd configuration..."
ynh_restore_file "/etc/systemd/system/$app.service"
systemctl enable $app.service
@ -121,7 +121,7 @@ ynh_restore_file "/etc/logrotate.d/$app"
#=================================================
# RELOAD NGINX
#=================================================
ynh_print_info "Reloading nginx web server..."
ynh_script_progression --message="Reloading nginx web server..."
systemctl reload nginx
yunohost app ssowatconf
@ -130,4 +130,4 @@ yunohost app ssowatconf
# END OF SCRIPT
#=================================================
ynh_print_info "Restoration completed for $app"
ynh_script_progression --message="Restoration completed for $app"

View file

@ -12,7 +12,7 @@ source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
ynh_print_info "Loading installation settings..."
ynh_script_progression --message="Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME
@ -31,7 +31,7 @@ hashed_password=$(ynh_app_setting_get $app hashed_password)
#=================================================
# FIX OLD THINGS
#=================================================
ynh_print_info "Ensuring downward compatibility..."
ynh_script_progression --message="Ensuring downward compatibility..."
if [ "$is_public" = "Yes" ]; then
ynh_app_setting_set $app is_public 1 # Fixe is_public en booléen
@ -83,7 +83,7 @@ fi
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
ynh_print_info "Backing up the app before upgrading (may take a while)..."
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..."
# Backup the current version of the app
ynh_backup_before_upgrade
@ -100,7 +100,7 @@ ynh_abort_if_errors
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_print_info "Upgrading source files..."
ynh_script_progression --message="Upgrading source files..."
ynh_install_app_dependencies build-essential libssl-dev zlib1g-dev libpng-dev libpq-dev memcached postgresql cpanminus
@ -109,7 +109,7 @@ ynh_setup_source "$final_path"
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_print_info "Upgrading nginx web server configuration..."
ynh_script_progression --message="Upgrading nginx web server configuration..."
# Create a dedicated nginx config
ynh_add_nginx_config
@ -117,7 +117,7 @@ ynh_add_nginx_config
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_print_info "Making sure dedicated system user exists..."
ynh_script_progression --message="Making sure dedicated system user exists..."
# Create a dedicated user (if not existing)
ynh_system_user_create $app
@ -127,7 +127,7 @@ ynh_system_user_create $app
#=================================================
# SETUP LSTU
#=================================================
ynh_print_info "Upgrading lstu configuration..."
ynh_script_progression --message="Upgrading lstu configuration..."
ynh_backup_if_checksum_is_different "$final_path/lstu.conf"
cp ../conf/lstu.conf.template "${final_path}/lstu.conf"
@ -158,7 +158,7 @@ chown -R www-data $final_path
#=================================================
# SETUP SYSTEMD
#=================================================
ynh_print_info "Upgrading systemd configuration..."
ynh_script_progression --message="Upgrading systemd configuration..."
# Create a dedicated systemd config
ynh_add_systemd_config
@ -174,7 +174,7 @@ popd
#=================================================
# SETUP LOGROTATE
#=================================================
ynh_print_info "Upgrading logrotate configuration..."
ynh_script_progression --message="Upgrading logrotate configuration..."
# Use logrotate to manage app-specific logfile(s)
ynh_use_logrotate --non-append
@ -194,7 +194,7 @@ ynh_systemd_action -n $app -a reload -l "Reloaded Shortened URLs service." -p "s
#=================================================
# SETUP SSOWAT
#=================================================
ynh_print_info "Upgrading SSOwat configuration..."
ynh_script_progression --message="Upgrading SSOwat configuration..."
ynh_app_setting_set $app unprotected_uris "/"
if [ $is_public -eq 0 ]
@ -212,7 +212,7 @@ fi
#=================================================
# RELOAD NGINX
#=================================================
ynh_print_info "Reloading nginx web server..."
ynh_script_progression --message="Reloading nginx web server..."
systemctl reload nginx
yunohost app ssowatconf
@ -221,4 +221,4 @@ yunohost app ssowatconf
# END OF SCRIPT
#=================================================
ynh_print_info "Upgrade of $app completed"
ynh_script_progression --message="Upgrade of $app completed"