diff --git a/scripts/backup b/scripts/backup index 8761b0c..a973630 100644 --- a/scripts/backup +++ b/scripts/backup @@ -9,7 +9,7 @@ dbuser=$app # Source app helpers - . /usr/share/yunohost/helpers + source /usr/share/yunohost/helpers # Retrieve app settings domain=$(ynh_app_setting_get "$app" domain) @@ -22,9 +22,9 @@ # Copy the conf files ynh_backup "/etc/nginx/conf.d/${domain}.d/${app}.conf" "nginx.conf" - + # Copy dedicated php-fpm process to backup folder - ynh_backup "/etc/php5/fpm/pool.d/$app.conf" "php-fpm.conf" + ynh_backup "/etc/php5/fpm/pool.d/${app}.conf" "php-fpm.conf" # Dump the database mysqldump -u "$dbuser" -p"$dbpass" --no-create-db "$dbname" > ./db.sql diff --git a/scripts/install b/scripts/install index facbc21..42c9d9f 100644 --- a/scripts/install +++ b/scripts/install @@ -55,7 +55,7 @@ sudo gpg --batch --delete-key --yes Rainloop # Unzip sudo unzip -qq rainloop-community-${rainloop_version}.zip -d $rainloop_path/ - + # Install plugins sudo mkdir -p $rainloop_path/data/_data_/_default_/plugins sudo cp -rf ../sources/plugins/auto-domain-grab $rainloop_path/data/_data_/_default_/plugins/. @@ -78,7 +78,7 @@ lang="en" esac ynh_app_setting_set "$app" lang "$lang" - + # Set plugins plugins="auto-domain-grab" # This plugin is trying to automatically grab unknown domains if users want to add external email accounts if [ "$ldap" = "Yes" ]; @@ -86,7 +86,7 @@ plugins="$plugins,ynh-ldap-suggestions" # This plugin is to suggest YunoHost users in recipients list fi ynh_app_setting_set "$app" plugins "$plugins" - + sudo cp ../conf/data/configs/application.ini $application_file sudo sed -i "s@domain.tld@$domain@g" $application_file sudo sed -i "s@MYSQLUSER@$dbuser@g" $application_file @@ -144,5 +144,5 @@ fi # Reload services - sudo service php5-fpm restart || true + sudo service php5-fpm reload || true sudo service nginx reload || true diff --git a/scripts/remove b/scripts/remove index f598920..318d192 100644 --- a/scripts/remove +++ b/scripts/remove @@ -5,25 +5,25 @@ app=$YNH_APP_INSTANCE_NAME # Source app helpers -. /usr/share/yunohost/helpers + source /usr/share/yunohost/helpers # Retrieve arguments - dbuser=$app - dbname=$app - domain=$(ynh_app_setting_get "$app" domain) + dbuser=$app + dbname=$app + domain=$(ynh_app_setting_get "$app" domain) # Drop MySQL database and user - ynh_mysql_drop_db "$dbname" 2>&1 || true - ynh_mysql_drop_user "$dbuser" 2>&1 || true + ynh_mysql_drop_db "$dbname" 2>&1 || true + ynh_mysql_drop_user "$dbuser" 2>&1 || true # Delete app directory and configurations - sudo rm -rf "/var/www/${app}" - sudo rm -f "/etc/php5/fpm/pool.d/${app}.conf" - [[ -n $domain ]] && sudo rm -f "/etc/nginx/conf.d/${domain}.d/${app}.conf" + sudo rm -rf "/var/www/${app}" + sudo rm -f "/etc/php5/fpm/pool.d/${app}.conf" + [[ -n $domain ]] && sudo rm -f "/etc/nginx/conf.d/${domain}.d/${app}.conf" # Remove GPG key - sudo gpg --batch --delete-key --yes Rainloop + sudo gpg --batch --delete-key --yes Rainloop # Reload services - sudo service php5-fpm restart || true - sudo service nginx reload || true + sudo service php5-fpm reload || true + sudo service nginx reload || true diff --git a/scripts/restore b/scripts/restore index 73058b1..d58b39b 100644 --- a/scripts/restore +++ b/scripts/restore @@ -1,13 +1,13 @@ #!/bin/bash # Exit on command errors and treat unset variables as an error -set -eu + set -eu # Get multi-instances specific variables app=$YNH_APP_INSTANCE_NAME # Source app helpers -. /usr/share/yunohost/helpers + source /usr/share/yunohost/helpers # Retrieve old app settings domain=$(ynh_app_setting_get "$app" domain) @@ -52,5 +52,5 @@ set -eu sudo cp -a ./php-fpm.conf "$phpfpm_conf" # Reload services - sudo service php5-fpm restart || true + sudo service php5-fpm reload || true sudo service nginx reload || true diff --git a/scripts/upgrade b/scripts/upgrade index 5bf0430..879d1ee 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -17,11 +17,11 @@ sudo yunohost backup restore --ignore-hooks $app-before-upgrade --apps $app --force --quiet # Restore the backup if upgrade failed ynh_die "Upgrade failed. The app was restored to the way it was before the failed upgrade." } - set -eu + set -eu trap EXIT_PROPERLY ERR # Source app helpers -. /usr/share/yunohost/helpers + source /usr/share/yunohost/helpers # Retrieve arguments domain=$(ynh_app_setting_get "$app" domain) @@ -53,7 +53,7 @@ sudo wget -q https://github.com/RainLoop/rainloop-webmail/releases/download/v${rainloop_version}/rainloop-community-${rainloop_version}.zip sudo wget -q https://github.com/RainLoop/rainloop-webmail/releases/download/v${rainloop_version}/rainloop-community-${rainloop_version}.zip.asc sudo wget -q https://repository.rainloop.net/RainLoop.asc - # Verify the integrity of sources + # Verify the integrity of sources sudo gpg --import --quiet RainLoop.asc sudo gpg --verify --quiet rainloop-community-${rainloop_version}.zip.asc rainloop-community-${rainloop_version}.zip sudo gpg --batch --delete-key --yes Rainloop @@ -95,5 +95,5 @@ sudo chmod 644 $finalphpconf # Reload services - sudo service php5-fpm restart || true + sudo service php5-fpm reload || true sudo service nginx reload || true