mirror of
https://github.com/YunoHost-Apps/shellinabox_ynh.git
synced 2024-09-03 20:26:12 +02:00
Add progression with ynh_print_info
This commit is contained in:
parent
91d30d5e87
commit
6bacbf3f0b
5 changed files with 47 additions and 0 deletions
|
@ -18,6 +18,7 @@ ynh_abort_if_errors
|
||||||
#=================================================
|
#=================================================
|
||||||
# LOAD SETTINGS
|
# LOAD SETTINGS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Loading installation settings..."
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
|
@ -28,6 +29,7 @@ domain=$(ynh_app_setting_get $app domain)
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP THE APP MAIN DIR
|
# BACKUP THE APP MAIN DIR
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Backing up the main app directory..."
|
||||||
|
|
||||||
ynh_backup "/etc/shellinabox"
|
ynh_backup "/etc/shellinabox"
|
||||||
ynh_backup "/etc/default/shellinabox"
|
ynh_backup "/etc/default/shellinabox"
|
||||||
|
@ -35,5 +37,12 @@ ynh_backup "/etc/default/shellinabox"
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP THE NGINX CONFIGURATION
|
# BACKUP THE NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Backing up nginx web server configuration..."
|
||||||
|
|
||||||
ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
|
ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# END OF SCRIPT
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
ynh_print_info "Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."
|
||||||
|
|
|
@ -27,6 +27,7 @@ app=$YNH_APP_INSTANCE_NAME
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
|
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Validating installation parameters..."
|
||||||
|
|
||||||
# Normalize the url path syntax
|
# Normalize the url path syntax
|
||||||
path_url=$(ynh_normalize_url_path $path_url)
|
path_url=$(ynh_normalize_url_path $path_url)
|
||||||
|
@ -37,6 +38,7 @@ ynh_webpath_register $app $domain $path_url
|
||||||
#=================================================
|
#=================================================
|
||||||
# STORE SETTINGS FROM MANIFEST
|
# STORE SETTINGS FROM MANIFEST
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Storing installation settings..."
|
||||||
|
|
||||||
ynh_app_setting_set $app domain $domain
|
ynh_app_setting_set $app domain $domain
|
||||||
ynh_app_setting_set $app path $path_url
|
ynh_app_setting_set $app path $path_url
|
||||||
|
@ -46,6 +48,7 @@ ynh_app_setting_set $app path $path_url
|
||||||
#=================================================
|
#=================================================
|
||||||
# FIND AND OPEN A PORT
|
# FIND AND OPEN A PORT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Looking for a free port..."
|
||||||
|
|
||||||
# Find a free port
|
# Find a free port
|
||||||
port=$(ynh_find_port 4200)
|
port=$(ynh_find_port 4200)
|
||||||
|
@ -54,6 +57,7 @@ ynh_app_setting_set $app port $port
|
||||||
#=================================================
|
#=================================================
|
||||||
# INSTALL SHELLINABOX
|
# INSTALL SHELLINABOX
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Installing shellinabox..."
|
||||||
|
|
||||||
ynh_package_update
|
ynh_package_update
|
||||||
ynh_package_install shellinabox
|
ynh_package_install shellinabox
|
||||||
|
@ -61,6 +65,7 @@ ynh_package_install shellinabox
|
||||||
#=================================================
|
#=================================================
|
||||||
# NGINX CONFIGURATION
|
# NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Configuring nginx web server..."
|
||||||
|
|
||||||
# Create a dedicated nginx config
|
# Create a dedicated nginx config
|
||||||
ynh_add_nginx_config
|
ynh_add_nginx_config
|
||||||
|
@ -70,6 +75,7 @@ ynh_add_nginx_config
|
||||||
#=================================================
|
#=================================================
|
||||||
# CONFIGURE SHELLINABOX
|
# CONFIGURE SHELLINABOX
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Configuring shellinabox..."
|
||||||
|
|
||||||
cp ../conf/shellinabox /etc/default/shellinabox
|
cp ../conf/shellinabox /etc/default/shellinabox
|
||||||
ynh_replace_string "__PORT__" "$port" "/etc/default/shellinabox"
|
ynh_replace_string "__PORT__" "$port" "/etc/default/shellinabox"
|
||||||
|
@ -98,5 +104,12 @@ yunohost service add $app
|
||||||
#=================================================
|
#=================================================
|
||||||
# RELOAD NGINX
|
# RELOAD NGINX
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Reloading nginx web server..."
|
||||||
|
|
||||||
systemctl reload nginx
|
systemctl reload nginx
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# END OF SCRIPT
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
ynh_print_info "Installation of $app completed"
|
||||||
|
|
|
@ -11,6 +11,7 @@ source /usr/share/yunohost/helpers
|
||||||
#=================================================
|
#=================================================
|
||||||
# LOAD SETTINGS
|
# LOAD SETTINGS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Loading installation settings..."
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
|
@ -33,12 +34,14 @@ fi
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE SHELLINABOX
|
# REMOVE SHELLINABOX
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Removing shellinabox"
|
||||||
|
|
||||||
ynh_package_autopurge shellinabox
|
ynh_package_autopurge shellinabox
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE NGINX CONFIGURATION
|
# REMOVE NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Removing nginx web server configuration"
|
||||||
|
|
||||||
# Remove the dedicated nginx config
|
# Remove the dedicated nginx config
|
||||||
ynh_remove_nginx_config
|
ynh_remove_nginx_config
|
||||||
|
|
|
@ -18,6 +18,7 @@ ynh_abort_if_errors
|
||||||
#=================================================
|
#=================================================
|
||||||
# LOAD SETTINGS
|
# LOAD SETTINGS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Loading settings..."
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
|
@ -28,6 +29,7 @@ port=$(ynh_app_setting_get $app port)
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHECK IF THE APP CAN BE RESTORED
|
# CHECK IF THE APP CAN BE RESTORED
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Validating restoration parameters..."
|
||||||
|
|
||||||
ynh_webpath_available $domain $path_url \
|
ynh_webpath_available $domain $path_url \
|
||||||
|| ynh_die "Path not available: ${domain}${path_url}"
|
|| ynh_die "Path not available: ${domain}${path_url}"
|
||||||
|
@ -43,6 +45,7 @@ ynh_restore_file "/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
#=================================================
|
#=================================================
|
||||||
# INSTALL SHELLINABOX
|
# INSTALL SHELLINABOX
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Installing shellinabox..."
|
||||||
|
|
||||||
ynh_package_update
|
ynh_package_update
|
||||||
ynh_package_install shellinabox
|
ynh_package_install shellinabox
|
||||||
|
@ -50,6 +53,7 @@ ynh_package_install shellinabox
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE APP MAIN DIR
|
# RESTORE THE APP MAIN DIR
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Restoring the app main directory..."
|
||||||
|
|
||||||
ynh_restore_file "/etc/shellinabox"
|
ynh_restore_file "/etc/shellinabox"
|
||||||
ynh_restore_file "/etc/default/shellinabox"
|
ynh_restore_file "/etc/default/shellinabox"
|
||||||
|
@ -71,5 +75,12 @@ yunohost service add $app
|
||||||
#=================================================
|
#=================================================
|
||||||
# RELOAD NGINX
|
# RELOAD NGINX
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Reloading nginx web server and php-fpm..."
|
||||||
|
|
||||||
systemctl reload nginx
|
systemctl reload nginx
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# END OF SCRIPT
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
ynh_print_info "Restoration completed for $app"
|
||||||
|
|
|
@ -11,6 +11,7 @@ source /usr/share/yunohost/helpers
|
||||||
#=================================================
|
#=================================================
|
||||||
# LOAD SETTINGS
|
# LOAD SETTINGS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Loading installation settings..."
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
|
@ -21,6 +22,7 @@ port=$(ynh_app_setting_get $app port)
|
||||||
#=================================================
|
#=================================================
|
||||||
# ENSURE DOWNWARD COMPATIBILITY
|
# ENSURE DOWNWARD COMPATIBILITY
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Ensuring downward compatibility..."
|
||||||
|
|
||||||
# If port doesn't exist, create it
|
# If port doesn't exist, create it
|
||||||
if [ -z "$port" ]; then
|
if [ -z "$port" ]; then
|
||||||
|
@ -31,6 +33,7 @@ fi
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Backing up the app before upgrading (may take a while)..."
|
||||||
|
|
||||||
# Backup the current version of the app
|
# Backup the current version of the app
|
||||||
ynh_backup_before_upgrade
|
ynh_backup_before_upgrade
|
||||||
|
@ -53,6 +56,7 @@ path_url=$(ynh_normalize_url_path $path_url)
|
||||||
#=================================================
|
#=================================================
|
||||||
# NGINX CONFIGURATION
|
# NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Upgrading nginx web server configuration..."
|
||||||
|
|
||||||
# Create a dedicated nginx config
|
# Create a dedicated nginx config
|
||||||
ynh_add_nginx_config
|
ynh_add_nginx_config
|
||||||
|
@ -60,6 +64,7 @@ ynh_add_nginx_config
|
||||||
#=================================================
|
#=================================================
|
||||||
# CONFIGURE SHELLINABOX
|
# CONFIGURE SHELLINABOX
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Upgrading shellinabox configuration..."
|
||||||
|
|
||||||
# Verify the checksum and backup the file if it's different
|
# Verify the checksum and backup the file if it's different
|
||||||
ynh_backup_if_checksum_is_different "/etc/default/shellinabox"
|
ynh_backup_if_checksum_is_different "/etc/default/shellinabox"
|
||||||
|
@ -83,6 +88,12 @@ ynh_store_file_checksum "/etc/default/shellinabox"
|
||||||
#=================================================
|
#=================================================
|
||||||
# RELOAD NGINX
|
# RELOAD NGINX
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Reloading nginx web server..."
|
||||||
|
|
||||||
systemctl reload nginx
|
systemctl reload nginx
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# END OF SCRIPT
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
ynh_print_info "Upgrade of $app completed"
|
||||||
|
|
Loading…
Add table
Reference in a new issue