From dad4c6ee62cc3fa1d8ad66cef936890adea5429b Mon Sep 17 00:00:00 2001 From: yalh76 Date: Thu, 21 Mar 2019 04:30:13 +0100 Subject: [PATCH 01/41] remove not needed variable --- scripts/install | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/install b/scripts/install index bc35183..afd3bd3 100755 --- a/scripts/install +++ b/scripts/install @@ -36,7 +36,6 @@ cache=$YNH_APP_ARG_CACHE size=$YNH_APP_ARG_SIZE random_key=$(ynh_string_random 64) admin_email=$(ynh_user_get_info $admin 'mail') -admin_pass_reset_url="" ## Bypass package_checker name not compatible with writefreely if [ "$admin" = "package_checker" ] From c6daff20b704c61c319ea0f365149cb5e0d786d9 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Sat, 23 Mar 2019 05:39:14 +0100 Subject: [PATCH 02/41] fix uploads folder not available --- manifest.json | 2 +- scripts/install | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/manifest.json b/manifest.json index f1f3cf9..42123d4 100755 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Pleroma is an OStatus-compatible social networking server written in Elixir, compatible with GNU Social and Mastodon", "fr": "Pleroma est un réseau social écrit en Elixir, compatible avec OStatus, GNU Social et Mastodon" }, - "version": "0.9.999~ynh3", + "version": "0.9.999~ynh4", "url": "https://git.pleroma.social/pleroma/pleroma", "license": "AGPL-3.0-only", "maintainer": { diff --git a/scripts/install b/scripts/install index afd3bd3..c2e4987 100755 --- a/scripts/install +++ b/scripts/install @@ -276,7 +276,8 @@ pushd $final_path/$app #Generate key pair sudo -u "$app" MIX_ENV=prod mix web_push.gen.keypair >> "config/prod.secret.exs" - ynh_replace_string "administrator@example.com" "$admin_email" "$final_path/$app/config/prod.secret.exs" + ynh_replace_string "administrator@example.com" "$admin_email" "$final_path/$app/config/prod.secret.exs" + mkdir uploads popd #================================================= From 25616d753f4f2eb797c1952ef9f72ac02c24d5e5 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Sat, 23 Mar 2019 05:53:01 +0100 Subject: [PATCH 03/41] remove not needed --force for ecto.migrate --- scripts/install | 2 +- scripts/upgrade | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/install b/scripts/install index c2e4987..086ae4e 100755 --- a/scripts/install +++ b/scripts/install @@ -269,7 +269,7 @@ pushd $final_path/$app sudo -u "$app" MIX_ENV=prod mix local.hex --force sudo -u "$app" MIX_ENV=prod mix local.rebar --force sudo -u "$app" MIX_ENV=prod mix deps.get - sudo -u "$app" MIX_ENV=prod mix ecto.migrate --force + sudo -u "$app" MIX_ENV=prod mix ecto.migrate # Add user sudo -u "$app" MIX_ENV=prod mix pleroma.user new "$admin" "$admin_email" --password "$password" --moderator --admin -y diff --git a/scripts/upgrade b/scripts/upgrade index e2cfa40..bfd847e 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -221,7 +221,7 @@ fi chown -R "$app":"$app" "$final_path" pushd $final_path/$app sudo -u "$app" MIX_ENV=prod mix deps.get - sudo -u "$app" MIX_ENV=prod mix ecto.migrate --force + sudo -u "$app" MIX_ENV=prod mix ecto.migrate #Generate key pair sudo -u "$app" MIX_ENV=prod mix web_push.gen.keypair >> "config/prod.secret.exs" From 29ca26f4f95701f4dec1f4646d772966d708fa40 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Sat, 23 Mar 2019 05:54:41 +0100 Subject: [PATCH 04/41] Comment --- scripts/install | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/install b/scripts/install index 086ae4e..0ee7413 100755 --- a/scripts/install +++ b/scripts/install @@ -277,6 +277,8 @@ pushd $final_path/$app #Generate key pair sudo -u "$app" MIX_ENV=prod mix web_push.gen.keypair >> "config/prod.secret.exs" ynh_replace_string "administrator@example.com" "$admin_email" "$final_path/$app/config/prod.secret.exs" + + #Create uploads dir mkdir uploads popd From a686b54cddb105f1a9f22ca18bdecc032ac87aa6 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Sat, 23 Mar 2019 06:16:28 +0100 Subject: [PATCH 05/41] Cleanup --- scripts/backup | 7 --- scripts/change_url | 2 - scripts/install | 132 --------------------------------------------- scripts/remove | 13 +---- scripts/restore | 16 +----- scripts/upgrade | 52 ++++++++---------- 6 files changed, 23 insertions(+), 199 deletions(-) diff --git a/scripts/backup b/scripts/backup index 3fd2108..e0519ff 100755 --- a/scripts/backup +++ b/scripts/backup @@ -15,7 +15,6 @@ source /usr/share/yunohost/helpers #================================================= ynh_clean_setup () { - ### Remove this function if there's nothing to clean before calling the remove script. ynh_clean_check_starting } # Exit if an error occurs during the execution of the script @@ -84,12 +83,6 @@ ynh_print_info "Backing up systemd configuration..." ynh_backup "/etc/systemd/system/$app.service" -#================================================= -# BACKUP A CRON FILE -#================================================= - -#ynh_backup "/etc/cron.d/$app" - #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/change_url b/scripts/change_url index 8749479..5ff2bef 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -114,8 +114,6 @@ ynh_systemd_action --action=start --service_name=$app --log_path=systemd --line_ # STORE THE CONFIG FILE CHECKSUM #================================================= -### Verify the checksum of a file, stored by `ynh_store_file_checksum` in the install script. -### And create a backup of this file if the checksum is different. So the file will be backed up if the admin had modified it. ynh_backup_if_checksum_is_different "$final_path/config.ini" # Recalculate and store the checksum of the file for the next upgrade. ynh_store_file_checksum "$final_path/$app/config/prod.secret.exs" diff --git a/scripts/install b/scripts/install index 0ee7413..3f7f048 100755 --- a/scripts/install +++ b/scripts/install @@ -15,7 +15,6 @@ source /usr/share/yunohost/helpers #================================================= ynh_clean_setup () { - ### Remove this function if there's nothing to clean before calling the remove script. ynh_clean_check_starting } # Exit if an error occurs during the execution of the script @@ -43,16 +42,6 @@ then admin="test" fi -### If it's a multi-instance app, meaning it can be installed several times independently -### The id of the app as stated in the manifest is available as $YNH_APP_ID -### The instance number is available as $YNH_APP_INSTANCE_NUMBER (equals "1", "2", ...) -### The app instance name is available as $YNH_APP_INSTANCE_NAME -### - the first time the app is installed, YNH_APP_INSTANCE_NAME = ynhexample -### - the second time the app is installed, YNH_APP_INSTANCE_NAME = ynhexample__2 -### - ynhexample__{N} for the subsequent installations, with N=3,4, ... -### The app instance name is probably what interests you most, since this is -### guaranteed to be unique. This is a good unique identifier to define installation path, -### db names, ... app=$YNH_APP_INSTANCE_NAME #================================================= @@ -60,8 +49,6 @@ app=$YNH_APP_INSTANCE_NAME #================================================= ynh_print_info "Validating installation parameters..." -### If the app uses nginx as web server (written in HTML/PHP in most cases), the final path should be "/var/www/$app". -### If the app provides an internal web server (or uses another application server such as uwsgi), the final path should be "/opt/yunohost/$app" final_path=/var/www/$app test ! -e "$final_path" || ynh_die "This path already contains a folder" @@ -94,11 +81,6 @@ ynh_app_setting_set "$app" random_key "$random_key" #================================================= ynh_print_info "Configuring firewall ..." -### Use these lines if you have to open a port for the application -### `ynh_find_port` will find the first available port starting from the given port. -### If you're not using these lines: -### - Remove the section "CLOSE A PORT" in the remove script - # Find a free port port=$(ynh_find_port 8095) # Open this port @@ -125,13 +107,6 @@ sudo rm erlang_solutions.asc #================================================= ynh_print_info "Installing dependencies ..." -### `ynh_install_app_dependencies` allows you to add any "apt" dependencies to the package. -### Those deb packages will be installed as dependencies of this package. -### If you're not using this helper: -### - Remove the section "REMOVE DEPENDENCIES" in the remove script -### - As well as the section "REINSTALL DEPENDENCIES" in the restore script -### - And the section "UPGRADE DEPENDENCIES" in the upgrade script - ynh_install_app_dependencies $pkg_dependencies #================================================= @@ -139,13 +114,6 @@ ynh_install_app_dependencies $pkg_dependencies #================================================= ynh_print_info "Creating a PostgreSQL database..." -### Use these lines if you need a database for the application. -### `ynh_psql_test_if_first_run` will create a master password and set up global settings. -### If you're not using these lines: -### - Remove the section "BACKUP THE POSTGRESQL DATABASE" in the backup script -### - Remove also the section "REMOVE THE POSTGRESQL DATABASE" in the remove script -### - As well as the section "RESTORE THE POSTGRESQL DATABASE" in the restore script - db_name=$(ynh_sanitize_dbid $app) db_pwd=$(ynh_string_random 30) ynh_app_setting_set $app db_name $db_name @@ -167,10 +135,6 @@ CREATE EXTENSION IF NOT EXISTS \"uuid-ossp\";" #================================================= ynh_print_info "Setting up source files ..." -### `ynh_setup_source` is used to install an app from a zip or tar.gz file, -### downloaded from an upstream source, like a git repository. -### `ynh_setup_source` use the file conf/app.src - ynh_app_setting_set $app final_path $final_path # Download, check integrity, uncompress and patch the source from app.src git clone https://git.pleroma.social/pleroma/pleroma "$final_path/$app" @@ -183,8 +147,6 @@ popd #================================================= ynh_print_info "Configuring nginx web server..." -### `ynh_add_nginx_config` will use the file conf/nginx.conf - # Create a dedicated nginx config ynh_add_nginx_config if [ $cache -eq 1 ] @@ -207,25 +169,6 @@ ynh_print_info "Configuring system user ..." # Create a system user ynh_system_user_create "$app" "$final_path" -#================================================= -# PHP-FPM CONFIGURATION -#================================================= -ynh_print_info "Configuring php-fpm ..." - -### `ynh_add_fpm_config` is used to set up a PHP config. -### You can remove it if your app doesn't use PHP. -### `ynh_add_fpm_config` will use the files conf/php-fpm.conf and conf/php-fpm.ini -### If you're not using these lines: -### - You can remove these files in conf/. -### - Remove the section "BACKUP THE PHP-FPM CONFIGURATION" in the backup script -### - Remove also the section "REMOVE PHP-FPM CONFIGURATION" in the remove script -### - As well as the section "RESTORE THE PHP-FPM CONFIGURATION" in the restore script -### With the reload at the end of the script. -### - And the section "PHP-FPM CONFIGURATION" in the upgrade script - -# Create a dedicated php-fpm config -#ynh_add_fpm_config - #================================================= # SPECIFIC SETUP #================================================= @@ -287,68 +230,13 @@ popd #================================================= ynh_print_info "Configuring a systemd service ..." -### `ynh_systemd_config` is used to configure a systemd script for an app. -### It can be used for apps that use sysvinit (with adaptation) or systemd. -### Have a look at the app to be sure this app needs a systemd script. -### `ynh_systemd_config` will use the file conf/systemd.service -### If you're not using these lines: -### - You can remove those files in conf/. -### - Remove the section "BACKUP SYSTEMD" in the backup script -### - Remove also the section "STOP AND REMOVE SERVICE" in the remove script -### - As well as the section "RESTORE SYSTEMD" in the restore script -### - And the section "SETUP SYSTEMD" in the upgrade script - # Create a dedicated systemd config ynh_add_systemd_config -#================================================= -# SETUP APPLICATION WITH CURL -#================================================= - -### Use these lines only if the app installation needs to be finalized through -### web forms. We generally don't want to ask the final user, -### so we're going to use curl to automatically fill the fields and submit the -### forms. - -# Set right permissions for curl install -#chown -R $app: $final_path - -# Set the app as temporarily public for curl call -ynh_print_info "Configuring ssowat ..." -#ynh_app_setting_set $app skipped_uris "/" -# Reload SSOwat config -#yunohost app ssowatconf - -# Reload Nginx -#systemctl reload nginx - -# Installation with curl -ynh_print_info "Finalizing install ..." -#ynh_local_curl "/INSTALL_PATH" "key1=value1" "key2=value2" "key3=value3" - -# Remove the public access -#if [ $is_public -eq 0 ] -#then -# ynh_app_setting_delete $app skipped_uris -#fi - -#================================================= -# MODIFY A CONFIG FILE -#================================================= - -### `ynh_replace_string` is used to replace a string in a file. -### (It's compatible with sed regular expressions syntax) - -#ynh_replace_string "match_string" "replace_string" "$final_path/$app/config/prod.secret.exs" - #================================================= # STORE THE CONFIG FILE CHECKSUM #================================================= -### `ynh_store_file_checksum` is used to store the checksum of a file. -### That way, during the upgrade script, by using `ynh_backup_if_checksum_is_different`, -### you can make a backup of this file before modifying it again if the admin had modified it. - # Calculate and store the config file checksum into the app settings ynh_store_file_checksum "$final_path/$app/config/prod.secret.exs" @@ -358,10 +246,6 @@ ynh_store_file_checksum "$final_path/$app/config/prod.secret.exs" # SECURE FILES AND DIRECTORIES #================================================= -### For security reason, any app should set the permissions to root: before anything else. -### Then, if write authorization is needed, any access should be given only to directories -### that really need such authorization. - # Set permissions to app files chown -R "$app":"$app" "$final_path" @@ -370,14 +254,6 @@ chown -R "$app":"$app" "$final_path" #================================================= ynh_print_info "Configuring log rotation ..." -### `ynh_use_logrotate` is used to configure a logrotate configuration for the logs of this app. -### Use this helper only if there is effectively a log file for this app. -### If you're not using this helper: -### - Remove the section "BACKUP LOGROTATE" in the backup script -### - Remove also the section "REMOVE LOGROTATE CONFIGURATION" in the remove script -### - As well as the section "RESTORE THE LOGROTATE CONFIGURATION" in the restore script -### - And the section "SETUP LOGROTATE" in the upgrade script - # Use logrotate to manage application logfile(s) ynh_use_logrotate @@ -385,14 +261,6 @@ ynh_use_logrotate # ADVERTISE SERVICE IN ADMIN PANEL #================================================= -### `yunohost service add` is a CLI yunohost command to add a service in the admin panel. -### You'll find the service in the 'services' section of YunoHost admin panel. -### This CLI command would be useless if the app does not have any services (systemd or sysvinit) -### If you're not using these lines: -### - You can remove these files in conf/. -### - Remove the section "REMOVE SERVICE FROM ADMIN PANEL" in the remove script -### - As well as the section ADVERTISE SERVICE IN ADMIN PANEL" in the restore script - #yunohost service add $app --log "/var/log/$app/APP.log" # if using yunohost version 3.2 or more in the 'manifest.json', a description can be added yunohost service add $app --description "$app daemon for Pleroma" --log "/var/log/$app/$app.log" diff --git a/scripts/remove b/scripts/remove index ffa9bc3..a8c88ba 100755 --- a/scripts/remove +++ b/scripts/remove @@ -37,7 +37,7 @@ then fi #================================================= -# START SERVICE +# STOP SERVICE #================================================= ynh_systemd_action --action=stop --service_name=$app @@ -94,14 +94,6 @@ ynh_print_info "Removing nginx web server configuration" ynh_remove_nginx_config ynh_secure_remove "/etc/nginx/conf.d/$app-cache.conf" -#================================================= -# REMOVE PHP-FPM CONFIGURATION -#================================================= -ynh_print_info "Removing php-fpm configuration" - -# Remove the dedicated php-fpm config -#ynh_remove_fpm_config - #================================================= # REMOVE LOGROTATE CONFIGURATION #================================================= @@ -127,9 +119,6 @@ fi # REMOVE THE CRON FILE #================================================= -# Remove a cron file -#ynh_secure_remove "/etc/cron.d/$app" - # Remove a directory securely ynh_secure_remove "/etc/$app/" diff --git a/scripts/restore b/scripts/restore index 1002244..da70161 100755 --- a/scripts/restore +++ b/scripts/restore @@ -15,7 +15,6 @@ source /usr/share/yunohost/helpers #================================================= ynh_clean_setup () { - #### Remove this function if there's nothing to clean before calling the remove script. ynh_clean_check_starting } # Exit if an error occurs during the execution of the script @@ -81,12 +80,6 @@ ynh_system_user_create "$app" "$final_path" # Restore permissions on app files chown -R "$app":"$app" "$final_path" -#================================================= -# RESTORE THE PHP-FPM CONFIGURATION -#================================================= - -#ynh_restore_file "/etc/php/7.0/fpm/pool.d/$app.conf" - #================================================= # SPECIFIC RESTORATION #================================================= @@ -145,12 +138,6 @@ systemctl daemon-reload yunohost service add $app --description "$app daemon for Pleroma" --log "/var/log/$app/$app.log" -#================================================= -# RESTORE THE CRON FILE -#================================================= - -#ynh_restore_file "/etc/cron.d/$app" - #================================================= # RESTORE THE LOGROTATE CONFIGURATION #================================================= @@ -162,9 +149,8 @@ ynh_restore_file "/etc/logrotate.d/$app" #================================================= # RELOAD NGINX AND PHP-FPM #================================================= -ynh_print_info "Reloading nginx web server and php-fpm..." +ynh_print_info "Reloading nginx web server..." -#systemctl reload php7.0-fpm systemctl reload nginx #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index bfd847e..630871c 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -32,17 +32,6 @@ cache=$(ynh_app_setting_get "$app" cache) size=$(ynh_app_setting_get "$app" size) registration=$(ynh_app_setting_get "$app" registration) -psql_db=$(ynh_app_setting_get "$app" psql_db) - -if [ -n "$psql_db" ] -then - db_name=$(ynh_app_setting_get "$app" psql_db) - db_pwd=$(ynh_app_setting_get "$app" psqlpwd) - ynh_app_setting_set "$app" db_name "$db_name" - ynh_app_setting_set "$app" db_pwd "$db_pwd" - ynh_app_setting_delete "$app" psql_db - ynh_app_setting_delete "$app" psqlpwd -fi #================================================= # ENSURE DOWNWARD COMPATIBILITY @@ -73,6 +62,27 @@ fi # Remove repository ynh_secure_remove "/etc/apt/sources.list.d/erlang-solutions.list" +#Switch variables name +psql_db=$(ynh_app_setting_get "$app" psql_db) + +if [ -n "$psql_db" ] +then + db_name=$(ynh_app_setting_get "$app" psql_db) + db_pwd=$(ynh_app_setting_get "$app" psqlpwd) + ynh_app_setting_set "$app" db_name "$db_name" + ynh_app_setting_set "$app" db_pwd "$db_pwd" + ynh_app_setting_delete "$app" psql_db + ynh_app_setting_delete "$app" psqlpwd +fi + +#Close a port + +if yunohost firewall list | grep -q "\- $port$" +then + echo "Close port $port" >&2 + yunohost firewall disallow TCP $port 2>&1 +fi + #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= @@ -174,14 +184,6 @@ ynh_print_info "Making sure dedicated system user exists..." # Create a dedicated user (if not existing) ynh_system_user_create "$app" "$final_path" -#================================================= -# PHP-FPM CONFIGURATION -#================================================= -ynh_print_info "Upgrading php-fpm configuration..." - -# Create a dedicated php-fpm config -#ynh_add_fpm_config - #================================================= # SPECIFIC UPGRADE #================================================= @@ -228,22 +230,10 @@ pushd $final_path/$app ynh_replace_string "administrator@example.com" "$admin_email" "$final_path/$app/config/prod.secret.exs" popd -### Verify the checksum of a file, stored by `ynh_store_file_checksum` in the install script. -### And create a backup of this file if the checksum is different. So the file will be backed up if the admin had modified it. ynh_backup_if_checksum_is_different "$final_path/$app/config/prod.secret.exs" # Recalculate and store the checksum of the file for the next upgrade. ynh_store_file_checksum "$final_path/$app/config/prod.secret.exs" -#================================================= -# CLOSE A PORT -#================================================= - -if yunohost firewall list | grep -q "\- $port$" -then - echo "Close port $port" >&2 - yunohost firewall disallow TCP $port 2>&1 -fi - #================================================= # SETUP LOGROTATE #================================================= From bb0079420d8abd7cfb852d7def41f570c1f3ed7a Mon Sep 17 00:00:00 2001 From: yalh76 Date: Sat, 23 Mar 2019 12:56:48 +0100 Subject: [PATCH 06/41] Update check_process --- check_process | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/check_process b/check_process index 285320a..88800a5 100755 --- a/check_process +++ b/check_process @@ -21,11 +21,12 @@ setup_private=1 setup_public=1 upgrade=1 + upgrade=1 from_commit=6efe2b8ed7b0f1734a68ea56c33053ff29a85d60 backup_restore=1 multi_instance=1 incorrect_path=1 port_already_use=0 - change_url=0 + change_url=1 ;;; Levels Level 1=auto Level 2=auto From 6e33790dc20be5d592b3ee463b6d7732f798db11 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Sun, 24 Mar 2019 20:51:42 +0100 Subject: [PATCH 07/41] Update check_process --- check_process | 1 - 1 file changed, 1 deletion(-) diff --git a/check_process b/check_process index 88800a5..73225a3 100755 --- a/check_process +++ b/check_process @@ -21,7 +21,6 @@ setup_private=1 setup_public=1 upgrade=1 - upgrade=1 from_commit=6efe2b8ed7b0f1734a68ea56c33053ff29a85d60 backup_restore=1 multi_instance=1 incorrect_path=1 From 7f38eebb698449264fd6293ad28932d159f5a642 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Sun, 24 Mar 2019 21:35:33 +0100 Subject: [PATCH 08/41] add ynh_add_secure_repos__2 --- scripts/install | 12 +-- scripts/remove | 8 +- scripts/restore | 12 +-- scripts/upgrade | 19 ---- scripts/ynh_add_secure_repos__2 | 166 ++++++++++++++++++++++++++++++++ 5 files changed, 180 insertions(+), 37 deletions(-) create mode 100644 scripts/ynh_add_secure_repos__2 diff --git a/scripts/install b/scripts/install index 3f7f048..e6bcc44 100755 --- a/scripts/install +++ b/scripts/install @@ -8,6 +8,7 @@ source _common.sh source ynh_systemd_action +source ynh_add_secure_repos__2 source /usr/share/yunohost/helpers #================================================= @@ -88,19 +89,16 @@ port=$(ynh_find_port 8095) ynh_app_setting_set $app port $port #================================================= -# INSTALL ERLANG AND ELIXIR +# ADD ERLANG REPOSITORY #================================================= -ynh_print_info "Installing erlang and elixir ..." +ynh_print_info "Adding Erlang repository..." if [ "$(lsb_release --codename --short)" == "jessie" ]; then - echo "deb http://packages.erlang-solutions.com/debian jessie contrib" | tee /etc/apt/sources.list.d/erlang-solutions.list + ynh_install_extra_repo "deb http://packages.erlang-solutions.com/debian jessie contrib" elif [ "$(lsb_release --codename --short)" == "stretch" ]; then - echo "deb http://packages.erlang-solutions.com/debian stretch contrib" | tee /etc/apt/sources.list.d/erlang-solutions.list + ynh_install_extra_repo "deb http://packages.erlang-solutions.com/debian stretch contrib" fi -sudo wget https://packages.erlang-solutions.com/debian/erlang_solutions.asc -sudo apt-key add erlang_solutions.asc -sudo rm erlang_solutions.asc #================================================= # INSTALL DEPENDENCIES diff --git a/scripts/remove b/scripts/remove index a8c88ba..e93e514 100755 --- a/scripts/remove +++ b/scripts/remove @@ -8,6 +8,7 @@ source _common.sh source ynh_systemd_action +source ynh_add_secure_repos__2 source /usr/share/yunohost/helpers #================================================= @@ -70,12 +71,11 @@ ynh_print_info "Removing dependencies" ynh_remove_app_dependencies #================================================= -# REMOVE ERLANG AND ELIXIR +# REMOVE ERLANG REPOSITORY #================================================= -ynh_print_info "Removing erlang and elixir..." +ynh_print_info "Removing erlang repository..." -ynh_secure_remove "/etc/apt/sources.list.d/erlang-solutions.list" -apt-key del A14F4FCA +ynh_remove_extra_repo "erlang-solutions" #================================================= # REMOVE APP MAIN DIR diff --git a/scripts/restore b/scripts/restore index da70161..e332402 100755 --- a/scripts/restore +++ b/scripts/restore @@ -8,6 +8,7 @@ source ../settings/scripts/_common.sh source ../settings/scripts/ynh_systemd_action +source ../settings/scripts/ynh_add_secure_repos__2 source /usr/share/yunohost/helpers #================================================= @@ -83,19 +84,16 @@ chown -R "$app":"$app" "$final_path" #================================================= # SPECIFIC RESTORATION #================================================= -# INSTALL ERLANG AND ELIXIR +# ADD ERLANG REPOSITORY #================================================= -ynh_print_info "Installing erlang and elixir ..." +ynh_print_info "Adding Erlang repository..." if [ "$(lsb_release --codename --short)" == "jessie" ]; then - echo "deb http://packages.erlang-solutions.com/debian jessie contrib" | tee /etc/apt/sources.list.d/erlang-solutions.list + ynh_install_extra_repo "deb http://packages.erlang-solutions.com/debian jessie contrib" elif [ "$(lsb_release --codename --short)" == "stretch" ]; then - echo "deb http://packages.erlang-solutions.com/debian stretch contrib" | tee /etc/apt/sources.list.d/erlang-solutions.list + ynh_install_extra_repo "deb http://packages.erlang-solutions.com/debian stretch contrib" fi -sudo wget https://packages.erlang-solutions.com/debian/erlang_solutions.asc -sudo apt-key add erlang_solutions.asc -sudo rm erlang_solutions.asc #================================================= # REINSTALL DEPENDENCIES diff --git a/scripts/upgrade b/scripts/upgrade index 630871c..4042e1d 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -149,25 +149,6 @@ then ynh_store_file_checksum "/etc/nginx/conf.d/$domain.d/$app.conf" fi -#================================================= -# INSTALL ERLANG AND ELIXIR -#================================================= -ynh_print_info "Installing erlang and elixir ..." - -#remove old erlang packages -sudo apt remove -y esl-erlang -sudo apt remove -y elixir - -if [ "$(lsb_release --codename --short)" == "jessie" ]; then - echo "deb http://packages.erlang-solutions.com/debian jessie contrib" | tee /etc/apt/sources.list.d/erlang-solutions.list -elif - [ "$(lsb_release --codename --short)" == "stretch" ]; then - echo "deb http://packages.erlang-solutions.com/debian stretch contrib" | tee /etc/apt/sources.list.d/erlang-solutions.list -fi -sudo wget https://packages.erlang-solutions.com/debian/erlang_solutions.asc -sudo apt-key add erlang_solutions.asc -sudo rm erlang_solutions.asc - #================================================= # UPGRADE DEPENDENCIES #================================================= diff --git a/scripts/ynh_add_secure_repos__2 b/scripts/ynh_add_secure_repos__2 new file mode 100644 index 0000000..51a9f1b --- /dev/null +++ b/scripts/ynh_add_secure_repos__2 @@ -0,0 +1,166 @@ +#!/bin/bash + +# Pin a repository. +# +# usage: ynh_pin_repo --package=packages --pin=pin_filter --priority=priority_value [--name=name] [--append] +# | arg: -p, --package - Packages concerned by the pin. Or all, *. +# | arg: -i, --pin - Filter for the pin. +# | arg: -p, --priority - Priority for the pin +# | arg: -n, --name - Name for the files for this repo, $app as default value. +# | arg: -a, --append - Do not overwrite existing files. +# +# See https://manpages.debian.org/stretch/apt/apt_preferences.5.en.html for information about pinning. +# +ynh_pin_repo () { + # Declare an array to define the options of this helper. + local legacy_args=pirna + declare -Ar args_array=( [p]=package= [i]=pin= [r]=priority= [n]=name= [a]=append ) + local package + local pin + local priority + local name + local append + # Manage arguments with getopts + ynh_handle_getopts_args "$@" + package="${package:-*}" + priority=${priority:-50} + name="${name:-$app}" + append=${append:-0} + + if [ $append -eq 1 ] + then + append="tee -a" + else + append="tee" + fi + + mkdir -p "/etc/apt/preferences.d" + echo "Package: $package +Pin: $pin +Pin-Priority: $priority" \ + | $append "/etc/apt/preferences.d/$name" +} + +# Add a repository. +# +# usage: ynh_add_repo --uri=uri --suite=suite --component=component [--name=name] [--append] +# | arg: -u, --uri - Uri of the repository. +# | arg: -s, --suite - Suite of the repository. +# | arg: -c, --component - Component of the repository. +# | arg: -n, --name - Name for the files for this repo, $app as default value. +# | arg: -a, --append - Do not overwrite existing files. +# +# Example for a repo like deb http://forge.yunohost.org/debian/ stretch stable +# uri suite component +# ynh_add_repo --uri=http://forge.yunohost.org/debian/ --suite=stretch --component=stable +# +ynh_add_repo () { + # Declare an array to define the options of this helper. + local legacy_args=uscna + declare -Ar args_array=( [u]=uri= [s]=suite= [c]=component= [n]=name= [a]=append ) + local uri + local suite + local component + local name + local append + # Manage arguments with getopts + ynh_handle_getopts_args "$@" + name="${name:-$app}" + append=${append:-0} + + if [ $append -eq 1 ] + then + append="tee -a" + else + append="tee" + fi + + mkdir -p "/etc/apt/sources.list.d" + # Add the new repo in sources.list.d + echo "deb $uri $suite $component" \ + | $append "/etc/apt/sources.list.d/$name.list" +} + +# Add an extra repository correctly, pin it and get the key. +# +# usage: ynh_install_extra_repo --repo="repo" [--key=key_url] [--name=name] [--append] +# | arg: -r, --repo - Complete url of the extra repository. +# | arg: -k, --key - url to get the public key. +# | arg: -n, --name - Name for the files for this repo, $app as default value. +# | arg: -a, --append - Do not overwrite existing files. +ynh_install_extra_repo () { + # Declare an array to define the options of this helper. + local legacy_args=rkna + declare -Ar args_array=( [r]=repo= [k]=key= [n]=name= [a]=append ) + local repo + local key + local name + local append + # Manage arguments with getopts + ynh_handle_getopts_args "$@" + name="${name:-$app}" + append=${append:-0} + key=${key:-0} + + if [ $append -eq 1 ] + then + append="--append" + wget_append="tee -a" + else + append="" + wget_append="tee" + fi + + # Split the repository into uri, suite and components. + # Remove "deb " at the beginning of the repo. + repo="${repo#deb }" + + # Get the uri + local uri="$(echo "$repo" | awk '{ print $1 }')" + + # Get the suite + local suite="$(echo "$repo" | awk '{ print $2 }')" + + # Get the components + local component="${repo##$uri $suite }" + + # Add the repository into sources.list.d + ynh_add_repo --uri="$uri" --suite="$suite" --component="$component" --name="$name" $append + + # Pin the new repo with the default priority, so it won't be used for upgrades. + # Build $pin from the uri without http and any sub path + local pin="${uri#*://}" + pin="${pin%%/*}" + ynh_pin_repo --package="*" --pin="origin \"$pin\"" --name="$name" $append + + # Get the public key for the repo + if [ -n "$key" ] + then + mkdir -p "/etc/apt/trusted.gpg.d" + wget -q "$key" -O - | $wget_append /etc/apt/trusted.gpg.d/$name.gpg + fi + + # Update the list of package with the new repo + ynh_package_update +} + +# Remove an extra repository and the assiociated configuration. +# +# usage: ynh_remove_extra_repo [--name=name] +# | arg: -n, --name - Name for the files for this repo, $app as default value. +ynh_remove_extra_repo () { + # Declare an array to define the options of this helper. + local legacy_args=n + declare -Ar args_array=( [n]=name= ) + local name + # Manage arguments with getopts + ynh_handle_getopts_args "$@" + name="${name:-$app}" + + ynh_secure_remove "/etc/apt/sources.list.d/$name.list" + ynh_secure_remove "/etc/apt/preferences.d/$name" + ynh_secure_remove "/etc/apt/trusted.gpg.d/$name.gpg" + + # Update the list of package to exclude the old repo + ynh_package_update +} From 64bc52cf63429e91bc4a619b20e1344217d4b675 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Mon, 25 Mar 2019 08:28:55 +0100 Subject: [PATCH 09/41] Fix version --- conf/app.src | 6 ++++++ scripts/install | 9 ++------- scripts/upgrade | 13 +------------ 3 files changed, 9 insertions(+), 19 deletions(-) create mode 100644 conf/app.src diff --git a/conf/app.src b/conf/app.src new file mode 100644 index 0000000..07ccbf9 --- /dev/null +++ b/conf/app.src @@ -0,0 +1,6 @@ +SOURCE_URL=https://git.pleroma.social/pleroma/pleroma/-/archive/v0.9.999/pleroma-v0.9.999.tar.gz +SOURCE_SUM=bab2cb3a13691a4291562d1691d55dc94226756f05a2a7c7053b234339ee00f8 +SOURCE_SUM_PRG=sha256sum +SOURCE_FORMAT=tar.gz +SOURCE_IN_SUBDIR=true +SOURCE_FILENAME= diff --git a/scripts/install b/scripts/install index e6bcc44..dde41c0 100755 --- a/scripts/install +++ b/scripts/install @@ -37,7 +37,7 @@ size=$YNH_APP_ARG_SIZE random_key=$(ynh_string_random 64) admin_email=$(ynh_user_get_info $admin 'mail') -## Bypass package_checker name not compatible with writefreely +## Bypass package_checker name not compatible with pleroma if [ "$admin" = "package_checker" ] then admin="test" @@ -84,8 +84,6 @@ ynh_print_info "Configuring firewall ..." # Find a free port port=$(ynh_find_port 8095) -# Open this port -#ynh_exec_warn_less yunohost firewall allow --no-upnp TCP $port ynh_app_setting_set $app port $port #================================================= @@ -135,10 +133,7 @@ ynh_print_info "Setting up source files ..." ynh_app_setting_set $app final_path $final_path # Download, check integrity, uncompress and patch the source from app.src -git clone https://git.pleroma.social/pleroma/pleroma "$final_path/$app" -pushd $final_path/$app - git checkout -b master -popd +ynh_setup_source "$final_path/$app" #================================================= # NGINX CONFIGURATION diff --git a/scripts/upgrade b/scripts/upgrade index 4042e1d..65aa1ad 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -59,9 +59,6 @@ if [ -z $final_path ]; then ynh_app_setting_set $app final_path $final_path fi -# Remove repository -ynh_secure_remove "/etc/apt/sources.list.d/erlang-solutions.list" - #Switch variables name psql_db=$(ynh_app_setting_get "$app" psql_db) @@ -119,14 +116,7 @@ path_url=$(ynh_normalize_url_path $path_url) ynh_print_info "Upgrading source files..." # Download, check integrity, uncompress and patch the source from app.src -#ynh_setup_source "$final_path" - -git clone --quiet https://git.pleroma.social/pleroma/pleroma "$final_path/upgrade" -pushd "$final_path/upgrade" - git checkout -b master -popd -cp -a "$final_path/upgrade/." "$final_path/$app/." -rm -r "$final_path/upgrade" +ynh_setup_source "$final_path/$app" #================================================= # NGINX CONFIGURATION @@ -240,7 +230,6 @@ ynh_add_systemd_config # Set permissions on app files chown -R "$app":"$app" "$final_path" - #================================================= # SETUP SSOWAT #================================================= From b413a8009e1da13b7d36534e0c69f3fd2f710a8c Mon Sep 17 00:00:00 2001 From: yalh76 Date: Mon, 25 Mar 2019 08:36:46 +0100 Subject: [PATCH 10/41] fix source --- scripts/install | 9 ++++++--- scripts/upgrade | 7 ++++++- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/scripts/install b/scripts/install index dde41c0..350eda4 100755 --- a/scripts/install +++ b/scripts/install @@ -92,10 +92,10 @@ ynh_app_setting_set $app port $port ynh_print_info "Adding Erlang repository..." if [ "$(lsb_release --codename --short)" == "jessie" ]; then - ynh_install_extra_repo "deb http://packages.erlang-solutions.com/debian jessie contrib" + ynh_install_extra_repo --repo="deb http://packages.erlang-solutions.com/debian jessie contrib" --key=https://packages.erlang-solutions.com/debian/erlang_solutions.asc elif [ "$(lsb_release --codename --short)" == "stretch" ]; then - ynh_install_extra_repo "deb http://packages.erlang-solutions.com/debian stretch contrib" + ynh_install_extra_repo --repo="deb http://packages.erlang-solutions.com/debian stretch contrib" --key=https://packages.erlang-solutions.com/debian/erlang_solutions.asc fi #================================================= @@ -133,7 +133,10 @@ ynh_print_info "Setting up source files ..." ynh_app_setting_set $app final_path $final_path # Download, check integrity, uncompress and patch the source from app.src -ynh_setup_source "$final_path/$app" +git clone https://git.pleroma.social/pleroma/pleroma "$final_path/$app" +pushd $final_path/$app + git checkout -b master +popd #================================================= # NGINX CONFIGURATION diff --git a/scripts/upgrade b/scripts/upgrade index 65aa1ad..af15ad0 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -116,7 +116,12 @@ path_url=$(ynh_normalize_url_path $path_url) ynh_print_info "Upgrading source files..." # Download, check integrity, uncompress and patch the source from app.src -ynh_setup_source "$final_path/$app" +git clone --quiet https://git.pleroma.social/pleroma/pleroma "$final_path/upgrade" +pushd "$final_path/upgrade" + git checkout -b master +popd +cp -a "$final_path/upgrade/." "$final_path/$app/." +rm -r "$final_path/upgrade" #================================================= # NGINX CONFIGURATION From 084f2f83444e6072accddb1148594f4974f58c21 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Mon, 25 Mar 2019 08:46:17 +0100 Subject: [PATCH 11/41] Update install --- scripts/install | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/scripts/install b/scripts/install index 350eda4..a5b3f6c 100755 --- a/scripts/install +++ b/scripts/install @@ -92,11 +92,14 @@ ynh_app_setting_set $app port $port ynh_print_info "Adding Erlang repository..." if [ "$(lsb_release --codename --short)" == "jessie" ]; then - ynh_install_extra_repo --repo="deb http://packages.erlang-solutions.com/debian jessie contrib" --key=https://packages.erlang-solutions.com/debian/erlang_solutions.asc + echo "deb http://packages.erlang-solutions.com/debian jessie contrib" | tee /etc/apt/sources.list.d/erlang-solutions.list elif [ "$(lsb_release --codename --short)" == "stretch" ]; then - ynh_install_extra_repo --repo="deb http://packages.erlang-solutions.com/debian stretch contrib" --key=https://packages.erlang-solutions.com/debian/erlang_solutions.asc + echo "deb http://packages.erlang-solutions.com/debian stretch contrib" | tee /etc/apt/sources.list.d/erlang-solutions.list fi +sudo wget https://packages.erlang-solutions.com/debian/erlang_solutions.asc +sudo apt-key add erlang_solutions.asc +sudo rm erlang_solutions.asc #================================================= # INSTALL DEPENDENCIES From 06b0da5fff53961cc379485eb8b9266b7979a9f0 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Mon, 25 Mar 2019 08:53:20 +0100 Subject: [PATCH 12/41] Update install --- scripts/install | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/scripts/install b/scripts/install index a5b3f6c..350eda4 100755 --- a/scripts/install +++ b/scripts/install @@ -92,14 +92,11 @@ ynh_app_setting_set $app port $port ynh_print_info "Adding Erlang repository..." if [ "$(lsb_release --codename --short)" == "jessie" ]; then - echo "deb http://packages.erlang-solutions.com/debian jessie contrib" | tee /etc/apt/sources.list.d/erlang-solutions.list + ynh_install_extra_repo --repo="deb http://packages.erlang-solutions.com/debian jessie contrib" --key=https://packages.erlang-solutions.com/debian/erlang_solutions.asc elif [ "$(lsb_release --codename --short)" == "stretch" ]; then - echo "deb http://packages.erlang-solutions.com/debian stretch contrib" | tee /etc/apt/sources.list.d/erlang-solutions.list + ynh_install_extra_repo --repo="deb http://packages.erlang-solutions.com/debian stretch contrib" --key=https://packages.erlang-solutions.com/debian/erlang_solutions.asc fi -sudo wget https://packages.erlang-solutions.com/debian/erlang_solutions.asc -sudo apt-key add erlang_solutions.asc -sudo rm erlang_solutions.asc #================================================= # INSTALL DEPENDENCIES From 400a067c0d386727714cae53c4cf5c946010f4e0 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Mon, 25 Mar 2019 08:58:43 +0100 Subject: [PATCH 13/41] Update remove --- scripts/remove | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/remove b/scripts/remove index e93e514..30ac277 100755 --- a/scripts/remove +++ b/scripts/remove @@ -75,7 +75,7 @@ ynh_remove_app_dependencies #================================================= ynh_print_info "Removing erlang repository..." -ynh_remove_extra_repo "erlang-solutions" +ynh_remove_extra_repo #================================================= # REMOVE APP MAIN DIR From 368a7aab84d016ca7a4ceabd69c6f63b1559a80d Mon Sep 17 00:00:00 2001 From: yalh76 Date: Mon, 25 Mar 2019 08:59:56 +0100 Subject: [PATCH 14/41] Update _common.sh --- scripts/_common.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index 2592400..23a2ab9 100755 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -5,7 +5,7 @@ #================================================= # dependencies used by the app -pkg_dependencies="git build-essential postgresql postgresql-contrib elixir erlang-dev erlang-tools erlang-parsetools erlang-eldap erlang-xmerl openssl ssh sudo" +pkg_dependencies="git build-essential postgresql postgresql-contrib elixir erlang-dev erlang-tools erlang-parsetools erlang-eldap erlang-xmerl erlang-inets openssl ssh sudo" #================================================= # PERSONAL HELPERS From 3302d458872089baf98fbdf77b8fe73eeb67d766 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Mon, 25 Mar 2019 09:06:16 +0100 Subject: [PATCH 15/41] fix version --- scripts/install | 5 +---- scripts/restore | 4 ++-- scripts/upgrade | 7 +------ 3 files changed, 4 insertions(+), 12 deletions(-) diff --git a/scripts/install b/scripts/install index 350eda4..532105b 100755 --- a/scripts/install +++ b/scripts/install @@ -133,10 +133,7 @@ ynh_print_info "Setting up source files ..." ynh_app_setting_set $app final_path $final_path # Download, check integrity, uncompress and patch the source from app.src -git clone https://git.pleroma.social/pleroma/pleroma "$final_path/$app" -pushd $final_path/$app - git checkout -b master -popd +ynh_setup_source "$final_path/$app" #================================================= # NGINX CONFIGURATION diff --git a/scripts/restore b/scripts/restore index e332402..edae5e1 100755 --- a/scripts/restore +++ b/scripts/restore @@ -89,10 +89,10 @@ chown -R "$app":"$app" "$final_path" ynh_print_info "Adding Erlang repository..." if [ "$(lsb_release --codename --short)" == "jessie" ]; then - ynh_install_extra_repo "deb http://packages.erlang-solutions.com/debian jessie contrib" + ynh_install_extra_repo --repo="deb http://packages.erlang-solutions.com/debian jessie contrib" --key=https://packages.erlang-solutions.com/debian/erlang_solutions.asc elif [ "$(lsb_release --codename --short)" == "stretch" ]; then - ynh_install_extra_repo "deb http://packages.erlang-solutions.com/debian stretch contrib" + ynh_install_extra_repo --repo="deb http://packages.erlang-solutions.com/debian stretch contrib" --key=https://packages.erlang-solutions.com/debian/erlang_solutions.asc fi #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index af15ad0..65aa1ad 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -116,12 +116,7 @@ path_url=$(ynh_normalize_url_path $path_url) ynh_print_info "Upgrading source files..." # Download, check integrity, uncompress and patch the source from app.src -git clone --quiet https://git.pleroma.social/pleroma/pleroma "$final_path/upgrade" -pushd "$final_path/upgrade" - git checkout -b master -popd -cp -a "$final_path/upgrade/." "$final_path/$app/." -rm -r "$final_path/upgrade" +ynh_setup_source "$final_path/$app" #================================================= # NGINX CONFIGURATION From 32f51c460ebb14a50a5a129c50a5bb4bb90729a1 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Mon, 25 Mar 2019 09:45:42 +0100 Subject: [PATCH 16/41] Update install --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index 532105b..d335448 100755 --- a/scripts/install +++ b/scripts/install @@ -205,7 +205,7 @@ pushd $final_path/$app sudo -u "$app" MIX_ENV=prod mix local.hex --force sudo -u "$app" MIX_ENV=prod mix local.rebar --force sudo -u "$app" MIX_ENV=prod mix deps.get - sudo -u "$app" MIX_ENV=prod mix ecto.migrate + sudo -u "$app" MIX_ENV=prod mix ecto.migrate --force # Add user sudo -u "$app" MIX_ENV=prod mix pleroma.user new "$admin" "$admin_email" --password "$password" --moderator --admin -y From 6de7c92fe958be0fee5bbd19e8a3ce8dd4a628e7 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Mon, 25 Mar 2019 09:57:05 +0100 Subject: [PATCH 17/41] Update install --- scripts/install | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/install b/scripts/install index d335448..ac33e05 100755 --- a/scripts/install +++ b/scripts/install @@ -97,6 +97,7 @@ elif [ "$(lsb_release --codename --short)" == "stretch" ]; then ynh_install_extra_repo --repo="deb http://packages.erlang-solutions.com/debian stretch contrib" --key=https://packages.erlang-solutions.com/debian/erlang_solutions.asc fi +ynh_package_update #================================================= # INSTALL DEPENDENCIES From fcdce749e40c5a192f15e839dfeb9635d5967b7f Mon Sep 17 00:00:00 2001 From: yalh76 Date: Mon, 25 Mar 2019 10:00:38 +0100 Subject: [PATCH 18/41] Update install --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index ac33e05..7e24207 100755 --- a/scripts/install +++ b/scripts/install @@ -97,7 +97,7 @@ elif [ "$(lsb_release --codename --short)" == "stretch" ]; then ynh_install_extra_repo --repo="deb http://packages.erlang-solutions.com/debian stretch contrib" --key=https://packages.erlang-solutions.com/debian/erlang_solutions.asc fi -ynh_package_update +apt update #================================================= # INSTALL DEPENDENCIES From 0475bdd25e48903cdaf373b8c9875cde11f79200 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Mon, 25 Mar 2019 10:04:08 +0100 Subject: [PATCH 19/41] Update install --- scripts/install | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/scripts/install b/scripts/install index 7e24207..fdf9e68 100755 --- a/scripts/install +++ b/scripts/install @@ -92,11 +92,14 @@ ynh_app_setting_set $app port $port ynh_print_info "Adding Erlang repository..." if [ "$(lsb_release --codename --short)" == "jessie" ]; then - ynh_install_extra_repo --repo="deb http://packages.erlang-solutions.com/debian jessie contrib" --key=https://packages.erlang-solutions.com/debian/erlang_solutions.asc + echo "deb http://packages.erlang-solutions.com/debian jessie contrib" | tee /etc/apt/sources.list.d/erlang-solutions.list elif [ "$(lsb_release --codename --short)" == "stretch" ]; then - ynh_install_extra_repo --repo="deb http://packages.erlang-solutions.com/debian stretch contrib" --key=https://packages.erlang-solutions.com/debian/erlang_solutions.asc + echo "deb http://packages.erlang-solutions.com/debian stretch contrib" | tee /etc/apt/sources.list.d/erlang-solutions.list fi +sudo wget https://packages.erlang-solutions.com/debian/erlang_solutions.asc +sudo apt-key add erlang_solutions.asc +sudo rm erlang_solutions.asc apt update #================================================= From 35f4f4a032b3fd35cf6ae4baacb1d4d4feae4c70 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Mon, 25 Mar 2019 10:05:02 +0100 Subject: [PATCH 20/41] Update remove --- scripts/remove | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/remove b/scripts/remove index 30ac277..7907ede 100755 --- a/scripts/remove +++ b/scripts/remove @@ -75,7 +75,8 @@ ynh_remove_app_dependencies #================================================= ynh_print_info "Removing erlang repository..." -ynh_remove_extra_repo +ynh_secure_remove "/etc/apt/sources.list.d/erlang-solutions.list" +apt-key del A14F4FCA #================================================= # REMOVE APP MAIN DIR From e9409eef390f1c6718a5386858379d07698e2b04 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Mon, 25 Mar 2019 12:13:24 +0100 Subject: [PATCH 21/41] Update restore --- scripts/restore | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/scripts/restore b/scripts/restore index edae5e1..5d09d7f 100755 --- a/scripts/restore +++ b/scripts/restore @@ -89,11 +89,15 @@ chown -R "$app":"$app" "$final_path" ynh_print_info "Adding Erlang repository..." if [ "$(lsb_release --codename --short)" == "jessie" ]; then - ynh_install_extra_repo --repo="deb http://packages.erlang-solutions.com/debian jessie contrib" --key=https://packages.erlang-solutions.com/debian/erlang_solutions.asc + echo "deb http://packages.erlang-solutions.com/debian jessie contrib" | tee /etc/apt/sources.list.d/erlang-solutions.list elif [ "$(lsb_release --codename --short)" == "stretch" ]; then - ynh_install_extra_repo --repo="deb http://packages.erlang-solutions.com/debian stretch contrib" --key=https://packages.erlang-solutions.com/debian/erlang_solutions.asc + echo "deb http://packages.erlang-solutions.com/debian stretch contrib" | tee /etc/apt/sources.list.d/erlang-solutions.list fi +sudo wget https://packages.erlang-solutions.com/debian/erlang_solutions.asc +sudo apt-key add erlang_solutions.asc +sudo rm erlang_solutions.asc +apt update #================================================= # REINSTALL DEPENDENCIES From 5da873fef3a804e698680ca5ee593dc770e7acaf Mon Sep 17 00:00:00 2001 From: yalh76 Date: Mon, 25 Mar 2019 12:33:52 +0100 Subject: [PATCH 22/41] fix repo --- scripts/install | 3 +-- scripts/restore | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/scripts/install b/scripts/install index fdf9e68..b591fbd 100755 --- a/scripts/install +++ b/scripts/install @@ -93,8 +93,7 @@ ynh_print_info "Adding Erlang repository..." if [ "$(lsb_release --codename --short)" == "jessie" ]; then echo "deb http://packages.erlang-solutions.com/debian jessie contrib" | tee /etc/apt/sources.list.d/erlang-solutions.list -elif - [ "$(lsb_release --codename --short)" == "stretch" ]; then +elif [ "$(lsb_release --codename --short)" == "stretch" ]; then echo "deb http://packages.erlang-solutions.com/debian stretch contrib" | tee /etc/apt/sources.list.d/erlang-solutions.list fi sudo wget https://packages.erlang-solutions.com/debian/erlang_solutions.asc diff --git a/scripts/restore b/scripts/restore index 5d09d7f..c9bb64d 100755 --- a/scripts/restore +++ b/scripts/restore @@ -90,8 +90,7 @@ ynh_print_info "Adding Erlang repository..." if [ "$(lsb_release --codename --short)" == "jessie" ]; then echo "deb http://packages.erlang-solutions.com/debian jessie contrib" | tee /etc/apt/sources.list.d/erlang-solutions.list -elif - [ "$(lsb_release --codename --short)" == "stretch" ]; then +elif [ "$(lsb_release --codename --short)" == "stretch" ]; then echo "deb http://packages.erlang-solutions.com/debian stretch contrib" | tee /etc/apt/sources.list.d/erlang-solutions.list fi sudo wget https://packages.erlang-solutions.com/debian/erlang_solutions.asc From f476929bba380d9e078ba133f97cfc3f9096ea67 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Mon, 25 Mar 2019 14:12:37 +0100 Subject: [PATCH 23/41] Update check_process --- check_process | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/check_process b/check_process index 73225a3..285320a 100755 --- a/check_process +++ b/check_process @@ -25,7 +25,7 @@ multi_instance=1 incorrect_path=1 port_already_use=0 - change_url=1 + change_url=0 ;;; Levels Level 1=auto Level 2=auto From bfe15c02afb40c9c1f880b2222744af9e2ef8c86 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Mon, 25 Mar 2019 17:16:39 +0100 Subject: [PATCH 24/41] Update install --- scripts/install | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/scripts/install b/scripts/install index b591fbd..5d1b43b 100755 --- a/scripts/install +++ b/scripts/install @@ -92,14 +92,10 @@ ynh_app_setting_set $app port $port ynh_print_info "Adding Erlang repository..." if [ "$(lsb_release --codename --short)" == "jessie" ]; then - echo "deb http://packages.erlang-solutions.com/debian jessie contrib" | tee /etc/apt/sources.list.d/erlang-solutions.list + ynh_install_extra_repo --repo="deb http://packages.erlang-solutions.com/debian jessie contrib" --key="https://packages.erlang-solutions.com/debian/erlang_solutions.asc" elif [ "$(lsb_release --codename --short)" == "stretch" ]; then - echo "deb http://packages.erlang-solutions.com/debian stretch contrib" | tee /etc/apt/sources.list.d/erlang-solutions.list + ynh_install_extra_repo --repo="deb http://packages.erlang-solutions.com/debian stretch contrib" --key="https://packages.erlang-solutions.com/debian/erlang_solutions.asc" fi -sudo wget https://packages.erlang-solutions.com/debian/erlang_solutions.asc -sudo apt-key add erlang_solutions.asc -sudo rm erlang_solutions.asc -apt update #================================================= # INSTALL DEPENDENCIES From 746028ad4f8279a09f63b8cfe2d23a634ee88dbc Mon Sep 17 00:00:00 2001 From: yalh76 Date: Mon, 25 Mar 2019 17:19:50 +0100 Subject: [PATCH 25/41] fix yn,h_install_extra_repo --- scripts/install | 4 ++-- scripts/remove | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/scripts/install b/scripts/install index 5d1b43b..cffefaa 100755 --- a/scripts/install +++ b/scripts/install @@ -92,9 +92,9 @@ ynh_app_setting_set $app port $port ynh_print_info "Adding Erlang repository..." if [ "$(lsb_release --codename --short)" == "jessie" ]; then - ynh_install_extra_repo --repo="deb http://packages.erlang-solutions.com/debian jessie contrib" --key="https://packages.erlang-solutions.com/debian/erlang_solutions.asc" + ynh_install_extra_repo --repo="deb http://packages.erlang-solutions.com/debian jessie contrib" --key="https://packages.erlang-solutions.com/debian/dists/jessie/Release.gpg" elif [ "$(lsb_release --codename --short)" == "stretch" ]; then - ynh_install_extra_repo --repo="deb http://packages.erlang-solutions.com/debian stretch contrib" --key="https://packages.erlang-solutions.com/debian/erlang_solutions.asc" + ynh_install_extra_repo --repo="deb http://packages.erlang-solutions.com/debian stretch contrib" --key="https://packages.erlang-solutions.com/debian/dists/stretch/Release.gpg" fi #================================================= diff --git a/scripts/remove b/scripts/remove index 7907ede..30ac277 100755 --- a/scripts/remove +++ b/scripts/remove @@ -75,8 +75,7 @@ ynh_remove_app_dependencies #================================================= ynh_print_info "Removing erlang repository..." -ynh_secure_remove "/etc/apt/sources.list.d/erlang-solutions.list" -apt-key del A14F4FCA +ynh_remove_extra_repo #================================================= # REMOVE APP MAIN DIR From 758f8fc1187eb7699a9c67028fee090de11332db Mon Sep 17 00:00:00 2001 From: yalh76 Date: Mon, 25 Mar 2019 17:27:08 +0100 Subject: [PATCH 26/41] fix extra repo --- scripts/install | 8 ++++++-- scripts/remove | 1 + scripts/restore | 12 ++++++------ 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/scripts/install b/scripts/install index cffefaa..ac50dbe 100755 --- a/scripts/install +++ b/scripts/install @@ -91,10 +91,14 @@ ynh_app_setting_set $app port $port #================================================= ynh_print_info "Adding Erlang repository..." +wget https://packages.erlang-solutions.com/debian/erlang_solutions.asc +apt-key add erlang_solutions.asc +rm erlang_solutions.asc + if [ "$(lsb_release --codename --short)" == "jessie" ]; then - ynh_install_extra_repo --repo="deb http://packages.erlang-solutions.com/debian jessie contrib" --key="https://packages.erlang-solutions.com/debian/dists/jessie/Release.gpg" + ynh_install_extra_repo --repo="deb http://packages.erlang-solutions.com/debian jessie contrib" elif [ "$(lsb_release --codename --short)" == "stretch" ]; then - ynh_install_extra_repo --repo="deb http://packages.erlang-solutions.com/debian stretch contrib" --key="https://packages.erlang-solutions.com/debian/dists/stretch/Release.gpg" + ynh_install_extra_repo --repo="deb http://packages.erlang-solutions.com/debian stretch contrib" fi #================================================= diff --git a/scripts/remove b/scripts/remove index 30ac277..2de13fc 100755 --- a/scripts/remove +++ b/scripts/remove @@ -76,6 +76,7 @@ ynh_remove_app_dependencies ynh_print_info "Removing erlang repository..." ynh_remove_extra_repo +apt-key del A14F4FCA #================================================= # REMOVE APP MAIN DIR diff --git a/scripts/restore b/scripts/restore index c9bb64d..726bbc3 100755 --- a/scripts/restore +++ b/scripts/restore @@ -88,15 +88,15 @@ chown -R "$app":"$app" "$final_path" #================================================= ynh_print_info "Adding Erlang repository..." +wget https://packages.erlang-solutions.com/debian/erlang_solutions.asc +apt-key add erlang_solutions.asc +rm erlang_solutions.asc + if [ "$(lsb_release --codename --short)" == "jessie" ]; then - echo "deb http://packages.erlang-solutions.com/debian jessie contrib" | tee /etc/apt/sources.list.d/erlang-solutions.list + ynh_install_extra_repo --repo="deb http://packages.erlang-solutions.com/debian jessie contrib" elif [ "$(lsb_release --codename --short)" == "stretch" ]; then - echo "deb http://packages.erlang-solutions.com/debian stretch contrib" | tee /etc/apt/sources.list.d/erlang-solutions.list + ynh_install_extra_repo --repo="deb http://packages.erlang-solutions.com/debian stretch contrib" fi -sudo wget https://packages.erlang-solutions.com/debian/erlang_solutions.asc -sudo apt-key add erlang_solutions.asc -sudo rm erlang_solutions.asc -apt update #================================================= # REINSTALL DEPENDENCIES From 5ca41c27f1409423ff05c02c725c88fd6c138502 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Mon, 25 Mar 2019 17:30:27 +0100 Subject: [PATCH 27/41] Update install --- scripts/install | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/install b/scripts/install index ac50dbe..d86adcf 100755 --- a/scripts/install +++ b/scripts/install @@ -100,6 +100,7 @@ if [ "$(lsb_release --codename --short)" == "jessie" ]; then elif [ "$(lsb_release --codename --short)" == "stretch" ]; then ynh_install_extra_repo --repo="deb http://packages.erlang-solutions.com/debian stretch contrib" fi +ynh_package_update #================================================= # INSTALL DEPENDENCIES From 4acf009b400d22768a1f1460aee835b84b95f042 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Mon, 25 Mar 2019 17:36:33 +0100 Subject: [PATCH 28/41] remove ynh_add_secure_repos__2 --- scripts/install | 6 ++---- scripts/remove | 3 +-- scripts/restore | 7 +++---- 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/scripts/install b/scripts/install index d86adcf..60d6a73 100755 --- a/scripts/install +++ b/scripts/install @@ -8,7 +8,6 @@ source _common.sh source ynh_systemd_action -source ynh_add_secure_repos__2 source /usr/share/yunohost/helpers #================================================= @@ -94,11 +93,10 @@ ynh_print_info "Adding Erlang repository..." wget https://packages.erlang-solutions.com/debian/erlang_solutions.asc apt-key add erlang_solutions.asc rm erlang_solutions.asc - if [ "$(lsb_release --codename --short)" == "jessie" ]; then - ynh_install_extra_repo --repo="deb http://packages.erlang-solutions.com/debian jessie contrib" + echo "deb http://packages.erlang-solutions.com/debian jessie contrib" | tee /etc/apt/sources.list.d/$app.list elif [ "$(lsb_release --codename --short)" == "stretch" ]; then - ynh_install_extra_repo --repo="deb http://packages.erlang-solutions.com/debian stretch contrib" + echo "deb http://packages.erlang-solutions.com/debian stretch contrib" | tee /etc/apt/sources.list.d/$app.list fi ynh_package_update diff --git a/scripts/remove b/scripts/remove index 2de13fc..4089ddd 100755 --- a/scripts/remove +++ b/scripts/remove @@ -8,7 +8,6 @@ source _common.sh source ynh_systemd_action -source ynh_add_secure_repos__2 source /usr/share/yunohost/helpers #================================================= @@ -75,7 +74,7 @@ ynh_remove_app_dependencies #================================================= ynh_print_info "Removing erlang repository..." -ynh_remove_extra_repo +ynh_secure_remove "/etc/apt/sources.list.d/${app}.list" apt-key del A14F4FCA #================================================= diff --git a/scripts/restore b/scripts/restore index 726bbc3..0b9ba3e 100755 --- a/scripts/restore +++ b/scripts/restore @@ -8,7 +8,6 @@ source ../settings/scripts/_common.sh source ../settings/scripts/ynh_systemd_action -source ../settings/scripts/ynh_add_secure_repos__2 source /usr/share/yunohost/helpers #================================================= @@ -91,12 +90,12 @@ ynh_print_info "Adding Erlang repository..." wget https://packages.erlang-solutions.com/debian/erlang_solutions.asc apt-key add erlang_solutions.asc rm erlang_solutions.asc - if [ "$(lsb_release --codename --short)" == "jessie" ]; then - ynh_install_extra_repo --repo="deb http://packages.erlang-solutions.com/debian jessie contrib" + echo "deb http://packages.erlang-solutions.com/debian jessie contrib" | tee /etc/apt/sources.list.d/$app.list elif [ "$(lsb_release --codename --short)" == "stretch" ]; then - ynh_install_extra_repo --repo="deb http://packages.erlang-solutions.com/debian stretch contrib" + echo "deb http://packages.erlang-solutions.com/debian stretch contrib" | tee /etc/apt/sources.list.d/$app.list fi +ynh_package_update #================================================= # REINSTALL DEPENDENCIES From beef67cedf48577077e8738bcba32d1688b5e2be Mon Sep 17 00:00:00 2001 From: yalh76 Date: Mon, 25 Mar 2019 17:39:00 +0100 Subject: [PATCH 29/41] removing erlang-inets dependency --- scripts/_common.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index 23a2ab9..2592400 100755 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -5,7 +5,7 @@ #================================================= # dependencies used by the app -pkg_dependencies="git build-essential postgresql postgresql-contrib elixir erlang-dev erlang-tools erlang-parsetools erlang-eldap erlang-xmerl erlang-inets openssl ssh sudo" +pkg_dependencies="git build-essential postgresql postgresql-contrib elixir erlang-dev erlang-tools erlang-parsetools erlang-eldap erlang-xmerl openssl ssh sudo" #================================================= # PERSONAL HELPERS From 61abd6fa9709c2774eb5c741c45854038b87ebf9 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Mon, 25 Mar 2019 17:54:42 +0100 Subject: [PATCH 30/41] Delete ynh_add_secure_repos__2 --- scripts/ynh_add_secure_repos__2 | 166 -------------------------------- 1 file changed, 166 deletions(-) delete mode 100644 scripts/ynh_add_secure_repos__2 diff --git a/scripts/ynh_add_secure_repos__2 b/scripts/ynh_add_secure_repos__2 deleted file mode 100644 index 51a9f1b..0000000 --- a/scripts/ynh_add_secure_repos__2 +++ /dev/null @@ -1,166 +0,0 @@ -#!/bin/bash - -# Pin a repository. -# -# usage: ynh_pin_repo --package=packages --pin=pin_filter --priority=priority_value [--name=name] [--append] -# | arg: -p, --package - Packages concerned by the pin. Or all, *. -# | arg: -i, --pin - Filter for the pin. -# | arg: -p, --priority - Priority for the pin -# | arg: -n, --name - Name for the files for this repo, $app as default value. -# | arg: -a, --append - Do not overwrite existing files. -# -# See https://manpages.debian.org/stretch/apt/apt_preferences.5.en.html for information about pinning. -# -ynh_pin_repo () { - # Declare an array to define the options of this helper. - local legacy_args=pirna - declare -Ar args_array=( [p]=package= [i]=pin= [r]=priority= [n]=name= [a]=append ) - local package - local pin - local priority - local name - local append - # Manage arguments with getopts - ynh_handle_getopts_args "$@" - package="${package:-*}" - priority=${priority:-50} - name="${name:-$app}" - append=${append:-0} - - if [ $append -eq 1 ] - then - append="tee -a" - else - append="tee" - fi - - mkdir -p "/etc/apt/preferences.d" - echo "Package: $package -Pin: $pin -Pin-Priority: $priority" \ - | $append "/etc/apt/preferences.d/$name" -} - -# Add a repository. -# -# usage: ynh_add_repo --uri=uri --suite=suite --component=component [--name=name] [--append] -# | arg: -u, --uri - Uri of the repository. -# | arg: -s, --suite - Suite of the repository. -# | arg: -c, --component - Component of the repository. -# | arg: -n, --name - Name for the files for this repo, $app as default value. -# | arg: -a, --append - Do not overwrite existing files. -# -# Example for a repo like deb http://forge.yunohost.org/debian/ stretch stable -# uri suite component -# ynh_add_repo --uri=http://forge.yunohost.org/debian/ --suite=stretch --component=stable -# -ynh_add_repo () { - # Declare an array to define the options of this helper. - local legacy_args=uscna - declare -Ar args_array=( [u]=uri= [s]=suite= [c]=component= [n]=name= [a]=append ) - local uri - local suite - local component - local name - local append - # Manage arguments with getopts - ynh_handle_getopts_args "$@" - name="${name:-$app}" - append=${append:-0} - - if [ $append -eq 1 ] - then - append="tee -a" - else - append="tee" - fi - - mkdir -p "/etc/apt/sources.list.d" - # Add the new repo in sources.list.d - echo "deb $uri $suite $component" \ - | $append "/etc/apt/sources.list.d/$name.list" -} - -# Add an extra repository correctly, pin it and get the key. -# -# usage: ynh_install_extra_repo --repo="repo" [--key=key_url] [--name=name] [--append] -# | arg: -r, --repo - Complete url of the extra repository. -# | arg: -k, --key - url to get the public key. -# | arg: -n, --name - Name for the files for this repo, $app as default value. -# | arg: -a, --append - Do not overwrite existing files. -ynh_install_extra_repo () { - # Declare an array to define the options of this helper. - local legacy_args=rkna - declare -Ar args_array=( [r]=repo= [k]=key= [n]=name= [a]=append ) - local repo - local key - local name - local append - # Manage arguments with getopts - ynh_handle_getopts_args "$@" - name="${name:-$app}" - append=${append:-0} - key=${key:-0} - - if [ $append -eq 1 ] - then - append="--append" - wget_append="tee -a" - else - append="" - wget_append="tee" - fi - - # Split the repository into uri, suite and components. - # Remove "deb " at the beginning of the repo. - repo="${repo#deb }" - - # Get the uri - local uri="$(echo "$repo" | awk '{ print $1 }')" - - # Get the suite - local suite="$(echo "$repo" | awk '{ print $2 }')" - - # Get the components - local component="${repo##$uri $suite }" - - # Add the repository into sources.list.d - ynh_add_repo --uri="$uri" --suite="$suite" --component="$component" --name="$name" $append - - # Pin the new repo with the default priority, so it won't be used for upgrades. - # Build $pin from the uri without http and any sub path - local pin="${uri#*://}" - pin="${pin%%/*}" - ynh_pin_repo --package="*" --pin="origin \"$pin\"" --name="$name" $append - - # Get the public key for the repo - if [ -n "$key" ] - then - mkdir -p "/etc/apt/trusted.gpg.d" - wget -q "$key" -O - | $wget_append /etc/apt/trusted.gpg.d/$name.gpg - fi - - # Update the list of package with the new repo - ynh_package_update -} - -# Remove an extra repository and the assiociated configuration. -# -# usage: ynh_remove_extra_repo [--name=name] -# | arg: -n, --name - Name for the files for this repo, $app as default value. -ynh_remove_extra_repo () { - # Declare an array to define the options of this helper. - local legacy_args=n - declare -Ar args_array=( [n]=name= ) - local name - # Manage arguments with getopts - ynh_handle_getopts_args "$@" - name="${name:-$app}" - - ynh_secure_remove "/etc/apt/sources.list.d/$name.list" - ynh_secure_remove "/etc/apt/preferences.d/$name" - ynh_secure_remove "/etc/apt/trusted.gpg.d/$name.gpg" - - # Update the list of package to exclude the old repo - ynh_package_update -} From 4f1068bba80649d565285549f700861f44091d96 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Mon, 25 Mar 2019 18:13:32 +0100 Subject: [PATCH 31/41] Adding ynh_add_secure_repos__2 --- scripts/install | 5 +- scripts/remove | 3 +- scripts/restore | 5 +- scripts/ynh_add_secure_repos__2 | 166 ++++++++++++++++++++++++++++++++ 4 files changed, 174 insertions(+), 5 deletions(-) create mode 100644 scripts/ynh_add_secure_repos__2 diff --git a/scripts/install b/scripts/install index 60d6a73..cab5695 100755 --- a/scripts/install +++ b/scripts/install @@ -8,6 +8,7 @@ source _common.sh source ynh_systemd_action +source ynh_add_secure_repos__2 source /usr/share/yunohost/helpers #================================================= @@ -94,9 +95,9 @@ wget https://packages.erlang-solutions.com/debian/erlang_solutions.asc apt-key add erlang_solutions.asc rm erlang_solutions.asc if [ "$(lsb_release --codename --short)" == "jessie" ]; then - echo "deb http://packages.erlang-solutions.com/debian jessie contrib" | tee /etc/apt/sources.list.d/$app.list + ynh_install_extra_repo --repo="deb http://packages.erlang-solutions.com/debian jessie contrib" elif [ "$(lsb_release --codename --short)" == "stretch" ]; then - echo "deb http://packages.erlang-solutions.com/debian stretch contrib" | tee /etc/apt/sources.list.d/$app.list + ynh_install_extra_repo --repo="deb http://packages.erlang-solutions.com/debian stretch contrib" fi ynh_package_update diff --git a/scripts/remove b/scripts/remove index 4089ddd..2de13fc 100755 --- a/scripts/remove +++ b/scripts/remove @@ -8,6 +8,7 @@ source _common.sh source ynh_systemd_action +source ynh_add_secure_repos__2 source /usr/share/yunohost/helpers #================================================= @@ -74,7 +75,7 @@ ynh_remove_app_dependencies #================================================= ynh_print_info "Removing erlang repository..." -ynh_secure_remove "/etc/apt/sources.list.d/${app}.list" +ynh_remove_extra_repo apt-key del A14F4FCA #================================================= diff --git a/scripts/restore b/scripts/restore index 0b9ba3e..7779022 100755 --- a/scripts/restore +++ b/scripts/restore @@ -8,6 +8,7 @@ source ../settings/scripts/_common.sh source ../settings/scripts/ynh_systemd_action +source ../settings/scripts/ynh_add_secure_repos__2 source /usr/share/yunohost/helpers #================================================= @@ -91,9 +92,9 @@ wget https://packages.erlang-solutions.com/debian/erlang_solutions.asc apt-key add erlang_solutions.asc rm erlang_solutions.asc if [ "$(lsb_release --codename --short)" == "jessie" ]; then - echo "deb http://packages.erlang-solutions.com/debian jessie contrib" | tee /etc/apt/sources.list.d/$app.list + ynh_install_extra_repo --repo="deb http://packages.erlang-solutions.com/debian jessie contrib" elif [ "$(lsb_release --codename --short)" == "stretch" ]; then - echo "deb http://packages.erlang-solutions.com/debian stretch contrib" | tee /etc/apt/sources.list.d/$app.list + ynh_install_extra_repo --repo="deb http://packages.erlang-solutions.com/debian stretch contrib" fi ynh_package_update diff --git a/scripts/ynh_add_secure_repos__2 b/scripts/ynh_add_secure_repos__2 new file mode 100644 index 0000000..51a9f1b --- /dev/null +++ b/scripts/ynh_add_secure_repos__2 @@ -0,0 +1,166 @@ +#!/bin/bash + +# Pin a repository. +# +# usage: ynh_pin_repo --package=packages --pin=pin_filter --priority=priority_value [--name=name] [--append] +# | arg: -p, --package - Packages concerned by the pin. Or all, *. +# | arg: -i, --pin - Filter for the pin. +# | arg: -p, --priority - Priority for the pin +# | arg: -n, --name - Name for the files for this repo, $app as default value. +# | arg: -a, --append - Do not overwrite existing files. +# +# See https://manpages.debian.org/stretch/apt/apt_preferences.5.en.html for information about pinning. +# +ynh_pin_repo () { + # Declare an array to define the options of this helper. + local legacy_args=pirna + declare -Ar args_array=( [p]=package= [i]=pin= [r]=priority= [n]=name= [a]=append ) + local package + local pin + local priority + local name + local append + # Manage arguments with getopts + ynh_handle_getopts_args "$@" + package="${package:-*}" + priority=${priority:-50} + name="${name:-$app}" + append=${append:-0} + + if [ $append -eq 1 ] + then + append="tee -a" + else + append="tee" + fi + + mkdir -p "/etc/apt/preferences.d" + echo "Package: $package +Pin: $pin +Pin-Priority: $priority" \ + | $append "/etc/apt/preferences.d/$name" +} + +# Add a repository. +# +# usage: ynh_add_repo --uri=uri --suite=suite --component=component [--name=name] [--append] +# | arg: -u, --uri - Uri of the repository. +# | arg: -s, --suite - Suite of the repository. +# | arg: -c, --component - Component of the repository. +# | arg: -n, --name - Name for the files for this repo, $app as default value. +# | arg: -a, --append - Do not overwrite existing files. +# +# Example for a repo like deb http://forge.yunohost.org/debian/ stretch stable +# uri suite component +# ynh_add_repo --uri=http://forge.yunohost.org/debian/ --suite=stretch --component=stable +# +ynh_add_repo () { + # Declare an array to define the options of this helper. + local legacy_args=uscna + declare -Ar args_array=( [u]=uri= [s]=suite= [c]=component= [n]=name= [a]=append ) + local uri + local suite + local component + local name + local append + # Manage arguments with getopts + ynh_handle_getopts_args "$@" + name="${name:-$app}" + append=${append:-0} + + if [ $append -eq 1 ] + then + append="tee -a" + else + append="tee" + fi + + mkdir -p "/etc/apt/sources.list.d" + # Add the new repo in sources.list.d + echo "deb $uri $suite $component" \ + | $append "/etc/apt/sources.list.d/$name.list" +} + +# Add an extra repository correctly, pin it and get the key. +# +# usage: ynh_install_extra_repo --repo="repo" [--key=key_url] [--name=name] [--append] +# | arg: -r, --repo - Complete url of the extra repository. +# | arg: -k, --key - url to get the public key. +# | arg: -n, --name - Name for the files for this repo, $app as default value. +# | arg: -a, --append - Do not overwrite existing files. +ynh_install_extra_repo () { + # Declare an array to define the options of this helper. + local legacy_args=rkna + declare -Ar args_array=( [r]=repo= [k]=key= [n]=name= [a]=append ) + local repo + local key + local name + local append + # Manage arguments with getopts + ynh_handle_getopts_args "$@" + name="${name:-$app}" + append=${append:-0} + key=${key:-0} + + if [ $append -eq 1 ] + then + append="--append" + wget_append="tee -a" + else + append="" + wget_append="tee" + fi + + # Split the repository into uri, suite and components. + # Remove "deb " at the beginning of the repo. + repo="${repo#deb }" + + # Get the uri + local uri="$(echo "$repo" | awk '{ print $1 }')" + + # Get the suite + local suite="$(echo "$repo" | awk '{ print $2 }')" + + # Get the components + local component="${repo##$uri $suite }" + + # Add the repository into sources.list.d + ynh_add_repo --uri="$uri" --suite="$suite" --component="$component" --name="$name" $append + + # Pin the new repo with the default priority, so it won't be used for upgrades. + # Build $pin from the uri without http and any sub path + local pin="${uri#*://}" + pin="${pin%%/*}" + ynh_pin_repo --package="*" --pin="origin \"$pin\"" --name="$name" $append + + # Get the public key for the repo + if [ -n "$key" ] + then + mkdir -p "/etc/apt/trusted.gpg.d" + wget -q "$key" -O - | $wget_append /etc/apt/trusted.gpg.d/$name.gpg + fi + + # Update the list of package with the new repo + ynh_package_update +} + +# Remove an extra repository and the assiociated configuration. +# +# usage: ynh_remove_extra_repo [--name=name] +# | arg: -n, --name - Name for the files for this repo, $app as default value. +ynh_remove_extra_repo () { + # Declare an array to define the options of this helper. + local legacy_args=n + declare -Ar args_array=( [n]=name= ) + local name + # Manage arguments with getopts + ynh_handle_getopts_args "$@" + name="${name:-$app}" + + ynh_secure_remove "/etc/apt/sources.list.d/$name.list" + ynh_secure_remove "/etc/apt/preferences.d/$name" + ynh_secure_remove "/etc/apt/trusted.gpg.d/$name.gpg" + + # Update the list of package to exclude the old repo + ynh_package_update +} From 6ede12c6ef293f409a51e7079e130d8ec2d6a8ca Mon Sep 17 00:00:00 2001 From: yalh76 Date: Mon, 25 Mar 2019 18:15:58 +0100 Subject: [PATCH 32/41] fix asc --- scripts/install | 7 ++----- scripts/restore | 7 ++----- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/scripts/install b/scripts/install index cab5695..1fd1162 100755 --- a/scripts/install +++ b/scripts/install @@ -91,13 +91,10 @@ ynh_app_setting_set $app port $port #================================================= ynh_print_info "Adding Erlang repository..." -wget https://packages.erlang-solutions.com/debian/erlang_solutions.asc -apt-key add erlang_solutions.asc -rm erlang_solutions.asc if [ "$(lsb_release --codename --short)" == "jessie" ]; then - ynh_install_extra_repo --repo="deb http://packages.erlang-solutions.com/debian jessie contrib" + ynh_install_extra_repo --repo="deb http://packages.erlang-solutions.com/debian jessie contrib" --key="https://packages.erlang-solutions.com/debian/erlang_solutions.asc" elif [ "$(lsb_release --codename --short)" == "stretch" ]; then - ynh_install_extra_repo --repo="deb http://packages.erlang-solutions.com/debian stretch contrib" + ynh_install_extra_repo --repo="deb http://packages.erlang-solutions.com/debian stretch contrib" --key="https://packages.erlang-solutions.com/debian/erlang_solutions.asc" fi ynh_package_update diff --git a/scripts/restore b/scripts/restore index 7779022..7c8e87d 100755 --- a/scripts/restore +++ b/scripts/restore @@ -88,13 +88,10 @@ chown -R "$app":"$app" "$final_path" #================================================= ynh_print_info "Adding Erlang repository..." -wget https://packages.erlang-solutions.com/debian/erlang_solutions.asc -apt-key add erlang_solutions.asc -rm erlang_solutions.asc if [ "$(lsb_release --codename --short)" == "jessie" ]; then - ynh_install_extra_repo --repo="deb http://packages.erlang-solutions.com/debian jessie contrib" + ynh_install_extra_repo --repo="deb http://packages.erlang-solutions.com/debian jessie contrib" --key="https://packages.erlang-solutions.com/debian/erlang_solutions.asc" elif [ "$(lsb_release --codename --short)" == "stretch" ]; then - ynh_install_extra_repo --repo="deb http://packages.erlang-solutions.com/debian stretch contrib" + ynh_install_extra_repo --repo="deb http://packages.erlang-solutions.com/debian stretch contrib" --key="https://packages.erlang-solutions.com/debian/erlang_solutions.asc" fi ynh_package_update From 4a113e5923ad3b2d28a5f230855cd45f176dbeb3 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Mon, 25 Mar 2019 18:25:47 +0100 Subject: [PATCH 33/41] remove ynh_add_secure_repos__2 --- scripts/install | 8 +- scripts/remove | 3 +- scripts/restore | 8 +- scripts/ynh_add_secure_repos__2 | 166 -------------------------------- 4 files changed, 11 insertions(+), 174 deletions(-) delete mode 100644 scripts/ynh_add_secure_repos__2 diff --git a/scripts/install b/scripts/install index 1fd1162..60d6a73 100755 --- a/scripts/install +++ b/scripts/install @@ -8,7 +8,6 @@ source _common.sh source ynh_systemd_action -source ynh_add_secure_repos__2 source /usr/share/yunohost/helpers #================================================= @@ -91,10 +90,13 @@ ynh_app_setting_set $app port $port #================================================= ynh_print_info "Adding Erlang repository..." +wget https://packages.erlang-solutions.com/debian/erlang_solutions.asc +apt-key add erlang_solutions.asc +rm erlang_solutions.asc if [ "$(lsb_release --codename --short)" == "jessie" ]; then - ynh_install_extra_repo --repo="deb http://packages.erlang-solutions.com/debian jessie contrib" --key="https://packages.erlang-solutions.com/debian/erlang_solutions.asc" + echo "deb http://packages.erlang-solutions.com/debian jessie contrib" | tee /etc/apt/sources.list.d/$app.list elif [ "$(lsb_release --codename --short)" == "stretch" ]; then - ynh_install_extra_repo --repo="deb http://packages.erlang-solutions.com/debian stretch contrib" --key="https://packages.erlang-solutions.com/debian/erlang_solutions.asc" + echo "deb http://packages.erlang-solutions.com/debian stretch contrib" | tee /etc/apt/sources.list.d/$app.list fi ynh_package_update diff --git a/scripts/remove b/scripts/remove index 2de13fc..4089ddd 100755 --- a/scripts/remove +++ b/scripts/remove @@ -8,7 +8,6 @@ source _common.sh source ynh_systemd_action -source ynh_add_secure_repos__2 source /usr/share/yunohost/helpers #================================================= @@ -75,7 +74,7 @@ ynh_remove_app_dependencies #================================================= ynh_print_info "Removing erlang repository..." -ynh_remove_extra_repo +ynh_secure_remove "/etc/apt/sources.list.d/${app}.list" apt-key del A14F4FCA #================================================= diff --git a/scripts/restore b/scripts/restore index 7c8e87d..0b9ba3e 100755 --- a/scripts/restore +++ b/scripts/restore @@ -8,7 +8,6 @@ source ../settings/scripts/_common.sh source ../settings/scripts/ynh_systemd_action -source ../settings/scripts/ynh_add_secure_repos__2 source /usr/share/yunohost/helpers #================================================= @@ -88,10 +87,13 @@ chown -R "$app":"$app" "$final_path" #================================================= ynh_print_info "Adding Erlang repository..." +wget https://packages.erlang-solutions.com/debian/erlang_solutions.asc +apt-key add erlang_solutions.asc +rm erlang_solutions.asc if [ "$(lsb_release --codename --short)" == "jessie" ]; then - ynh_install_extra_repo --repo="deb http://packages.erlang-solutions.com/debian jessie contrib" --key="https://packages.erlang-solutions.com/debian/erlang_solutions.asc" + echo "deb http://packages.erlang-solutions.com/debian jessie contrib" | tee /etc/apt/sources.list.d/$app.list elif [ "$(lsb_release --codename --short)" == "stretch" ]; then - ynh_install_extra_repo --repo="deb http://packages.erlang-solutions.com/debian stretch contrib" --key="https://packages.erlang-solutions.com/debian/erlang_solutions.asc" + echo "deb http://packages.erlang-solutions.com/debian stretch contrib" | tee /etc/apt/sources.list.d/$app.list fi ynh_package_update diff --git a/scripts/ynh_add_secure_repos__2 b/scripts/ynh_add_secure_repos__2 deleted file mode 100644 index 51a9f1b..0000000 --- a/scripts/ynh_add_secure_repos__2 +++ /dev/null @@ -1,166 +0,0 @@ -#!/bin/bash - -# Pin a repository. -# -# usage: ynh_pin_repo --package=packages --pin=pin_filter --priority=priority_value [--name=name] [--append] -# | arg: -p, --package - Packages concerned by the pin. Or all, *. -# | arg: -i, --pin - Filter for the pin. -# | arg: -p, --priority - Priority for the pin -# | arg: -n, --name - Name for the files for this repo, $app as default value. -# | arg: -a, --append - Do not overwrite existing files. -# -# See https://manpages.debian.org/stretch/apt/apt_preferences.5.en.html for information about pinning. -# -ynh_pin_repo () { - # Declare an array to define the options of this helper. - local legacy_args=pirna - declare -Ar args_array=( [p]=package= [i]=pin= [r]=priority= [n]=name= [a]=append ) - local package - local pin - local priority - local name - local append - # Manage arguments with getopts - ynh_handle_getopts_args "$@" - package="${package:-*}" - priority=${priority:-50} - name="${name:-$app}" - append=${append:-0} - - if [ $append -eq 1 ] - then - append="tee -a" - else - append="tee" - fi - - mkdir -p "/etc/apt/preferences.d" - echo "Package: $package -Pin: $pin -Pin-Priority: $priority" \ - | $append "/etc/apt/preferences.d/$name" -} - -# Add a repository. -# -# usage: ynh_add_repo --uri=uri --suite=suite --component=component [--name=name] [--append] -# | arg: -u, --uri - Uri of the repository. -# | arg: -s, --suite - Suite of the repository. -# | arg: -c, --component - Component of the repository. -# | arg: -n, --name - Name for the files for this repo, $app as default value. -# | arg: -a, --append - Do not overwrite existing files. -# -# Example for a repo like deb http://forge.yunohost.org/debian/ stretch stable -# uri suite component -# ynh_add_repo --uri=http://forge.yunohost.org/debian/ --suite=stretch --component=stable -# -ynh_add_repo () { - # Declare an array to define the options of this helper. - local legacy_args=uscna - declare -Ar args_array=( [u]=uri= [s]=suite= [c]=component= [n]=name= [a]=append ) - local uri - local suite - local component - local name - local append - # Manage arguments with getopts - ynh_handle_getopts_args "$@" - name="${name:-$app}" - append=${append:-0} - - if [ $append -eq 1 ] - then - append="tee -a" - else - append="tee" - fi - - mkdir -p "/etc/apt/sources.list.d" - # Add the new repo in sources.list.d - echo "deb $uri $suite $component" \ - | $append "/etc/apt/sources.list.d/$name.list" -} - -# Add an extra repository correctly, pin it and get the key. -# -# usage: ynh_install_extra_repo --repo="repo" [--key=key_url] [--name=name] [--append] -# | arg: -r, --repo - Complete url of the extra repository. -# | arg: -k, --key - url to get the public key. -# | arg: -n, --name - Name for the files for this repo, $app as default value. -# | arg: -a, --append - Do not overwrite existing files. -ynh_install_extra_repo () { - # Declare an array to define the options of this helper. - local legacy_args=rkna - declare -Ar args_array=( [r]=repo= [k]=key= [n]=name= [a]=append ) - local repo - local key - local name - local append - # Manage arguments with getopts - ynh_handle_getopts_args "$@" - name="${name:-$app}" - append=${append:-0} - key=${key:-0} - - if [ $append -eq 1 ] - then - append="--append" - wget_append="tee -a" - else - append="" - wget_append="tee" - fi - - # Split the repository into uri, suite and components. - # Remove "deb " at the beginning of the repo. - repo="${repo#deb }" - - # Get the uri - local uri="$(echo "$repo" | awk '{ print $1 }')" - - # Get the suite - local suite="$(echo "$repo" | awk '{ print $2 }')" - - # Get the components - local component="${repo##$uri $suite }" - - # Add the repository into sources.list.d - ynh_add_repo --uri="$uri" --suite="$suite" --component="$component" --name="$name" $append - - # Pin the new repo with the default priority, so it won't be used for upgrades. - # Build $pin from the uri without http and any sub path - local pin="${uri#*://}" - pin="${pin%%/*}" - ynh_pin_repo --package="*" --pin="origin \"$pin\"" --name="$name" $append - - # Get the public key for the repo - if [ -n "$key" ] - then - mkdir -p "/etc/apt/trusted.gpg.d" - wget -q "$key" -O - | $wget_append /etc/apt/trusted.gpg.d/$name.gpg - fi - - # Update the list of package with the new repo - ynh_package_update -} - -# Remove an extra repository and the assiociated configuration. -# -# usage: ynh_remove_extra_repo [--name=name] -# | arg: -n, --name - Name for the files for this repo, $app as default value. -ynh_remove_extra_repo () { - # Declare an array to define the options of this helper. - local legacy_args=n - declare -Ar args_array=( [n]=name= ) - local name - # Manage arguments with getopts - ynh_handle_getopts_args "$@" - name="${name:-$app}" - - ynh_secure_remove "/etc/apt/sources.list.d/$name.list" - ynh_secure_remove "/etc/apt/preferences.d/$name" - ynh_secure_remove "/etc/apt/trusted.gpg.d/$name.gpg" - - # Update the list of package to exclude the old repo - ynh_package_update -} From e47724eaa6af56b67f6c3ff23b118b3a958464f1 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Mon, 25 Mar 2019 19:47:25 +0100 Subject: [PATCH 34/41] Update upgrade --- scripts/upgrade | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/upgrade b/scripts/upgrade index 65aa1ad..4749444 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -194,7 +194,7 @@ fi chown -R "$app":"$app" "$final_path" pushd $final_path/$app sudo -u "$app" MIX_ENV=prod mix deps.get - sudo -u "$app" MIX_ENV=prod mix ecto.migrate + sudo -u "$app" MIX_ENV=prod mix ecto.migrate --force #Generate key pair sudo -u "$app" MIX_ENV=prod mix web_push.gen.keypair >> "config/prod.secret.exs" From 6f6469637423dd07d68d05ce23c1dcdbb2a4729f Mon Sep 17 00:00:00 2001 From: yalh76 Date: Mon, 25 Mar 2019 22:01:55 +0100 Subject: [PATCH 35/41] Update install --- scripts/install | 3 --- 1 file changed, 3 deletions(-) diff --git a/scripts/install b/scripts/install index 60d6a73..92477ea 100755 --- a/scripts/install +++ b/scripts/install @@ -215,9 +215,6 @@ pushd $final_path/$app #Generate key pair sudo -u "$app" MIX_ENV=prod mix web_push.gen.keypair >> "config/prod.secret.exs" ynh_replace_string "administrator@example.com" "$admin_email" "$final_path/$app/config/prod.secret.exs" - - #Create uploads dir - mkdir uploads popd #================================================= From 6767227453c454ba83ad853397f2bcc35d3b5f4a Mon Sep 17 00:00:00 2001 From: yalh76 Date: Mon, 25 Mar 2019 22:12:36 +0100 Subject: [PATCH 36/41] Fix repository --- scripts/install | 3 +++ scripts/remove | 2 +- scripts/upgrade | 17 +++++++++++++++++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index 92477ea..60d6a73 100755 --- a/scripts/install +++ b/scripts/install @@ -215,6 +215,9 @@ pushd $final_path/$app #Generate key pair sudo -u "$app" MIX_ENV=prod mix web_push.gen.keypair >> "config/prod.secret.exs" ynh_replace_string "administrator@example.com" "$admin_email" "$final_path/$app/config/prod.secret.exs" + + #Create uploads dir + mkdir uploads popd #================================================= diff --git a/scripts/remove b/scripts/remove index 4089ddd..cf83f1d 100755 --- a/scripts/remove +++ b/scripts/remove @@ -74,7 +74,7 @@ ynh_remove_app_dependencies #================================================= ynh_print_info "Removing erlang repository..." -ynh_secure_remove "/etc/apt/sources.list.d/${app}.list" +ynh_secure_remove "/etc/apt/sources.list.d/$app.list" apt-key del A14F4FCA #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 4749444..e85410b 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -80,6 +80,9 @@ then yunohost firewall disallow TCP $port 2>&1 fi +# Remove old repository +ynh_secure_remove "/etc/apt/sources.list.d/erlang-solutions.list" + #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= @@ -139,6 +142,20 @@ then ynh_store_file_checksum "/etc/nginx/conf.d/$domain.d/$app.conf" fi +#================================================= +# ADD ERLANG REPOSITORY +#================================================= +ynh_print_info "Adding Erlang repository..." + +wget https://packages.erlang-solutions.com/debian/erlang_solutions.asc +apt-key add erlang_solutions.asc +rm erlang_solutions.asc +if [ "$(lsb_release --codename --short)" == "jessie" ]; then + echo "deb http://packages.erlang-solutions.com/debian jessie contrib" | tee /etc/apt/sources.list.d/$app.list +elif [ "$(lsb_release --codename --short)" == "stretch" ]; then + echo "deb http://packages.erlang-solutions.com/debian stretch contrib" | tee /etc/apt/sources.list.d/$app.list +fi +ynh_package_update #================================================= # UPGRADE DEPENDENCIES #================================================= From 5d82e9ee771eee5e5d35c84bf8a8decf7c80e3ca Mon Sep 17 00:00:00 2001 From: yalh76 Date: Tue, 26 Mar 2019 20:48:03 +0100 Subject: [PATCH 37/41] Bask to erlang-solutions.list --- scripts/install | 10 +++++----- scripts/remove | 2 +- scripts/restore | 10 +++++----- scripts/upgrade | 10 +++++----- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/scripts/install b/scripts/install index 60d6a73..e7bdb38 100755 --- a/scripts/install +++ b/scripts/install @@ -90,14 +90,14 @@ ynh_app_setting_set $app port $port #================================================= ynh_print_info "Adding Erlang repository..." +if [ "$(lsb_release --codename --short)" == "jessie" ]; then + echo "deb http://packages.erlang-solutions.com/debian jessie contrib" | tee /etc/apt/sources.list.d/erlang-solutions.list +elif [ "$(lsb_release --codename --short)" == "stretch" ]; then + echo "deb http://packages.erlang-solutions.com/debian stretch contrib" | tee /etc/apt/sources.list.d/erlang-solutions.list +fi wget https://packages.erlang-solutions.com/debian/erlang_solutions.asc apt-key add erlang_solutions.asc rm erlang_solutions.asc -if [ "$(lsb_release --codename --short)" == "jessie" ]; then - echo "deb http://packages.erlang-solutions.com/debian jessie contrib" | tee /etc/apt/sources.list.d/$app.list -elif [ "$(lsb_release --codename --short)" == "stretch" ]; then - echo "deb http://packages.erlang-solutions.com/debian stretch contrib" | tee /etc/apt/sources.list.d/$app.list -fi ynh_package_update #================================================= diff --git a/scripts/remove b/scripts/remove index cf83f1d..0926a6a 100755 --- a/scripts/remove +++ b/scripts/remove @@ -74,7 +74,7 @@ ynh_remove_app_dependencies #================================================= ynh_print_info "Removing erlang repository..." -ynh_secure_remove "/etc/apt/sources.list.d/$app.list" +ynh_secure_remove "/etc/apt/sources.list.d/erlang-solutions.list" apt-key del A14F4FCA #================================================= diff --git a/scripts/restore b/scripts/restore index 0b9ba3e..7188101 100755 --- a/scripts/restore +++ b/scripts/restore @@ -87,14 +87,14 @@ chown -R "$app":"$app" "$final_path" #================================================= ynh_print_info "Adding Erlang repository..." +if [ "$(lsb_release --codename --short)" == "jessie" ]; then + echo "deb http://packages.erlang-solutions.com/debian jessie contrib" | tee /etc/apt/sources.list.d/erlang-solutions.list +elif [ "$(lsb_release --codename --short)" == "stretch" ]; then + echo "deb http://packages.erlang-solutions.com/debian stretch contrib" | tee /etc/apt/sources.list.d/erlang-solutions.list +fi wget https://packages.erlang-solutions.com/debian/erlang_solutions.asc apt-key add erlang_solutions.asc rm erlang_solutions.asc -if [ "$(lsb_release --codename --short)" == "jessie" ]; then - echo "deb http://packages.erlang-solutions.com/debian jessie contrib" | tee /etc/apt/sources.list.d/$app.list -elif [ "$(lsb_release --codename --short)" == "stretch" ]; then - echo "deb http://packages.erlang-solutions.com/debian stretch contrib" | tee /etc/apt/sources.list.d/$app.list -fi ynh_package_update #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index e85410b..3659d2a 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -147,14 +147,14 @@ fi #================================================= ynh_print_info "Adding Erlang repository..." +if [ "$(lsb_release --codename --short)" == "jessie" ]; then + echo "deb http://packages.erlang-solutions.com/debian jessie contrib" | tee /etc/apt/sources.list.d/erlang-solutions.list +elif [ "$(lsb_release --codename --short)" == "stretch" ]; then + echo "deb http://packages.erlang-solutions.com/debian stretch contrib" | tee /etc/apt/sources.list.d/erlang-solutions.list +fi wget https://packages.erlang-solutions.com/debian/erlang_solutions.asc apt-key add erlang_solutions.asc rm erlang_solutions.asc -if [ "$(lsb_release --codename --short)" == "jessie" ]; then - echo "deb http://packages.erlang-solutions.com/debian jessie contrib" | tee /etc/apt/sources.list.d/$app.list -elif [ "$(lsb_release --codename --short)" == "stretch" ]; then - echo "deb http://packages.erlang-solutions.com/debian stretch contrib" | tee /etc/apt/sources.list.d/$app.list -fi ynh_package_update #================================================= # UPGRADE DEPENDENCIES From 5cf86b2298bd738b4c54ec9c395bc0a073d35e96 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Wed, 27 Mar 2019 21:39:09 +0100 Subject: [PATCH 38/41] activate check_url --- check_process | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/check_process b/check_process index 285320a..73225a3 100755 --- a/check_process +++ b/check_process @@ -25,7 +25,7 @@ multi_instance=1 incorrect_path=1 port_already_use=0 - change_url=0 + change_url=1 ;;; Levels Level 1=auto Level 2=auto From 447715a17f09b8485e1e3da9209889cfe8cee524 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Thu, 28 Mar 2019 19:03:44 +0100 Subject: [PATCH 39/41] spacing --- scripts/upgrade | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/upgrade b/scripts/upgrade index 3659d2a..1926d25 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -156,6 +156,7 @@ wget https://packages.erlang-solutions.com/debian/erlang_solutions.asc apt-key add erlang_solutions.asc rm erlang_solutions.asc ynh_package_update + #================================================= # UPGRADE DEPENDENCIES #================================================= From 37571f1818250fb2c28aeffe147b9a41fe7f985e Mon Sep 17 00:00:00 2001 From: yalh76 Date: Thu, 28 Mar 2019 19:13:37 +0100 Subject: [PATCH 40/41] Update check_process --- check_process | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/check_process b/check_process index 73225a3..285320a 100755 --- a/check_process +++ b/check_process @@ -25,7 +25,7 @@ multi_instance=1 incorrect_path=1 port_already_use=0 - change_url=1 + change_url=0 ;;; Levels Level 1=auto Level 2=auto From 472d0c92649b28d905a0bba64ff12e426d181065 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Mon, 1 Apr 2019 22:02:46 +0200 Subject: [PATCH 41/41] add upgrade from commit test --- check_process | 1 + 1 file changed, 1 insertion(+) diff --git a/check_process b/check_process index 285320a..176f79e 100755 --- a/check_process +++ b/check_process @@ -21,6 +21,7 @@ setup_private=1 setup_public=1 upgrade=1 + upgrade=1 from_commit=14d3be2f782048e64696cef85f4fb7dff1ab6181 backup_restore=1 multi_instance=1 incorrect_path=1