Commit 96620f9d authored by HgO's avatar HgO

Merge branch '10-yunohost-progress-bar' into 'unstable'

Use yunohost progress bar

See merge request !23
parents f29ece38 d834a368
......@@ -13,7 +13,7 @@
"url": "https://gitlab.com/Spctrl"
},
"requirements": {
"yunohost": ">= 3.2.0"
"yunohost": ">= 3.5.0"
},
"multi_instance": "false",
"services": [
......
......@@ -33,7 +33,7 @@ opt_path=$(ynh_app_setting_get $app opt_path)
# BACKUP THE NGINX CONFIGURATION
#=================================================
ynh_print_info "Backing up..."
ynh_script_progression "Backing up..."
ynh_backup "$www_path"
ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
......
......@@ -70,7 +70,7 @@ ynh_app_setting_set $app opt_path $opt_path
# INSTALL DEPENDENCIES
#=================================================
ynh_print_info "Installing dependencies…"
ynh_script_progression "Installing dependencies…"
ynh_install_app_dependencies git python3-openssl python3-requests
......@@ -78,7 +78,7 @@ ynh_install_app_dependencies git python3-openssl python3-requests
# CREATE DEDICATED USER
#=================================================
ynh_print_info "Creating app's user…"
ynh_script_progression "Creating app's user…"
mkdir -p $www_path
ynh_system_user_create $app_user $www_path
......@@ -87,7 +87,7 @@ ynh_system_user_create $app_user $www_path
# INSTALL STATIC FILE
#=================================================
ynh_print_info "Installing static site…"
ynh_script_progression "Installing static site…"
cp -a ../sources/. $www_path
chown -R $app_user: $www_path
......@@ -109,7 +109,7 @@ renew_cert_version=$(jq .version ../manifest.json -r -e | cut -d '~' -f 1)
renew_cert_path="$opt_path/renew_cert"
renew_cert_cron_script="renew_cert_cron.sh"
ynh_print_info "Installing automatic VPN certificate renewal…"
ynh_script_progression "Installing automatic VPN certificate renewal…"
git clone $renew_cert_repo $renew_cert_path
git -C $renew_cert_path checkout $renew_cert_version
......@@ -118,7 +118,7 @@ git -C $renew_cert_path checkout $renew_cert_version
# This wrapper will be used as a daily cron task
cp $renew_cert_cron_script $renew_cert_path/$renew_cert_cron_script
ynh_print_info "Setting up permissions"
ynh_script_progression "Setting up permissions"
chown -R $app_user: $opt_path
chmod 0755 $renew_cert_path/$renew_cert_cron_script
......@@ -128,7 +128,7 @@ chown root: $renew_cert_path/$renew_cert_cron_script
# SETTING UP CRONTAB
#=================================================
ynh_print_info "Setting up cron job for certificate renewal…"
ynh_script_progression "Setting up cron job for certificate renewal…"
cat <<EOF > /etc/cron.daily/$app-renew-cert
#!/bin/bash
......@@ -143,6 +143,6 @@ chmod 0755 /etc/cron.daily/$app-renew-cert
# FINALIZATION
#=================================================
ynh_print_info "Checking certificates…"
ynh_script_progression "Checking certificates…"
/etc/cron.daily/$app-renew-cert
......@@ -25,7 +25,7 @@ opt_path=$(ynh_app_setting_get $app opt_path)
# STANDARD REMOVE
#=================================================
ynh_print_info "Removing static site..."
ynh_script_progression "Removing static site..."
rm -rf $www_path
rm -f /etc/nginx/conf.d/$domain.d/$app.conf
......@@ -33,7 +33,7 @@ rm -f /etc/nginx/conf.d/$domain.d/$app.conf
nginx -t > /dev/null
service nginx reload
ynh_print_info "Removing automatic vpn certificate renewal..."
ynh_script_progression "Removing automatic vpn certificate renewal..."
rm -rf $opt_path
rm -rf /etc/cron.daily/$app-renew-cert
......@@ -42,7 +42,7 @@ rm -rf /etc/cron.daily/$app-renew-cert
# REMOVE DEPENDENCIES
#=================================================
ynh_print_info "Removing dependencies..."
ynh_script_progression "Removing dependencies..."
ynh_remove_app_dependencies
......@@ -50,6 +50,6 @@ ynh_remove_app_dependencies
# REMOVE DEDICATED USER
#=================================================
ynh_print_info "Removing system user..."
ynh_script_progression "Removing system user..."
ynh_system_user_delete $app_user
......@@ -31,7 +31,7 @@ opt_path=$(ynh_app_setting_get $app opt_path)
# CHECK IF THE APP CAN BE RESTORED
#=================================================
ynh_print_info "Checking for conflicts…"
ynh_script_progression "Checking for conflicts…"
[[ ! -e $www_path ]] || ynh_die "The path $www_path already contains a folder"
[[ ! -e $opt_path ]] || ynh_die "The path $opt_path already contains a folder"
......@@ -48,7 +48,7 @@ fi
# INSTALL DEPENDENCIES
#=================================================
ynh_print_info "Installing dependencies…"
ynh_script_progression "Installing dependencies…"
ynh_install_app_dependencies git python3-openssl python3-requests
......@@ -63,7 +63,7 @@ ynh_system_user_create $app_user "$www_path"
# RESTORE STATIC FILES
#=================================================
ynh_print_info "Restoring static site…"
ynh_script_progression "Restoring static site…"
ynh_restore_file "$www_path"
ynh_restore_file "/etc/nginx/conf.d/$domain.d/$app.conf"
......@@ -76,7 +76,7 @@ service nginx reload
# RESTORE RENEW CERT
#=================================================
ynh_print_info "Restoring automatic VPN certificates renewal…"
ynh_script_progression "Restoring automatic VPN certificates renewal…"
ynh_restore_file "$opt_path"
ynh_restore_file "/etc/cron.daily/$app-renew-cert"
......@@ -91,7 +91,7 @@ chmod 0755 /etc/cron.daily/$app-renew-cert \
# FINALIZATION
#=================================================
ynh_print_info "Checking certificates…"
ynh_script_progression "Checking certificates…"
/etc/cron.daily/$app-renew-cert
......@@ -80,7 +80,7 @@ fi
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
ynh_print_info "Creating backup..."
ynh_script_progression "Creating backup..."
ynh_backup_before_upgrade
ynh_clean_setup () {
......@@ -97,6 +97,8 @@ ynh_abort_if_errors
# INSTALL DEPENDENCIES
#=================================================
ynh_script_progression "Upgrading dependencies..."
if [[ $version < "0.3.0~ynh1" ]]; then
ynh_app_setting_delete $app version
ynh_system_user_create --username $app_user --home_dir $www_path
......@@ -116,7 +118,7 @@ fi
# REINSTALL STATIC FILES
#=================================================
ynh_print_info "Installing static site..."
ynh_script_progression "Installing static site..."
rm -rf $www_path
mkdir -p $www_path
......@@ -135,7 +137,7 @@ service nginx reload
# REINSTALL RENEW CERT
#=================================================
ynh_print_info "Installing automatic VPN certificate renewal..."
ynh_script_progression "Installing automatic VPN certificate renewal..."
renew_cert_repo="https://github.com/neutrinet/renew_cert"
renew_cert_version=$(jq .version ../manifest.json -r -e | cut -d '~' -f 1)
......@@ -154,7 +156,7 @@ git -C $renew_cert_path checkout $renew_cert_version
# This wrapper will be used as a daily cron task
cp $renew_cert_cron_script $renew_cert_path/$renew_cert_cron_script
ynh_print_info "Setting up permissions"
ynh_script_progression "Setting up permissions"
chown -R $app_user: $opt_path
chmod 755 $renew_cert_path/$renew_cert_cron_script
......@@ -164,7 +166,7 @@ chown root: $renew_cert_path/$renew_cert_cron_script
# SETTING UP CRONTAB
#=================================================
ynh_print_info "Setting up cron job for renewal..."
ynh_script_progression "Setting up cron job for renewal..."
cat <<EOF > /etc/cron.daily/$app-renew-cert
#!/bin/bash
......@@ -179,5 +181,5 @@ chmod 0755 /etc/cron.daily/$app-renew-cert
# FINALIZATION
#=================================================
ynh_print_info "Checking certificates..."
ynh_script_progression "Checking certificates..."
/etc/cron.daily/$app-renew-cert
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment