From 1e94b9394f44ee2f8e6ab111a6709f5378cb5138 Mon Sep 17 00:00:00 2001 From: tituspijean Date: Fri, 24 Feb 2023 00:28:22 +0100 Subject: [PATCH 01/14] [autopatch] Upgrade auto-updater --- .github/workflows/updater.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/updater.yml b/.github/workflows/updater.yml index fb72ba0..a56d7cb 100644 --- a/.github/workflows/updater.yml +++ b/.github/workflows/updater.yml @@ -14,7 +14,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Fetch the source code - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: token: ${{ secrets.GITHUB_TOKEN }} - name: Run the updater script @@ -33,7 +33,7 @@ jobs: - name: Create Pull Request id: cpr if: ${{ env.PROCEED == 'true' }} - uses: peter-evans/create-pull-request@v3 + uses: peter-evans/create-pull-request@v4 with: token: ${{ secrets.GITHUB_TOKEN }} commit-message: Update to version ${{ env.VERSION }} From 50162aefb0f6ea672fe4298dc8b178c19afcd263 Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Thu, 25 May 2023 06:21:27 +0000 Subject: [PATCH 02/14] Upgrade to v0.5.0 --- conf/amd64.src | 4 ++-- conf/arm64.src | 4 ++-- conf/armhf.src | 4 ++-- conf/i386.src | 4 ++-- manifest.json | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/conf/amd64.src b/conf/amd64.src index aa64ec4..24d74a4 100644 --- a/conf/amd64.src +++ b/conf/amd64.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://github.com/ngoduykhanh/wireguard-ui/releases/download/v0.4.0/wireguard-ui-v0.4.0-linux-amd64.tar.gz -SOURCE_SUM=30f0d124f6180dfd6fd1e383c1fd261d71d817ce3683e844e57af5d612297d08 +SOURCE_URL=https://github.com/ngoduykhanh/wireguard-ui/releases/download/v0.5.0/wireguard-ui-v0.5.0-linux-amd64.tar.gz +SOURCE_SUM=fd974152d57a8fba9f9797c3ef1d330542639cb8863c36e99782152de0e17460 SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR=false diff --git a/conf/arm64.src b/conf/arm64.src index 5e0b572..2b5ad87 100644 --- a/conf/arm64.src +++ b/conf/arm64.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://github.com/ngoduykhanh/wireguard-ui/releases/download/v0.4.0/wireguard-ui-v0.4.0-linux-arm64.tar.gz -SOURCE_SUM=813ee07d8abe7ac4e1095d5fb92555170fed7f7cfed4d2d82ca003c5eb6c9a40 +SOURCE_URL=https://github.com/ngoduykhanh/wireguard-ui/releases/download/v0.5.0/wireguard-ui-v0.5.0-linux-arm64.tar.gz +SOURCE_SUM=1a49f6cfc6b3abfe0c4a0ce5998e0f82c29cd59735c8fa3bdbf05ef1d2087224 SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR=false diff --git a/conf/armhf.src b/conf/armhf.src index 7152eea..1aa8302 100644 --- a/conf/armhf.src +++ b/conf/armhf.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://github.com/ngoduykhanh/wireguard-ui/releases/download/v0.4.0/wireguard-ui-v0.4.0-linux-arm.tar.gz -SOURCE_SUM=a73e48f24352c3a795f02c26db0a37d5cea5f9f662708fc8f3e10f7e5ad0c2b4 +SOURCE_URL=https://github.com/ngoduykhanh/wireguard-ui/releases/download/v0.5.0/wireguard-ui-v0.5.0-linux-arm.tar.gz +SOURCE_SUM=0695da19fe9348048d0700dccead116bf7b59436dd5ccbc8c9bdc232315bac4d SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR=false diff --git a/conf/i386.src b/conf/i386.src index 5fd9e8e..24e0907 100644 --- a/conf/i386.src +++ b/conf/i386.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://github.com/ngoduykhanh/wireguard-ui/releases/download/v0.4.0/wireguard-ui-v0.4.0-linux-386.tar.gz -SOURCE_SUM=6cd9dce46166a4b84a457cb53406ba0af4f4fb21aa74d9cde33e185e146a6309 +SOURCE_URL=https://github.com/ngoduykhanh/wireguard-ui/releases/download/v0.5.0/wireguard-ui-v0.5.0-linux-386.tar.gz +SOURCE_SUM=595493c3a197049d0f02ad15c01080456e1f7ea23a8eaf0d05b51f7ce35875e2 SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR=false diff --git a/manifest.json b/manifest.json index 485a754..38a9e6c 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Fast and modern VPN server, including a configuration webapp", "fr": "Serveur VPN rapide et moderne, incluant une webapp pour le configurer" }, - "version": "0.4.0~ynh1", + "version": "0.5.0~ynh1", "url": "https://github.com/ngoduykhanh/wireguard-ui", "upstream": { "license": "MIT", From 62c2d9b058a5c33b040f0641f58e0b331232f3bb Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Thu, 25 May 2023 06:21:32 +0000 Subject: [PATCH 03/14] Auto-update README --- README.md | 2 +- README_fr.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 2182090..ad0c7a7 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in WireGuard® is fast and modern VPN that utilizes state-of-the-art cryptography. It aims to be faster, simpler, leaner, and more useful than IPsec. It intends to be considerably more performant than OpenVPN. WireGuard is designed as a general purpose VPN. -**Shipped version:** 0.4.0~ynh1 +**Shipped version:** 0.5.0~ynh1 ## Screenshots diff --git a/README_fr.md b/README_fr.md index d42ec2c..4b224c9 100644 --- a/README_fr.md +++ b/README_fr.md @@ -18,7 +18,7 @@ Si vous n’avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) po WireGuard® is fast and modern VPN that utilizes state-of-the-art cryptography. It aims to be faster, simpler, leaner, and more useful than IPsec. It intends to be considerably more performant than OpenVPN. WireGuard is designed as a general purpose VPN. -**Version incluse :** 0.4.0~ynh1 +**Version incluse :** 0.5.0~ynh1 ## Captures d’écran From b32431cc82ad8044b534b44490753fdc15d6c4fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Thu, 25 May 2023 10:29:28 +0200 Subject: [PATCH 04/14] v2 --- conf/amd64.src | 6 ---- conf/arm64.src | 6 ---- conf/armhf.src | 6 ---- conf/i386.src | 6 ---- conf/wireguard_ui.service | 6 ++-- manifest.toml | 57 +++++++++++++++++++++++++++++++ scripts/_common.sh | 4 +-- scripts/backup | 16 ++++----- scripts/change_url | 70 ++++++++++++++++++------------------- scripts/install | 72 +++++++++++++++++++-------------------- scripts/remove | 24 ++++++------- scripts/restore | 40 +++++++++++----------- scripts/upgrade | 58 +++++++++++++++---------------- 13 files changed, 202 insertions(+), 169 deletions(-) delete mode 100644 conf/amd64.src delete mode 100644 conf/arm64.src delete mode 100644 conf/armhf.src delete mode 100644 conf/i386.src create mode 100644 manifest.toml diff --git a/conf/amd64.src b/conf/amd64.src deleted file mode 100644 index 24d74a4..0000000 --- a/conf/amd64.src +++ /dev/null @@ -1,6 +0,0 @@ -SOURCE_URL=https://github.com/ngoduykhanh/wireguard-ui/releases/download/v0.5.0/wireguard-ui-v0.5.0-linux-amd64.tar.gz -SOURCE_SUM=fd974152d57a8fba9f9797c3ef1d330542639cb8863c36e99782152de0e17460 -SOURCE_SUM_PRG=sha256sum -SOURCE_FORMAT=tar.gz -SOURCE_IN_SUBDIR=false -SOURCE_FILENAME= diff --git a/conf/arm64.src b/conf/arm64.src deleted file mode 100644 index 2b5ad87..0000000 --- a/conf/arm64.src +++ /dev/null @@ -1,6 +0,0 @@ -SOURCE_URL=https://github.com/ngoduykhanh/wireguard-ui/releases/download/v0.5.0/wireguard-ui-v0.5.0-linux-arm64.tar.gz -SOURCE_SUM=1a49f6cfc6b3abfe0c4a0ce5998e0f82c29cd59735c8fa3bdbf05ef1d2087224 -SOURCE_SUM_PRG=sha256sum -SOURCE_FORMAT=tar.gz -SOURCE_IN_SUBDIR=false -SOURCE_FILENAME= diff --git a/conf/armhf.src b/conf/armhf.src deleted file mode 100644 index 1aa8302..0000000 --- a/conf/armhf.src +++ /dev/null @@ -1,6 +0,0 @@ -SOURCE_URL=https://github.com/ngoduykhanh/wireguard-ui/releases/download/v0.5.0/wireguard-ui-v0.5.0-linux-arm.tar.gz -SOURCE_SUM=0695da19fe9348048d0700dccead116bf7b59436dd5ccbc8c9bdc232315bac4d -SOURCE_SUM_PRG=sha256sum -SOURCE_FORMAT=tar.gz -SOURCE_IN_SUBDIR=false -SOURCE_FILENAME= diff --git a/conf/i386.src b/conf/i386.src deleted file mode 100644 index 24e0907..0000000 --- a/conf/i386.src +++ /dev/null @@ -1,6 +0,0 @@ -SOURCE_URL=https://github.com/ngoduykhanh/wireguard-ui/releases/download/v0.5.0/wireguard-ui-v0.5.0-linux-386.tar.gz -SOURCE_SUM=595493c3a197049d0f02ad15c01080456e1f7ea23a8eaf0d05b51f7ce35875e2 -SOURCE_SUM_PRG=sha256sum -SOURCE_FORMAT=tar.gz -SOURCE_IN_SUBDIR=false -SOURCE_FILENAME= diff --git a/conf/wireguard_ui.service b/conf/wireguard_ui.service index 8ac6385..4338659 100644 --- a/conf/wireguard_ui.service +++ b/conf/wireguard_ui.service @@ -6,9 +6,9 @@ After=network.target wireguard.service Type=simple User=__APP__ Group=__APP__ -WorkingDirectory=__FINALPATH__/ -EnvironmentFile=__FINALPATH__/wireguard-ui.env -ExecStart=__FINALPATH__/wireguard-ui +WorkingDirectory=__INSTALL_DIR__/ +EnvironmentFile=__INSTALL_DIR__/wireguard-ui.env +ExecStart=__INSTALL_DIR__/wireguard-ui # Sandboxing options to harden security # Depending on specificities of your service/app, you may need to tweak these diff --git a/manifest.toml b/manifest.toml new file mode 100644 index 0000000..c9035f8 --- /dev/null +++ b/manifest.toml @@ -0,0 +1,57 @@ +packaging_format = 2 + +id = "wireguard" +name = "WireGuard" +description.en = "Fast and modern VPN server, including a configuration webapp" +description.fr = "Serveur VPN rapide et moderne, incluant une webapp pour le configurer" + +version = "0.5.0~ynh1" + +maintainers = ["tituspijean"] + +[upstream] +license = "MIT" +website = "https://www.wireguard.com/" +code = "https://github.com/ngoduykhanh/wireguard-ui" +cpe = "???" # FIXME: optional but recommended if relevant, this is meant to contain the Common Platform Enumeration, which is sort of a standard id for applications defined by the NIST. In particular, Yunohost may use this is in the future to easily track CVE (=security reports) related to apps. The CPE may be obtained by searching here: https://nvd.nist.gov/products/cpe/search. For example, for Nextcloud, the CPE is 'cpe:2.3:a:nextcloud:nextcloud' (no need to include the version number) +fund = "???" # FIXME: optional but recommended (or remove if irrelevant / not applicable). This is meant to be an URL where people can financially support this app, especially when its development is based on volunteers and/or financed by its community. YunoHost may later advertise it in the webadmin. + +[integration] +yunohost = ">= 11" +architectures = "all" # FIXME: can be replaced by a list of supported archs using the dpkg --print-architecture nomenclature (amd64/i386/armhf/arm64), for example: ["amd64", "i386"] +multi_instance = false +ldap = "?" # FIXME: replace with true, false, or "not_relevant". Not to confuse with the "sso" key : the "ldap" key corresponds to wether or not a user *can* login on the app using its YunoHost credentials. +sso = "?" # FIXME: replace with true, false, or "not_relevant". Not to confuse with the "ldap" key : the "sso" key corresponds to wether or not a user is *automatically logged-in* on the app when logged-in on the YunoHost portal. +disk = "50M" # FIXME: replace with an **estimate** minimum disk requirement. e.g. 20M, 400M, 1G, ... +ram.build = "50M" # FIXME: replace with an **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ... +ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ... + +[install] + [install.domain] + # this is a generic question - ask strings are automatically handled by Yunohost's core + type = "domain" + full_domain = true + + [install.admin] + # this is a generic question - ask strings are automatically handled by Yunohost's core + type = "user" + +[resources] + [resources.sources.main] + in_subdir = false + arm64.url = "https://github.com/ngoduykhanh/wireguard-ui/releases/download/v0.5.0/wireguard-ui-v0.5.0-linux-arm64.tar.gz" + arm64.sha256 = "1a49f6cfc6b3abfe0c4a0ce5998e0f82c29cd59735c8fa3bdbf05ef1d2087224" + amd64.url = "https://github.com/ngoduykhanh/wireguard-ui/releases/download/v0.5.0/wireguard-ui-v0.5.0-linux-amd64.tar.gz" + amd64.sha256 = "fd974152d57a8fba9f9797c3ef1d330542639cb8863c36e99782152de0e17460" + armhf.url = "https://github.com/ngoduykhanh/wireguard-ui/releases/download/v0.5.0/wireguard-ui-v0.5.0-linux-arm.tar.gz" + armhf.sha256 = "0695da19fe9348048d0700dccead116bf7b59436dd5ccbc8c9bdc232315bac4d" + i386.url = "https://github.com/ngoduykhanh/wireguard-ui/releases/download/v0.5.0/wireguard-ui-v0.5.0-linux-386.tar.gz" + i386.sha256 = "595493c3a197049d0f02ad15c01080456e1f7ea23a8eaf0d05b51f7ce35875e2" + + + [resources.system_user] + + [resources.install_dir] + + [resources.permissions] + main.url = "/" diff --git a/scripts/_common.sh b/scripts/_common.sh index ee62c6f..aa3d67d 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -9,7 +9,7 @@ interface=$(ip route | awk '/default/ { print $5 }' | head -n1) main_domain=$(cat /etc/yunohost/current_host) # dependencies used by the app -pkg_dependencies="wireguard" +#REMOVEME? pkg_dependencies="wireguard" #================================================= # PERSONAL HELPERS @@ -42,7 +42,7 @@ ynh_send_readme_to_admin() { type="${type:-install}" # Get the value of admin_mail_html - admin_mail_html=$(ynh_app_setting_get $app admin_mail_html) +#REMOVEME? admin_mail_html=$(ynh_app_setting_get $app admin_mail_html) admin_mail_html="${admin_mail_html:-0}" # Retrieve the email of users diff --git a/scripts/backup b/scripts/backup index 0e9ebff..255e6ef 100644 --- a/scripts/backup +++ b/scripts/backup @@ -14,22 +14,22 @@ source /usr/share/yunohost/helpers # MANAGE SCRIPT FAILURE #================================================= -ynh_clean_setup () { +#REMOVEME? ynh_clean_setup () { ### Remove this function if there's nothing to clean before calling the remove script. true } # Exit if an error occurs during the execution of the script -ynh_abort_if_errors +#REMOVEME? ynh_abort_if_errors #================================================= # LOAD SETTINGS #================================================= -ynh_print_info --message="Loading installation settings..." +#REMOVEME? ynh_print_info --message="Loading installation settings..." -app=$YNH_APP_INSTANCE_NAME +#REMOVEME? app=$YNH_APP_INSTANCE_NAME -final_path=$(ynh_app_setting_get --app=$app --key=final_path) -domain=$(ynh_app_setting_get --app=$app --key=domain) +#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) +#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain) #================================================= # DECLARE DATA AND CONF FILES TO BACKUP @@ -40,7 +40,7 @@ ynh_print_info --message="Declaring files to be backed up..." # BACKUP THE APP MAIN DIR #================================================= -ynh_backup --src_path="$final_path" +ynh_backup --src_path="$install_dir" #================================================= # BACKUP THE NGINX CONFIGURATION @@ -66,7 +66,7 @@ ynh_backup --src_path=/etc/systemd/system/wireguard@.service ynh_backup --src_path="/etc/wireguard" # Backing up specific config file, in case of it is not in /etc/wireguard -ynh_backup --src_path="$(jq -r ".config_file_path" $final_path/db/server/global_settings.json)" --not_mandatory +ynh_backup --src_path="$(jq -r ".config_file_path" $install_dir/db/server/global_settings.json)" --not_mandatory # Backup the sysctl config file to enable port forwarding ynh_backup --src_path="/etc/sysctl.d/$app.conf" diff --git a/scripts/change_url b/scripts/change_url index f77be7b..cedefc8 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -13,21 +13,21 @@ source /usr/share/yunohost/helpers # RETRIEVE ARGUMENTS #================================================= -old_domain=$YNH_APP_OLD_DOMAIN -old_path=$YNH_APP_OLD_PATH +#REMOVEME? old_domain=$YNH_APP_OLD_DOMAIN +#REMOVEME? old_path=$YNH_APP_OLD_PATH -new_domain=$YNH_APP_NEW_DOMAIN -new_path=$YNH_APP_NEW_PATH +#REMOVEME? new_domain=$YNH_APP_NEW_DOMAIN +#REMOVEME? new_path=$YNH_APP_NEW_PATH -app=$YNH_APP_INSTANCE_NAME +#REMOVEME? app=$YNH_APP_INSTANCE_NAME #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading installation settings..." --time --weight=1 +#REMOVEME? ynh_script_progression --message="Loading installation settings..." --time --weight=1 -# Needed for helper "ynh_add_nginx_config" -final_path=$(ynh_app_setting_get --app=$app --key=final_path) +#REMOVEME? # Needed for helper "ynh_add_nginx_config" +#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP @@ -35,31 +35,31 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path) ynh_script_progression --message="Backing up the app before changing its url (may take a while)..." --time --weight=1 # Backup the current version of the app -ynh_backup_before_upgrade -ynh_clean_setup () { +#REMOVEME? ynh_backup_before_upgrade +#REMOVEME? ynh_clean_setup () { # Remove the new domain config file, the remove script won't do it as it doesn't know yet its location. - ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" +#REMOVEME? ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" # restore it if the upgrade fails - ynh_restore_upgradebackup +#REMOVEME? ynh_restore_upgradebackup } # Exit if an error occurs during the execution of the script -ynh_abort_if_errors +#REMOVEME? ynh_abort_if_errors #================================================= # CHECK WHICH PARTS SHOULD BE CHANGED #================================================= -change_domain=0 -if [ "$old_domain" != "$new_domain" ] +#REMOVEME? change_domain=0 +#REMOVEME? if [ "$old_domain" != "$new_domain" ] then - change_domain=1 + #REMOVEME? change_domain=1 fi -change_path=0 -if [ "$old_path" != "$new_path" ] +#REMOVEME? change_path=0 +#REMOVEME? if [ "$old_path" != "$new_path" ] then - change_path=1 + #REMOVEME? change_path=1 fi #================================================= @@ -74,30 +74,30 @@ ynh_systemd_action --service_name=wireguard_ui --action="stop" --line_match="Sto #================================================= # MODIFY URL IN NGINX CONF #================================================= -ynh_script_progression --message="Updating nginx web server configuration..." --time --weight=1 +#REMOVEME? ynh_script_progression --message="Updating nginx web server configuration..." --time --weight=1 -nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf +#REMOVEME? nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf -# Change the path in the nginx config file +#REMOVEME? # Change the path in the nginx config file if [ $change_path -eq 1 ] then - # Make a backup of the original nginx config file if modified - ynh_backup_if_checksum_is_different --file="$nginx_conf_path" - # Set global variables for nginx helper - domain="$old_domain" - path_url="$new_path" - # Create a dedicated nginx config - ynh_add_nginx_config +#REMOVEME? # Make a backup of the original nginx config file if modified +#REMOVEME? ynh_backup_if_checksum_is_different --file="$nginx_conf_path" +#REMOVEME? # Set global variables for nginx helper +#REMOVEME? domain="$old_domain" +#REMOVEME? path="$new_path" +#REMOVEME? # Create a dedicated nginx config +#REMOVEME? ynh_add_nginx_config fi -# Change the domain for nginx +#REMOVEME? # Change the domain for nginx if [ $change_domain -eq 1 ] then # Delete file checksum for the old conf file location - ynh_delete_file_checksum --file="$nginx_conf_path" - mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf +#REMOVEME? ynh_delete_file_checksum --file="$nginx_conf_path" +#REMOVEME? mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf # Store file checksum for the new config file location - ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" +#REMOVEME? ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" fi #================================================= @@ -118,9 +118,9 @@ ynh_systemd_action --service_name=wireguard_ui --action="start" --line_match="ht #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading nginx web server..." --time --weight=1 +#REMOVEME? ynh_script_progression --message="Reloading nginx web server..." --time --weight=1 -ynh_systemd_action --service_name=nginx --action=reload +#REMOVEME? #REMOVEME? ynh_systemd_action --service_name=nginx --action=reload #================================================= # END OF SCRIPT diff --git a/scripts/install b/scripts/install index 242a382..948d0b8 100644 --- a/scripts/install +++ b/scripts/install @@ -13,43 +13,43 @@ source /usr/share/yunohost/helpers # MANAGE SCRIPT FAILURE #================================================= -ynh_clean_setup () { +#REMOVEME? ynh_clean_setup () { ### Remove this function if there's nothing to clean before calling the remove script. true } # Exit if an error occurs during the execution of the script -ynh_abort_if_errors +#REMOVEME? ynh_abort_if_errors #================================================= # RETRIEVE ARGUMENTS FROM THE MANIFEST #================================================= -domain=$YNH_APP_ARG_DOMAIN -path_url="/" -admin=$YNH_APP_ARG_ADMIN +#REMOVEME? domain=$YNH_APP_ARG_DOMAIN +path="/" +#REMOVEME? admin=$YNH_APP_ARG_ADMIN architecture=$YNH_ARCH -app=$YNH_APP_INSTANCE_NAME +#REMOVEME? app=$YNH_APP_INSTANCE_NAME #================================================= # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS #================================================= -ynh_script_progression --message="Validating installation parameters..." --weight=1 +#REMOVEME? ynh_script_progression --message="Validating installation parameters..." --weight=1 -final_path=/opt/yunohost/$app -test ! -e "$final_path" || ynh_die --message="This path already contains a folder" +#REMOVEME? install_dir=/opt/yunohost/$app +#REMOVEME? test ! -e "$install_dir" || ynh_die --message="This path already contains a folder" # Register (book) web path -ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url +#REMOVEME? ynh_webpath_register --app=$app --domain=$domain --path=$path #================================================= # STORE SETTINGS FROM MANIFEST #================================================= -ynh_script_progression --message="Storing installation settings..." --weight=1 +#REMOVEME? ynh_script_progression --message="Storing installation settings..." --weight=1 -ynh_app_setting_set --app=$app --key=domain --value=$domain -ynh_app_setting_set --app=$app --key=path --value=$path_url -ynh_app_setting_set --app=$app --key=admin --value=$admin +#REMOVEME? ynh_app_setting_set --app=$app --key=domain --value=$domain +#REMOVEME? ynh_app_setting_set --app=$app --key=path --value=$path +#REMOVEME? ynh_app_setting_set --app=$app --key=admin --value=$admin ynh_app_setting_set --app=$app --key=interface --value=$interface #================================================= @@ -57,15 +57,15 @@ ynh_app_setting_set --app=$app --key=interface --value=$interface #================================================= # FIND AND OPEN A PORT #================================================= -ynh_script_progression --message="Finding an available port..." --weight=1 +#REMOVEME? ynh_script_progression --message="Finding an available port..." --weight=1 # Find an available port for WireGuard -port_wg=$(ynh_find_port --port=8095) -ynh_app_setting_set --app=$app --key=port_wg --value=$port_wg +#REMOVEME? port_wg=$(ynh_find_port --port=8095) +#REMOVEME? ynh_app_setting_set --app=$app --key=port_wg --value=$port_wg # Find an available port for WireGuard UI -port=$(ynh_find_port --port=$(($port_wg+1))) -ynh_app_setting_set --app=$app --key=port --value=$port +#REMOVEME? port=$(ynh_find_port --port=$(($port_wg+1))) +#REMOVEME? ynh_app_setting_set --app=$app --key=port --value=$port # Open the WireGuard port ynh_script_progression --message="Configuring firewall..." --weight=1 @@ -74,18 +74,18 @@ ynh_exec_warn_less yunohost firewall allow --no-upnp UDP $port_wg #================================================= # INSTALL DEPENDENCIES #================================================= -ynh_script_progression --message="Installing dependencies..." --weight=7 +#REMOVEME? ynh_script_progression --message="Installing dependencies..." --weight=7 -ynh_install_app_dependencies "$pkg_dependencies" +#REMOVEME? ynh_install_app_dependencies "$pkg_dependencies" #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= ynh_script_progression --message="Setting up source files..." --weight=1 -ynh_app_setting_set --app=$app --key=final_path --value=$final_path +#REMOVEME? ynh_app_setting_set --app=$app --key=install_dir --value=$install_dir # Download, check integrity, uncompress and patch the source from app.src -ynh_setup_source --dest_dir="$final_path" --source_id="$architecture" +ynh_setup_source --dest_dir="$install_dir" #================================================= # NGINX CONFIGURATION @@ -98,10 +98,10 @@ ynh_add_nginx_config #================================================= # CREATE DEDICATED USER #================================================= -ynh_script_progression --message="Configuring system user..." --weight=1 +#REMOVEME? ynh_script_progression --message="Configuring system user..." --weight=1 # Create a system user -ynh_system_user_create --username=$app +#REMOVEME? ynh_system_user_create --username=$app #================================================= # SPECIFIC SETUP @@ -110,14 +110,14 @@ ynh_system_user_create --username=$app #================================================= # Create db directory for securing it later -mkdir -p $final_path/db/server +mkdir -p $install_dir/db/server # Add interface configuration file for the Web UI -ynh_add_config --template="../conf/interfaces.json" --destination="$final_path/db/server/interfaces.json" -ynh_delete_file_checksum --file="$final_path/db/server/interfaces.json" +ynh_add_config --template="../conf/interfaces.json" --destination="$install_dir/db/server/interfaces.json" +ynh_delete_file_checksum --file="$install_dir/db/server/interfaces.json" # Add configuration for the Web UI -ynh_add_config --template="../conf/wireguard-ui.env" --destination="$final_path/wireguard-ui.env" +ynh_add_config --template="../conf/wireguard-ui.env" --destination="$install_dir/wireguard-ui.env" # Create WireGuard configuration directory mkdir -p /etc/wireguard @@ -152,9 +152,9 @@ sysctl -p /etc/sysctl.d/$app.conf #================================================= # Set permissions to app files -chmod 750 "$final_path" -chmod -R o-rwx "$final_path" -chown -R $app: "$final_path" +chmod 750 "$install_dir" +chmod -R o-rwx "$install_dir" +chown -R $app: "$install_dir" chmod 750 /etc/wireguard chmod -R o-rwx /etc/wireguard @@ -179,16 +179,16 @@ ynh_systemd_action --service_name=wireguard_ui --action="start" --line_match="ht #================================================= # SETUP SSOWAT #================================================= -ynh_script_progression --message="Configuring permissions..." --weight=1 +#REMOVEME? ynh_script_progression --message="Configuring permissions..." --weight=1 -ynh_permission_update --permission="main" --remove="all_users" --add="$admin" +#REMOVEME? ynh_permission_update --permission="main" --remove="all_users" --add="$admin" #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading NGINX web server..." --weight=1 +#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..." --weight=1 -ynh_systemd_action --service_name=nginx --action=reload +#REMOVEME? ynh_systemd_action --service_name=nginx --action=reload #================================================= # END OF SCRIPT diff --git a/scripts/remove b/scripts/remove index 4d9d468..10b3d04 100644 --- a/scripts/remove +++ b/scripts/remove @@ -12,14 +12,14 @@ source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading installation settings..." --weight=1 +#REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=1 -app=$YNH_APP_INSTANCE_NAME +#REMOVEME? app=$YNH_APP_INSTANCE_NAME -domain=$(ynh_app_setting_get --app=$app --key=domain) -port=$(ynh_app_setting_get --app=$app --key=port) -port_wg=$(ynh_app_setting_get --app=$app --key=port_wg) -final_path=$(ynh_app_setting_get --app=$app --key=final_path) +#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain) +#REMOVEME? port=$(ynh_app_setting_get --app=$app --key=port) +#REMOVEME? port_wg=$(ynh_app_setting_get --app=$app --key=port_wg) +#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) #================================================= # STANDARD REMOVE @@ -60,18 +60,18 @@ ynh_remove_systemd_config --service=wireguard_ui #================================================= # REMOVE DEPENDENCIES #================================================= -ynh_script_progression --message="Removing dependencies..." --weight=6 +#REMOVEME? ynh_script_progression --message="Removing dependencies..." --weight=6 # Remove metapackage and its dependencies -ynh_remove_app_dependencies +#REMOVEME? ynh_remove_app_dependencies #================================================= # REMOVE APP MAIN DIR #================================================= -ynh_script_progression --message="Removing app main directory..." --weight=1 +#REMOVEME? ynh_script_progression --message="Removing app main directory..." --weight=1 # Remove the app directory securely -ynh_secure_remove --file="$final_path" +#REMOVEME? ynh_secure_remove --file="$install_dir" # Remove WireGuard configuration directory securely ynh_secure_remove --file="/etc/wireguard" @@ -119,10 +119,10 @@ ynh_secure_remove --file="/etc/sysctl.d/$app.conf" #================================================= # REMOVE DEDICATED USER #================================================= -ynh_script_progression --message="Removing the dedicated system user..." --weight=1 +#REMOVEME? ynh_script_progression --message="Removing the dedicated system user..." --weight=1 # Delete a system user -ynh_system_user_delete --username=$app +#REMOVEME? ynh_system_user_delete --username=$app #================================================= # END OF SCRIPT diff --git a/scripts/restore b/scripts/restore index e4e888b..c03767a 100644 --- a/scripts/restore +++ b/scripts/restore @@ -14,32 +14,32 @@ source /usr/share/yunohost/helpers # MANAGE SCRIPT FAILURE #================================================= -ynh_clean_setup () { +#REMOVEME? ynh_clean_setup () { #### Remove this function if there's nothing to clean before calling the remove script. true } # Exit if an error occurs during the execution of the script -ynh_abort_if_errors +#REMOVEME? ynh_abort_if_errors #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading installation settings..." --weight=1 +#REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=1 -app=$YNH_APP_INSTANCE_NAME +#REMOVEME? app=$YNH_APP_INSTANCE_NAME -domain=$(ynh_app_setting_get --app=$app --key=domain) -path_url=$(ynh_app_setting_get --app=$app --key=path) -port=$(ynh_app_setting_get --app=$app --key=port) -port_wg=$(ynh_app_setting_get --app=$app --key=port_wg) -final_path=$(ynh_app_setting_get --app=$app --key=final_path) +#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain) +#REMOVEME? path=$(ynh_app_setting_get --app=$app --key=path) +#REMOVEME? port=$(ynh_app_setting_get --app=$app --key=port) +#REMOVEME? port_wg=$(ynh_app_setting_get --app=$app --key=port_wg) +#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) #================================================= # CHECK IF THE APP CAN BE RESTORED #================================================= -ynh_script_progression --message="Validating restoration parameters..." --weight=1 +#REMOVEME? ynh_script_progression --message="Validating restoration parameters..." --weight=1 -test ! -d $final_path || ynh_die --message="There is already a directory: $final_path " +#REMOVEME? test ! -d $install_dir || ynh_die --message="There is already a directory: $install_dir " #================================================= # STANDARD RESTORATION STEPS @@ -54,25 +54,25 @@ ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= ynh_script_progression --message="Restoring the app main directory..." --weight=1 -ynh_restore_file --origin_path="$final_path" +ynh_restore_file --origin_path="$install_dir" ynh_restore_file --origin_path="/etc/wireguard" #================================================= # RECREATE THE DEDICATED USER #================================================= -ynh_script_progression --message="Recreating the dedicated system user..." --weight=1 +#REMOVEME? ynh_script_progression --message="Recreating the dedicated system user..." --weight=1 # Create the dedicated user (if not existing) -ynh_system_user_create --username=$app +#REMOVEME? ynh_system_user_create --username=$app #================================================= # RESTORE USER RIGHTS #================================================= # Restore permissions on app files -chmod 750 "$final_path" -chmod -R o-rwx "$final_path" -chown -R $app: "$final_path" +chmod 750 "$install_dir" +chmod -R o-rwx "$install_dir" +chown -R $app: "$install_dir" chmod 750 /etc/wireguard chmod -R o-rwx /etc/wireguard @@ -83,9 +83,9 @@ chown -R $app: /etc/wireguard #================================================= # REINSTALL DEPENDENCIES #================================================= -ynh_script_progression --message="Reinstalling dependencies..." --weight=5 +#REMOVEME? ynh_script_progression --message="Reinstalling dependencies..." --weight=5 -ynh_install_app_dependencies "$pkg_dependencies" +#REMOVEME? ynh_install_app_dependencies "$pkg_dependencies" #================================================= # RESTORE SYSTEMD @@ -122,7 +122,7 @@ yunohost service add wireguard_ui --description="WireGuard UI" # RESTORE VARIOUS FILES #================================================= -ynh_restore_file --origin_path=$(jq -r ".config_file_path" $final_path/db/server/global_settings.json) --not_mandatory +ynh_restore_file --origin_path=$(jq -r ".config_file_path" $install_dir/db/server/global_settings.json) --not_mandatory #================================================= # START UI SYSTEMD SERVICE diff --git a/scripts/upgrade b/scripts/upgrade index 8a94fbc..fb64171 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -12,15 +12,15 @@ source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading installation settings..." --weight=1 +#REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=1 -app=$YNH_APP_INSTANCE_NAME +#REMOVEME? app=$YNH_APP_INSTANCE_NAME -domain=$(ynh_app_setting_get --app=$app --key=domain) -path_url=$(ynh_app_setting_get --app=$app --key=path) -port=$(ynh_app_setting_get --app=$app --key=port) -port_wg=$(ynh_app_setting_get --app=$app --key=port_wg) -final_path=$(ynh_app_setting_get --app=$app --key=final_path) +#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain) +#REMOVEME? path=$(ynh_app_setting_get --app=$app --key=path) +#REMOVEME? port=$(ynh_app_setting_get --app=$app --key=port) +#REMOVEME? port_wg=$(ynh_app_setting_get --app=$app --key=port_wg) +#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) architecture=$YNH_ARCH #================================================= @@ -32,34 +32,34 @@ upgrade_type=$(ynh_check_app_version_changed) #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= -ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=1 +#REMOVEME? ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=1 # Backup the current version of the app -ynh_backup_before_upgrade -ynh_clean_setup () { +#REMOVEME? ynh_backup_before_upgrade +#REMOVEME? ynh_clean_setup () { # restore it if the upgrade fails - ynh_restore_upgradebackup +#REMOVEME? ynh_restore_upgradebackup } # Exit if an error occurs during the execution of the script -ynh_abort_if_errors +#REMOVEME? ynh_abort_if_errors #================================================= # ENSURE DOWNWARD COMPATIBILITY #================================================= ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 -# If final_path doesn't exist, create it -if [ -z "$final_path" ]; then - final_path=/opt/yunohost/$app - ynh_app_setting_set --app=$app --key=final_path --value=$final_path +# If install_dir doesn't exist, create it +if [ -z "$install_dir" ]; then +#REMOVEME? install_dir=/opt/yunohost/$app +#REMOVEME? ynh_app_setting_set --app=$app --key=install_dir --value=$install_dir fi # Change port if WireGuard port is the same as WireGuard UI's if [ $port -eq $port_wg ] then ynh_app_setting_delete --app=$app --key=port - port=$(ynh_find_port --port=$(($port_wg+1))) - ynh_app_setting_set --app=$app --key=port --value=$port +#REMOVEME? port=$(ynh_find_port --port=$(($port_wg+1))) +#REMOVEME? ynh_app_setting_set --app=$app --key=port --value=$port # Let's remove the unused is_public key too ynh_app_setting_delete --app=$app --key=is_public fi @@ -67,7 +67,7 @@ fi # WireGuard UI should be private, really. if ynh_permission_has_user --permission=main --user=visitors then - ynh_permission_update --permission=main --remove=visitors +#REMOVEME? ynh_permission_update --permission=main --remove=visitors fi # Drop sudoers file if present @@ -110,7 +110,7 @@ then ynh_script_progression --message="Upgrading source files..." --weight=1 # Download, check integrity, uncompress and patch the source from app.src - ynh_setup_source --dest_dir="$final_path" --source_id="$architecture" + ynh_setup_source --dest_dir="$install_dir" fi #================================================= @@ -119,7 +119,7 @@ fi ynh_script_progression --message="Updating a configuration file..." --weight=1 # Update configuration for the Web UI -ynh_add_config --template="../conf/wireguard-ui.env" --destination="$final_path/wireguard-ui.env" +ynh_add_config --template="../conf/wireguard-ui.env" --destination="$install_dir/wireguard-ui.env" #================================================= # NGINX CONFIGURATION @@ -132,17 +132,17 @@ ynh_add_nginx_config #================================================= # UPGRADE DEPENDENCIES #================================================= -ynh_script_progression --message="Upgrading dependencies..." --weight=7 +#REMOVEME? ynh_script_progression --message="Upgrading dependencies..." --weight=7 -ynh_install_app_dependencies "$pkg_dependencies" +#REMOVEME? ynh_install_app_dependencies "$pkg_dependencies" #================================================= # CREATE DEDICATED USER #================================================= -ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1 +#REMOVEME? ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1 # Create a dedicated user (if not existing) -ynh_system_user_create --username=$app +#REMOVEME? ynh_system_user_create --username=$app #================================================= # SETUP SYSTEMD @@ -174,9 +174,9 @@ sysctl -p /etc/sysctl.d/$app.conf #================================================= # Set permissions to app files -chmod 750 "$final_path" -chmod -R o-rwx "$final_path" -chown -R $app: "$final_path" +chmod 750 "$install_dir" +chmod -R o-rwx "$install_dir" +chown -R $app: "$install_dir" chmod 750 /etc/wireguard chmod -R o-rwx /etc/wireguard @@ -203,7 +203,7 @@ ynh_systemd_action --service_name=wireguard_ui --action="start" --line_match="ht #================================================= ynh_script_progression --message="Reloading nginx web server..." --weight=1 -ynh_systemd_action --service_name=nginx --action=reload +#REMOVEME? ynh_systemd_action --service_name=nginx --action=reload #================================================= # END OF SCRIPT From 48e483baaed3c70aae72b0e9b3690a8acb84b0ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Thu, 25 May 2023 10:42:39 +0200 Subject: [PATCH 05/14] v2 --- .github/workflows/updater.sh | 139 -------------------------- .github/workflows/updater.yml | 49 --------- doc/{DISCLAIMER.md => ADMIN.md} | 0 doc/{DISCLAIMER_fr.md => ADMIN_fr.md} | 0 manifest.json | 40 -------- manifest.toml | 26 +++-- scripts/_common.sh | 7 -- scripts/backup | 21 ---- scripts/change_url | 98 +----------------- scripts/install | 72 +------------ scripts/remove | 45 +-------- scripts/restore | 48 --------- scripts/upgrade | 57 ----------- tests.toml | 9 ++ 14 files changed, 32 insertions(+), 579 deletions(-) delete mode 100644 .github/workflows/updater.sh delete mode 100644 .github/workflows/updater.yml rename doc/{DISCLAIMER.md => ADMIN.md} (100%) rename doc/{DISCLAIMER_fr.md => ADMIN_fr.md} (100%) delete mode 100644 manifest.json create mode 100644 tests.toml diff --git a/.github/workflows/updater.sh b/.github/workflows/updater.sh deleted file mode 100644 index 8777d7a..0000000 --- a/.github/workflows/updater.sh +++ /dev/null @@ -1,139 +0,0 @@ -#!/bin/bash - -#================================================= -# PACKAGE UPDATING HELPER -#================================================= - -# This script is meant to be run by GitHub Actions -# The YunoHost-Apps organisation offers a template Action to run this script periodically -# Since each app is different, maintainers can adapt its contents so as to perform -# automatic actions when a new upstream release is detected. - -#================================================= -# FETCHING LATEST RELEASE AND ITS ASSETS -#================================================= - -# Fetching information -current_version=$(cat manifest.json | jq -j '.version|split("~")[0]') -repo=$(cat manifest.json | jq -j '.upstream.code|split("https://github.com/")[1]') -# Some jq magic is needed, because the latest upstream release is not always the latest version (e.g. security patches for older versions) -version=$(curl --silent "https://api.github.com/repos/$repo/releases" | jq -r '.[] | select( .prerelease != true ) | .tag_name' | sort -V | tail -1) -assets=($(curl --silent "https://api.github.com/repos/$repo/releases" | jq -r '[ .[] | select(.tag_name=="'$version'").assets[].browser_download_url ] | join(" ") | @sh' | tr -d "'")) - -# Later down the script, we assume the version has only digits and dots -# Sometimes the release name starts with a "v", so let's filter it out. -# You may need more tweaks here if the upstream repository has different naming conventions. -if [[ ${version:0:1} == "v" || ${version:0:1} == "V" ]]; then - version=${version:1} -fi - -# Setting up the environment variables -echo "Current version: $current_version" -echo "Latest release from upstream: $version" -echo "VERSION=$version" >> $GITHUB_ENV -# For the time being, let's assume the script will fail -echo "PROCEED=false" >> $GITHUB_ENV - -# Proceed only if the retrieved version is greater than the current one -if ! dpkg --compare-versions "$current_version" "lt" "$version" ; then - echo "::warning ::No new version available" - exit 0 -# Proceed only if a PR for this new version does not already exist -elif git ls-remote -q --exit-code --heads https://github.com/$GITHUB_REPOSITORY.git ci-auto-update-v$version ; then - echo "::warning ::A branch already exists for this update" - exit 0 -fi - -# Each release can hold multiple assets (e.g. binaries for different architectures, source code, etc.) -echo "${#assets[@]} available asset(s)" - -#================================================= -# UPDATE SOURCE FILES -#================================================= - -# Here we use the $assets variable to get the resources published in the upstream release. -# Here is an example for Grav, it has to be adapted in accordance with how the upstream releases look like. - -# Let's loop over the array of assets URLs -for asset_url in ${assets[@]}; do - -echo "Handling asset at $asset_url" - -# Assign the asset to a source file in conf/ directory -# Here we base the source file name upon a unique keyword in the assets url (admin vs. update) -# Leave $src empty to ignore the asset -case $asset_url in - *"linux-amd64.tar.gz") - src="amd64" - ;; - *"linux-arm64.tar.gz") - src="arm64" - ;; - *"linux-arm.tar.gz") - src="armhf" - ;; - *"linux-386.tar.gz") - src="i386" - ;; - *) - src="" - ;; -esac - -# If $src is not empty, let's process the asset -if [ ! -z "$src" ]; then - -# Create the temporary directory -tempdir="$(mktemp -d)" - -# Download sources and calculate checksum -filename=${asset_url##*/} -curl --silent -4 -L $asset_url -o "$tempdir/$filename" -checksum=$(sha256sum "$tempdir/$filename" | head -c 64) - -# Delete temporary directory -rm -rf $tempdir - -# Get extension -if [[ $filename == *.tar.gz ]]; then - extension=tar.gz -else - extension=${filename##*.} -fi - -# Rewrite source file -cat < conf/$src.src -SOURCE_URL=$asset_url -SOURCE_SUM=$checksum -SOURCE_SUM_PRG=sha256sum -SOURCE_FORMAT=$extension -SOURCE_IN_SUBDIR=false -SOURCE_FILENAME= -EOT -echo "... conf/$src.src updated" - -else -echo "... asset ignored" -fi - -done - -#================================================= -# SPECIFIC UPDATE STEPS -#================================================= - -# Any action on the app's source code can be done. -# The GitHub Action workflow takes care of committing all changes after this script ends. - -#================================================= -# GENERIC FINALIZATION -#================================================= - -# Replace new version in manifest -echo "$(jq -s --indent 4 ".[] | .version = \"$version~ynh1\"" manifest.json)" > manifest.json - -# No need to update the README, yunohost-bot takes care of it - -# The Action will proceed only if the PROCEED environment variable is set to true -echo "PROCEED=true" >> $GITHUB_ENV -exit 0 diff --git a/.github/workflows/updater.yml b/.github/workflows/updater.yml deleted file mode 100644 index a56d7cb..0000000 --- a/.github/workflows/updater.yml +++ /dev/null @@ -1,49 +0,0 @@ -# This workflow allows GitHub Actions to automagically update your app whenever a new upstream release is detected. -# You need to enable Actions in your repository settings, and fetch this Action from the YunoHost-Apps organization. -# This file should be enough by itself, but feel free to tune it to your needs. -# It calls updater.sh, which is where you should put the app-specific update steps. -name: Check for new upstream releases -on: - # Allow to manually trigger the workflow - workflow_dispatch: - # Run it every day at 6:00 UTC - schedule: - - cron: '0 6 * * *' -jobs: - updater: - runs-on: ubuntu-latest - steps: - - name: Fetch the source code - uses: actions/checkout@v3 - with: - token: ${{ secrets.GITHUB_TOKEN }} - - name: Run the updater script - id: run_updater - run: | - # Setting up Git user - git config --global user.name 'yunohost-bot' - git config --global user.email 'yunohost-bot@users.noreply.github.com' - # Run the updater script - /bin/bash .github/workflows/updater.sh - - name: Commit changes - id: commit - if: ${{ env.PROCEED == 'true' }} - run: | - git commit -am "Upgrade to v$VERSION" - - name: Create Pull Request - id: cpr - if: ${{ env.PROCEED == 'true' }} - uses: peter-evans/create-pull-request@v4 - with: - token: ${{ secrets.GITHUB_TOKEN }} - commit-message: Update to version ${{ env.VERSION }} - committer: 'yunohost-bot ' - author: 'yunohost-bot ' - signoff: false - base: testing - branch: ci-auto-update-v${{ env.VERSION }} - delete-branch: true - title: 'Upgrade to version ${{ env.VERSION }}' - body: | - Upgrade to v${{ env.VERSION }} - draft: false diff --git a/doc/DISCLAIMER.md b/doc/ADMIN.md similarity index 100% rename from doc/DISCLAIMER.md rename to doc/ADMIN.md diff --git a/doc/DISCLAIMER_fr.md b/doc/ADMIN_fr.md similarity index 100% rename from doc/DISCLAIMER_fr.md rename to doc/ADMIN_fr.md diff --git a/manifest.json b/manifest.json deleted file mode 100644 index 38a9e6c..0000000 --- a/manifest.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "name": "WireGuard", - "id": "wireguard", - "packaging_format": 1, - "description": { - "en": "Fast and modern VPN server, including a configuration webapp", - "fr": "Serveur VPN rapide et moderne, incluant une webapp pour le configurer" - }, - "version": "0.5.0~ynh1", - "url": "https://github.com/ngoduykhanh/wireguard-ui", - "upstream": { - "license": "MIT", - "website": "https://www.wireguard.com/", - "code": "https://github.com/ngoduykhanh/wireguard-ui" - }, - "license": "MIT", - "maintainer": { - "name": "tituspijean", - "email": "tituspijean@outlook.com" - }, - "requirements": { - "yunohost": ">= 11" - }, - "multi_instance": false, - "services": [ - "nginx" - ], - "arguments": { - "install": [ - { - "name": "domain", - "type": "domain" - }, - { - "name": "admin", - "type": "user" - } - ] - } -} diff --git a/manifest.toml b/manifest.toml index c9035f8..bec8039 100644 --- a/manifest.toml +++ b/manifest.toml @@ -13,27 +13,23 @@ maintainers = ["tituspijean"] license = "MIT" website = "https://www.wireguard.com/" code = "https://github.com/ngoduykhanh/wireguard-ui" -cpe = "???" # FIXME: optional but recommended if relevant, this is meant to contain the Common Platform Enumeration, which is sort of a standard id for applications defined by the NIST. In particular, Yunohost may use this is in the future to easily track CVE (=security reports) related to apps. The CPE may be obtained by searching here: https://nvd.nist.gov/products/cpe/search. For example, for Nextcloud, the CPE is 'cpe:2.3:a:nextcloud:nextcloud' (no need to include the version number) -fund = "???" # FIXME: optional but recommended (or remove if irrelevant / not applicable). This is meant to be an URL where people can financially support this app, especially when its development is based on volunteers and/or financed by its community. YunoHost may later advertise it in the webadmin. [integration] -yunohost = ">= 11" -architectures = "all" # FIXME: can be replaced by a list of supported archs using the dpkg --print-architecture nomenclature (amd64/i386/armhf/arm64), for example: ["amd64", "i386"] +yunohost = ">= 11.1.19" +architectures = "all" multi_instance = false -ldap = "?" # FIXME: replace with true, false, or "not_relevant". Not to confuse with the "sso" key : the "ldap" key corresponds to wether or not a user *can* login on the app using its YunoHost credentials. -sso = "?" # FIXME: replace with true, false, or "not_relevant". Not to confuse with the "ldap" key : the "sso" key corresponds to wether or not a user is *automatically logged-in* on the app when logged-in on the YunoHost portal. -disk = "50M" # FIXME: replace with an **estimate** minimum disk requirement. e.g. 20M, 400M, 1G, ... -ram.build = "50M" # FIXME: replace with an **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ... -ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ... +ldap = false +sso = false +disk = "50M" +ram.build = "50M" +ram.runtime = "50M" [install] [install.domain] - # this is a generic question - ask strings are automatically handled by Yunohost's core type = "domain" full_domain = true [install.admin] - # this is a generic question - ask strings are automatically handled by Yunohost's core type = "user" [resources] @@ -48,6 +44,10 @@ ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requiremen i386.url = "https://github.com/ngoduykhanh/wireguard-ui/releases/download/v0.5.0/wireguard-ui-v0.5.0-linux-386.tar.gz" i386.sha256 = "595493c3a197049d0f02ad15c01080456e1f7ea23a8eaf0d05b51f7ce35875e2" + [resources.ports] + main.default = 8096 + wg.default = 8095 + wg.exposed = "UDP" [resources.system_user] @@ -55,3 +55,7 @@ ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requiremen [resources.permissions] main.url = "/" + main.allowed = "admins" + + [resources.apt] + packages = "wireguard" diff --git a/scripts/_common.sh b/scripts/_common.sh index aa3d67d..24e2509 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -4,13 +4,6 @@ # COMMON VARIABLES #================================================= -interface=$(ip route | awk '/default/ { print $5 }' | head -n1) - -main_domain=$(cat /etc/yunohost/current_host) - -# dependencies used by the app -#REMOVEME? pkg_dependencies="wireguard" - #================================================= # PERSONAL HELPERS #================================================= diff --git a/scripts/backup b/scripts/backup index 255e6ef..05345fe 100644 --- a/scripts/backup +++ b/scripts/backup @@ -10,27 +10,6 @@ source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers -#================================================= -# MANAGE SCRIPT FAILURE -#================================================= - -#REMOVEME? ynh_clean_setup () { - ### Remove this function if there's nothing to clean before calling the remove script. - true -} -# Exit if an error occurs during the execution of the script -#REMOVEME? ynh_abort_if_errors - -#================================================= -# LOAD SETTINGS -#================================================= -#REMOVEME? ynh_print_info --message="Loading installation settings..." - -#REMOVEME? app=$YNH_APP_INSTANCE_NAME - -#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) -#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain) - #================================================= # DECLARE DATA AND CONF FILES TO BACKUP #================================================= diff --git a/scripts/change_url b/scripts/change_url index cedefc8..107b19d 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -9,121 +9,33 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# RETRIEVE ARGUMENTS -#================================================= - -#REMOVEME? old_domain=$YNH_APP_OLD_DOMAIN -#REMOVEME? old_path=$YNH_APP_OLD_PATH - -#REMOVEME? new_domain=$YNH_APP_NEW_DOMAIN -#REMOVEME? new_path=$YNH_APP_NEW_PATH - -#REMOVEME? app=$YNH_APP_INSTANCE_NAME - -#================================================= -# LOAD SETTINGS -#================================================= -#REMOVEME? ynh_script_progression --message="Loading installation settings..." --time --weight=1 - -#REMOVEME? # Needed for helper "ynh_add_nginx_config" -#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) - -#================================================= -# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP -#================================================= -ynh_script_progression --message="Backing up the app before changing its url (may take a while)..." --time --weight=1 - -# Backup the current version of the app -#REMOVEME? ynh_backup_before_upgrade -#REMOVEME? ynh_clean_setup () { - # Remove the new domain config file, the remove script won't do it as it doesn't know yet its location. -#REMOVEME? ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" - - # restore it if the upgrade fails -#REMOVEME? ynh_restore_upgradebackup -} -# Exit if an error occurs during the execution of the script -#REMOVEME? ynh_abort_if_errors - -#================================================= -# CHECK WHICH PARTS SHOULD BE CHANGED -#================================================= - -#REMOVEME? change_domain=0 -#REMOVEME? if [ "$old_domain" != "$new_domain" ] -then - #REMOVEME? change_domain=1 -fi - -#REMOVEME? change_path=0 -#REMOVEME? if [ "$old_path" != "$new_path" ] -then - #REMOVEME? change_path=1 -fi - #================================================= # STANDARD MODIFICATIONS #================================================= # STOP SYSTEMD SERVICE #================================================= -ynh_script_progression --message="Stopping a systemd service..." --time --weight=1 +ynh_script_progression --message="Stopping a systemd service..." --weight=1 ynh_systemd_action --service_name=wireguard_ui --action="stop" --line_match="Stopped WireGuard UI" --log_path="systemd" --timeout=30 #================================================= # MODIFY URL IN NGINX CONF #================================================= -#REMOVEME? ynh_script_progression --message="Updating nginx web server configuration..." --time --weight=1 +ynh_script_progression --message="Updating NGINX web server configuration..." --weight=1 -#REMOVEME? nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf - -#REMOVEME? # Change the path in the nginx config file -if [ $change_path -eq 1 ] -then -#REMOVEME? # Make a backup of the original nginx config file if modified -#REMOVEME? ynh_backup_if_checksum_is_different --file="$nginx_conf_path" -#REMOVEME? # Set global variables for nginx helper -#REMOVEME? domain="$old_domain" -#REMOVEME? path="$new_path" -#REMOVEME? # Create a dedicated nginx config -#REMOVEME? ynh_add_nginx_config -fi - -#REMOVEME? # Change the domain for nginx -if [ $change_domain -eq 1 ] -then - # Delete file checksum for the old conf file location -#REMOVEME? ynh_delete_file_checksum --file="$nginx_conf_path" -#REMOVEME? mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf - # Store file checksum for the new config file location -#REMOVEME? ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" -fi - -#================================================= -# SPECIFIC MODIFICATIONS -#================================================= -# ... -#================================================= +ynh_change_url_nginx_config #================================================= # GENERIC FINALISATION #================================================= # START SYSTEMD SERVICE #================================================= -ynh_script_progression --message="Starting a systemd service..." --time --weight=1 +ynh_script_progression --message="Starting a systemd service..." --weight=1 ynh_systemd_action --service_name=wireguard_ui --action="start" --line_match="http server started" --log_path="systemd" --timeout=30 -#================================================= -# RELOAD NGINX -#================================================= -#REMOVEME? ynh_script_progression --message="Reloading nginx web server..." --time --weight=1 - -#REMOVEME? #REMOVEME? ynh_systemd_action --service_name=nginx --action=reload - #================================================= # END OF SCRIPT #================================================= -ynh_script_progression --message="Change of URL completed for $app" --time --last +ynh_script_progression --message="Change of URL completed for $app" --last diff --git a/scripts/install b/scripts/install index 948d0b8..62996ef 100644 --- a/scripts/install +++ b/scripts/install @@ -24,66 +24,20 @@ source /usr/share/yunohost/helpers # RETRIEVE ARGUMENTS FROM THE MANIFEST #================================================= -#REMOVEME? domain=$YNH_APP_ARG_DOMAIN -path="/" -#REMOVEME? admin=$YNH_APP_ARG_ADMIN -architecture=$YNH_ARCH - -#REMOVEME? app=$YNH_APP_INSTANCE_NAME - -#================================================= -# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS -#================================================= -#REMOVEME? ynh_script_progression --message="Validating installation parameters..." --weight=1 - -#REMOVEME? install_dir=/opt/yunohost/$app -#REMOVEME? test ! -e "$install_dir" || ynh_die --message="This path already contains a folder" - -# Register (book) web path -#REMOVEME? ynh_webpath_register --app=$app --domain=$domain --path=$path +interface=$(ip route | awk '/default/ { print $5 }' | head -n1) +main_domain=$(cat /etc/yunohost/current_host) #================================================= # STORE SETTINGS FROM MANIFEST #================================================= -#REMOVEME? ynh_script_progression --message="Storing installation settings..." --weight=1 -#REMOVEME? ynh_app_setting_set --app=$app --key=domain --value=$domain -#REMOVEME? ynh_app_setting_set --app=$app --key=path --value=$path -#REMOVEME? ynh_app_setting_set --app=$app --key=admin --value=$admin ynh_app_setting_set --app=$app --key=interface --value=$interface -#================================================= -# STANDARD MODIFICATIONS -#================================================= -# FIND AND OPEN A PORT -#================================================= -#REMOVEME? ynh_script_progression --message="Finding an available port..." --weight=1 - -# Find an available port for WireGuard -#REMOVEME? port_wg=$(ynh_find_port --port=8095) -#REMOVEME? ynh_app_setting_set --app=$app --key=port_wg --value=$port_wg - -# Find an available port for WireGuard UI -#REMOVEME? port=$(ynh_find_port --port=$(($port_wg+1))) -#REMOVEME? ynh_app_setting_set --app=$app --key=port --value=$port - -# Open the WireGuard port -ynh_script_progression --message="Configuring firewall..." --weight=1 -ynh_exec_warn_less yunohost firewall allow --no-upnp UDP $port_wg - -#================================================= -# INSTALL DEPENDENCIES -#================================================= -#REMOVEME? ynh_script_progression --message="Installing dependencies..." --weight=7 - -#REMOVEME? ynh_install_app_dependencies "$pkg_dependencies" - #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= ynh_script_progression --message="Setting up source files..." --weight=1 -#REMOVEME? ynh_app_setting_set --app=$app --key=install_dir --value=$install_dir # Download, check integrity, uncompress and patch the source from app.src ynh_setup_source --dest_dir="$install_dir" @@ -95,14 +49,6 @@ ynh_script_progression --message="Configuring NGINX web server..." --weight=1 # Create a dedicated nginx config ynh_add_nginx_config -#================================================= -# CREATE DEDICATED USER -#================================================= -#REMOVEME? ynh_script_progression --message="Configuring system user..." --weight=1 - -# Create a system user -#REMOVEME? ynh_system_user_create --username=$app - #================================================= # SPECIFIC SETUP #================================================= @@ -176,20 +122,6 @@ ynh_script_progression --message="Starting the systemd service for the UI..." -- # Start a systemd service ynh_systemd_action --service_name=wireguard_ui --action="start" --line_match="http server started" --log_path="systemd" --timeout=30 -#================================================= -# SETUP SSOWAT -#================================================= -#REMOVEME? ynh_script_progression --message="Configuring permissions..." --weight=1 - -#REMOVEME? ynh_permission_update --permission="main" --remove="all_users" --add="$admin" - -#================================================= -# RELOAD NGINX -#================================================= -#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..." --weight=1 - -#REMOVEME? ynh_systemd_action --service_name=nginx --action=reload - #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/remove b/scripts/remove index 10b3d04..81e67fd 100644 --- a/scripts/remove +++ b/scripts/remove @@ -9,18 +9,6 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# LOAD SETTINGS -#================================================= -#REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=1 - -#REMOVEME? app=$YNH_APP_INSTANCE_NAME - -#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain) -#REMOVEME? port=$(ynh_app_setting_get --app=$app --key=port) -#REMOVEME? port_wg=$(ynh_app_setting_get --app=$app --key=port_wg) -#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) - #================================================= # STANDARD REMOVE #================================================= @@ -57,21 +45,10 @@ ynh_secure_remove --file="/etc/systemd/system/wireguard@.service" ynh_remove_systemd_config --service=wireguard_ui -#================================================= -# REMOVE DEPENDENCIES -#================================================= -#REMOVEME? ynh_script_progression --message="Removing dependencies..." --weight=6 - -# Remove metapackage and its dependencies -#REMOVEME? ynh_remove_app_dependencies - #================================================= # REMOVE APP MAIN DIR #================================================= -#REMOVEME? ynh_script_progression --message="Removing app main directory..." --weight=1 - -# Remove the app directory securely -#REMOVEME? ynh_secure_remove --file="$install_dir" +ynh_script_progression --message="Removing app main directory..." --weight=1 # Remove WireGuard configuration directory securely ynh_secure_remove --file="/etc/wireguard" @@ -92,16 +69,6 @@ ynh_script_progression --message="Removing logrotate configuration..." --weight= # Remove the app-specific logrotate config ynh_remove_logrotate -#================================================= -# CLOSE WIREGUARD PORT -#================================================= - -if yunohost firewall list | grep -q "\- $port_wg$" -then - ynh_script_progression --message="Closing port $port_wg..." --weight=1 - ynh_exec_warn_less yunohost firewall disallow UDP $port_wg -fi - #================================================= # SPECIFIC REMOVE #================================================= @@ -114,16 +81,6 @@ ynh_secure_remove --file="/etc/sudoers.d/${app}_ynh" # Remove sysctl file for port forwarding ynh_secure_remove --file="/etc/sysctl.d/$app.conf" -#================================================= -# GENERIC FINALIZATION -#================================================= -# REMOVE DEDICATED USER -#================================================= -#REMOVEME? ynh_script_progression --message="Removing the dedicated system user..." --weight=1 - -# Delete a system user -#REMOVEME? ynh_system_user_delete --username=$app - #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/restore b/scripts/restore index c03767a..4914e8c 100644 --- a/scripts/restore +++ b/scripts/restore @@ -10,37 +10,6 @@ source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers -#================================================= -# MANAGE SCRIPT FAILURE -#================================================= - -#REMOVEME? ynh_clean_setup () { - #### Remove this function if there's nothing to clean before calling the remove script. - true -} -# Exit if an error occurs during the execution of the script -#REMOVEME? ynh_abort_if_errors - -#================================================= -# LOAD SETTINGS -#================================================= -#REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=1 - -#REMOVEME? app=$YNH_APP_INSTANCE_NAME - -#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain) -#REMOVEME? path=$(ynh_app_setting_get --app=$app --key=path) -#REMOVEME? port=$(ynh_app_setting_get --app=$app --key=port) -#REMOVEME? port_wg=$(ynh_app_setting_get --app=$app --key=port_wg) -#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) - -#================================================= -# CHECK IF THE APP CAN BE RESTORED -#================================================= -#REMOVEME? ynh_script_progression --message="Validating restoration parameters..." --weight=1 - -#REMOVEME? test ! -d $install_dir || ynh_die --message="There is already a directory: $install_dir " - #================================================= # STANDARD RESTORATION STEPS #================================================= @@ -57,14 +26,6 @@ ynh_script_progression --message="Restoring the app main directory..." --weight= ynh_restore_file --origin_path="$install_dir" ynh_restore_file --origin_path="/etc/wireguard" -#================================================= -# RECREATE THE DEDICATED USER -#================================================= -#REMOVEME? ynh_script_progression --message="Recreating the dedicated system user..." --weight=1 - -# Create the dedicated user (if not existing) -#REMOVEME? ynh_system_user_create --username=$app - #================================================= # RESTORE USER RIGHTS #================================================= @@ -78,15 +39,6 @@ chmod 750 /etc/wireguard chmod -R o-rwx /etc/wireguard chown -R $app: /etc/wireguard -#================================================= -# SPECIFIC RESTORATION -#================================================= -# REINSTALL DEPENDENCIES -#================================================= -#REMOVEME? ynh_script_progression --message="Reinstalling dependencies..." --weight=5 - -#REMOVEME? ynh_install_app_dependencies "$pkg_dependencies" - #================================================= # RESTORE SYSTEMD #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index fb64171..e60e412 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -29,47 +29,12 @@ architecture=$YNH_ARCH upgrade_type=$(ynh_check_app_version_changed) -#================================================= -# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP -#================================================= -#REMOVEME? ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=1 - -# Backup the current version of the app -#REMOVEME? ynh_backup_before_upgrade -#REMOVEME? ynh_clean_setup () { - # restore it if the upgrade fails -#REMOVEME? ynh_restore_upgradebackup -} -# Exit if an error occurs during the execution of the script -#REMOVEME? ynh_abort_if_errors #================================================= # ENSURE DOWNWARD COMPATIBILITY #================================================= ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 -# If install_dir doesn't exist, create it -if [ -z "$install_dir" ]; then -#REMOVEME? install_dir=/opt/yunohost/$app -#REMOVEME? ynh_app_setting_set --app=$app --key=install_dir --value=$install_dir -fi - -# Change port if WireGuard port is the same as WireGuard UI's -if [ $port -eq $port_wg ] -then - ynh_app_setting_delete --app=$app --key=port -#REMOVEME? port=$(ynh_find_port --port=$(($port_wg+1))) -#REMOVEME? ynh_app_setting_set --app=$app --key=port --value=$port - # Let's remove the unused is_public key too - ynh_app_setting_delete --app=$app --key=is_public -fi - -# WireGuard UI should be private, really. -if ynh_permission_has_user --permission=main --user=visitors -then -#REMOVEME? ynh_permission_update --permission=main --remove=visitors -fi - # Drop sudoers file if present if [ -f "/etc/sudoers.d/${app}_ynh" ]; then ynh_secure_remove /etc/sudoers.d/${app}_ynh @@ -129,21 +94,6 @@ ynh_script_progression --message="Upgrading NGINX web server configuration..." - # Create a dedicated nginx config ynh_add_nginx_config -#================================================= -# UPGRADE DEPENDENCIES -#================================================= -#REMOVEME? ynh_script_progression --message="Upgrading dependencies..." --weight=7 - -#REMOVEME? ynh_install_app_dependencies "$pkg_dependencies" - -#================================================= -# CREATE DEDICATED USER -#================================================= -#REMOVEME? ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1 - -# Create a dedicated user (if not existing) -#REMOVEME? ynh_system_user_create --username=$app - #================================================= # SETUP SYSTEMD #================================================= @@ -198,13 +148,6 @@ ynh_script_progression --message="Starting the systemd service for the UI..." -- # Start a systemd service ynh_systemd_action --service_name=wireguard_ui --action="start" --line_match="http server started" --log_path="systemd" --timeout=30 -#================================================= -# RELOAD NGINX -#================================================= -ynh_script_progression --message="Reloading nginx web server..." --weight=1 - -#REMOVEME? ynh_systemd_action --service_name=nginx --action=reload - #================================================= # END OF SCRIPT #================================================= diff --git a/tests.toml b/tests.toml new file mode 100644 index 0000000..bfe5ee4 --- /dev/null +++ b/tests.toml @@ -0,0 +1,9 @@ +test_format = 1.0 + +[default] + + # ------------------------------- + # Commits to test upgrade from + # ------------------------------- + + test_upgrade_from.00a1a6e7.name = "Upgrade from 5.4" From 8f8b3bce7cc6af011857a2b33617b4e5cbf01e3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Thu, 25 May 2023 10:43:30 +0200 Subject: [PATCH 06/14] fix --- check_process | 20 -------------------- tests.toml | 2 +- 2 files changed, 1 insertion(+), 21 deletions(-) delete mode 100644 check_process diff --git a/check_process b/check_process deleted file mode 100644 index 84adfaa..0000000 --- a/check_process +++ /dev/null @@ -1,20 +0,0 @@ -;; Test complet - ; Manifest - domain="domain.tld" - path="/" - admin="john" - ; Checks - pkg_linter=1 - setup_sub_dir=0 - setup_root=1 - setup_nourl=0 - setup_private=1 - setup_public=0 - upgrade=1 - upgrade=1 from_commit=7462d84582a89e822424480e3192c008634384e1 - backup_restore=1 - multi_instance=0 - change_url=0 -;;; Upgrade options - ; commit=7462d84582a89e822424480e3192c008634384e1 - manifest_arg=domain=DOMAIN&path=PATH&admin=USER&is_public=0& diff --git a/tests.toml b/tests.toml index bfe5ee4..54d6f3e 100644 --- a/tests.toml +++ b/tests.toml @@ -6,4 +6,4 @@ test_format = 1.0 # Commits to test upgrade from # ------------------------------- - test_upgrade_from.00a1a6e7.name = "Upgrade from 5.4" + test_upgrade_from.15d9c1a09457fb9d71fd0519cd16a0492669a8a9.name = "Upgrade from 0.4.0~ynh1" From 500b072190b0e5833c476c3d4729b307fda08a62 Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Thu, 25 May 2023 08:42:43 +0000 Subject: [PATCH 07/14] Auto-update README --- README.md | 12 ------------ README_fr.md | 12 ------------ 2 files changed, 24 deletions(-) diff --git a/README.md b/README.md index ad0c7a7..7327305 100644 --- a/README.md +++ b/README.md @@ -25,18 +25,6 @@ WireGuard® is fast and modern VPN that utilizes state-of-the-art cryptography. ![Screenshot of WireGuard](./doc/screenshots/screenshot.png) ![Screenshot of WireGuard](./doc/screenshots/screenshot.png:Zone.Identifier) -## Disclaimers / important information - -* WireGuard for YunoHost will add a DMKS module to your Linux kernel. - * You may need to reboot your server for WireGuard to be able to start. -* The package includes WireGuard and non-official web UI to configure it. - * Do not manually alter the configuration files. -* Use YunoHost permissions panel to allow users to access the web UI. -* Only one network interface, *wg0*, can be managed with this app at the moment. -* `Status` page is not working for the time being. - -After installation, you need to `Apply Config` once in the UI before the VPN service can be started. - ## Documentation and resources * Official app website: diff --git a/README_fr.md b/README_fr.md index 4b224c9..96fbc60 100644 --- a/README_fr.md +++ b/README_fr.md @@ -25,18 +25,6 @@ WireGuard® is fast and modern VPN that utilizes state-of-the-art cryptography. ![Capture d’écran de WireGuard](./doc/screenshots/screenshot.png) ![Capture d’écran de WireGuard](./doc/screenshots/screenshot.png:Zone.Identifier) -## Avertissements / informations importantes - -* Cette application ajoutera un module DMKS à votre noyau Linux. - * Vous devriez redémarrer votre serveur pour que WireGuard puisse se lancer. -* Cette application inclut WireGuard et une interface web non-officielle pour le configurer. - * Ne modifiez pas les fichiers de configuration à la main. -* Utiliser le panneau de permissions de YunoHost pour autoriser des utilisateurs à accéder à WireGuard UI. -* Une seule interface réseau, *wg0*, peut actuellement être gérée par cette app. -* La page `Status` demeure non fonctionnelle pour l'instant. - -Après installation, vous devrez cliquer sur `Apply Config` une fois dans l'UI avant que le service VPN puisse être démarré. - ## Documentations et ressources * Site officiel de l’app : From d7eb634a9f8ec86db9ffd6662984be72f24a2d9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Thu, 25 May 2023 10:47:42 +0200 Subject: [PATCH 08/14] Update install --- scripts/install | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/scripts/install b/scripts/install index 62996ef..20ea640 100644 --- a/scripts/install +++ b/scripts/install @@ -9,17 +9,6 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# MANAGE SCRIPT FAILURE -#================================================= - -#REMOVEME? ynh_clean_setup () { - ### Remove this function if there's nothing to clean before calling the remove script. - true -} -# Exit if an error occurs during the execution of the script -#REMOVEME? ynh_abort_if_errors - #================================================= # RETRIEVE ARGUMENTS FROM THE MANIFEST #================================================= From fa0fbcef9074cec7bdd45687518cf95ec30f4248 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Thu, 25 May 2023 10:48:18 +0200 Subject: [PATCH 09/14] Delete screenshot.png:Zone.Identifier --- doc/screenshots/screenshot.png:Zone.Identifier | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 doc/screenshots/screenshot.png:Zone.Identifier diff --git a/doc/screenshots/screenshot.png:Zone.Identifier b/doc/screenshots/screenshot.png:Zone.Identifier deleted file mode 100644 index 5ff913c..0000000 --- a/doc/screenshots/screenshot.png:Zone.Identifier +++ /dev/null @@ -1,3 +0,0 @@ -[ZoneTransfer] -ZoneId=3 -HostUrl=https://user-images.githubusercontent.com/6447444/80270680-76adf980-86e4-11ea-8ca1-9237f0dfa249.png From 768bdd7b4b3c57f3b038d2472b6aad817d073dc1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Thu, 25 May 2023 10:49:00 +0200 Subject: [PATCH 10/14] Update upgrade --- scripts/upgrade | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index e60e412..637639c 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -9,27 +9,12 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# LOAD SETTINGS -#================================================= -#REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=1 - -#REMOVEME? app=$YNH_APP_INSTANCE_NAME - -#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain) -#REMOVEME? path=$(ynh_app_setting_get --app=$app --key=path) -#REMOVEME? port=$(ynh_app_setting_get --app=$app --key=port) -#REMOVEME? port_wg=$(ynh_app_setting_get --app=$app --key=port_wg) -#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) -architecture=$YNH_ARCH - #================================================= # CHECK VERSION #================================================= upgrade_type=$(ynh_check_app_version_changed) - #================================================= # ENSURE DOWNWARD COMPATIBILITY #================================================= From 672abf1019adee2dd188bab9370ca57dce1dd357 Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Thu, 25 May 2023 08:48:23 +0000 Subject: [PATCH 11/14] Auto-update README --- README.md | 1 - README_fr.md | 1 - 2 files changed, 2 deletions(-) diff --git a/README.md b/README.md index 7327305..fc8f055 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,6 @@ WireGuard® is fast and modern VPN that utilizes state-of-the-art cryptography. ## Screenshots ![Screenshot of WireGuard](./doc/screenshots/screenshot.png) -![Screenshot of WireGuard](./doc/screenshots/screenshot.png:Zone.Identifier) ## Documentation and resources diff --git a/README_fr.md b/README_fr.md index 96fbc60..acd6be3 100644 --- a/README_fr.md +++ b/README_fr.md @@ -23,7 +23,6 @@ WireGuard® is fast and modern VPN that utilizes state-of-the-art cryptography. ## Captures d’écran ![Capture d’écran de WireGuard](./doc/screenshots/screenshot.png) -![Capture d’écran de WireGuard](./doc/screenshots/screenshot.png:Zone.Identifier) ## Documentations et ressources From d0828fb8fac94ff17229040b55615accb928a154 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Thu, 25 May 2023 10:54:21 +0200 Subject: [PATCH 12/14] Update upgrade --- scripts/upgrade | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/upgrade b/scripts/upgrade index 637639c..14bd6d1 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -68,6 +68,8 @@ fi #================================================= ynh_script_progression --message="Updating a configuration file..." --weight=1 +main_domain=$(cat /etc/yunohost/current_host) + # Update configuration for the Web UI ynh_add_config --template="../conf/wireguard-ui.env" --destination="$install_dir/wireguard-ui.env" From 03907f7e412f487dbba98e78ec6b358006424ea7 Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Sun, 29 Jan 2023 07:17:44 +0000 Subject: [PATCH 13/14] Auto-update README --- README_fr.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README_fr.md b/README_fr.md index acd6be3..004d238 100644 --- a/README_fr.md +++ b/README_fr.md @@ -43,4 +43,4 @@ ou sudo yunohost app upgrade wireguard -u https://github.com/YunoHost-Apps/wireguard_ynh/tree/testing --debug ``` -**Plus d’infos sur le packaging d’applications :** \ No newline at end of file +**Plus d’infos sur le packaging d’applications :** From dc0f9508b19508074c1a66c92618159f3d82ce19 Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Sat, 17 Jun 2023 20:06:56 +0000 Subject: [PATCH 14/14] Auto-update README --- README_fr.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README_fr.md b/README_fr.md index 004d238..acd6be3 100644 --- a/README_fr.md +++ b/README_fr.md @@ -43,4 +43,4 @@ ou sudo yunohost app upgrade wireguard -u https://github.com/YunoHost-Apps/wireguard_ynh/tree/testing --debug ``` -**Plus d’infos sur le packaging d’applications :** +**Plus d’infos sur le packaging d’applications :** \ No newline at end of file