From 6b2ddd8f7753ec6ea4e35ec850aa649c052fe06c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Thu, 1 Feb 2024 12:15:36 +0100 Subject: [PATCH 01/20] Packaging v2 --- .github/workflows/updater.sh | 162 -------------------------- .github/workflows/updater.yml | 49 -------- check_process | 12 -- conf/go.amd64.src | 7 -- conf/go.arm.src | 7 -- conf/go.arm64.src | 7 -- conf/go.i386.src | 7 -- conf/lxd.src | 7 -- doc/{DISCLAIMER.md => ADMIN.md} | 0 doc/{DISCLAIMER_fr.md => ADMIN_fr.md} | 0 manifest.json | 31 ----- manifest.toml | 94 +++++++++++++++ scripts/_common.sh | 5 +- scripts/install | 61 +++------- tests.toml | 7 ++ 15 files changed, 116 insertions(+), 340 deletions(-) delete mode 100644 .github/workflows/updater.sh delete mode 100644 .github/workflows/updater.yml delete mode 100644 check_process delete mode 100644 conf/go.amd64.src delete mode 100644 conf/go.arm.src delete mode 100644 conf/go.arm64.src delete mode 100644 conf/go.i386.src delete mode 100644 conf/lxd.src rename doc/{DISCLAIMER.md => ADMIN.md} (100%) rename doc/{DISCLAIMER_fr.md => ADMIN_fr.md} (100%) delete mode 100644 manifest.json create mode 100644 manifest.toml create mode 100644 tests.toml diff --git a/.github/workflows/updater.sh b/.github/workflows/updater.sh deleted file mode 100644 index 5cae7a4..0000000 --- a/.github/workflows/updater.sh +++ /dev/null @@ -1,162 +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:3} == "lxd" ]]; then - version=${version:4} -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" - -src="lxd" - -# 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 - echo "... asset ignored" - continue -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=true -SOURCE_FILENAME= -SOURCE_EXTRACT=true -EOT -echo "... conf/$src.src updated" - -done - -#================================================= -# Update Go -#================================================= -go_url="https://go.dev/dl/?mode=json" - -go_version=$(curl --silent "$go_url" | jq -r '.[] | .version' | sort -V | tail -1) -go_arch=($(curl --silent "$go_url" | jq -r '.[] | select(.version=="'$go_version'") | .files[] | select(.os == "linux") | .arch')) -for arch in "${go_arch[@]}" -do - filename=$(curl --silent "$go_url" | jq -r '.[] | select(.version=="'$go_version'") | .files[] | select(.os == "linux") | select(.arch == "'$arch'") | .filename') - checksum=$(curl --silent "$go_url" | jq -r '.[] | select(.version=="'$go_version'") | .files[] | select(.os == "linux") | select(.arch == "'$arch'") | .sha256') - case $arch in - *"amd64"*) - src="amd64" - ;; - *"386"*) - src="i386" - ;; - *"arm64"*) - src="arm64" - ;; - *"armv6l"*) - src="arm" - ;; - *) - src="" - ;; - esac - - if [ -z "$src" ]; then - continue - fi - - # Rewrite source file - cat < conf/go.$src.src -SOURCE_URL=https://go.dev/dl/$filename -SOURCE_SUM=$checksum -SOURCE_SUM_PRG=sha256sum -SOURCE_FORMAT=tar.gz -SOURCE_IN_SUBDIR=true -SOURCE_FILENAME= -SOURCE_EXTRACT=true -EOT - echo "... conf/go.$src.src updated" - -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/check_process b/check_process deleted file mode 100644 index 7affb53..0000000 --- a/check_process +++ /dev/null @@ -1,12 +0,0 @@ -;; Test complet - ; Manifest - ; Checks - pkg_linter=1 - setup_nourl=1 - upgrade=1 - upgrade=1 from_commit=b66ae64c2dae8595c817f058c4e45cd7cc40ac64 - backup_restore=1 -;;; Options -Email= -Notification=none - diff --git a/conf/go.amd64.src b/conf/go.amd64.src deleted file mode 100644 index 4c0a560..0000000 --- a/conf/go.amd64.src +++ /dev/null @@ -1,7 +0,0 @@ -SOURCE_URL=https://go.dev/dl/go1.21.5.linux-amd64.tar.gz -SOURCE_SUM=e2bc0b3e4b64111ec117295c088bde5f00eeed1567999ff77bc859d7df70078e -SOURCE_SUM_PRG=sha256sum -SOURCE_FORMAT=tar.gz -SOURCE_IN_SUBDIR=true -SOURCE_FILENAME= -SOURCE_EXTRACT=true diff --git a/conf/go.arm.src b/conf/go.arm.src deleted file mode 100644 index 06a18bc..0000000 --- a/conf/go.arm.src +++ /dev/null @@ -1,7 +0,0 @@ -SOURCE_URL=https://go.dev/dl/go1.21.5.linux-armv6l.tar.gz -SOURCE_SUM=837f4bf4e22fcdf920ffeaa4abf3d02d1314e03725431065f4d44c46a01b42fe -SOURCE_SUM_PRG=sha256sum -SOURCE_FORMAT=tar.gz -SOURCE_IN_SUBDIR=true -SOURCE_FILENAME= -SOURCE_EXTRACT=true diff --git a/conf/go.arm64.src b/conf/go.arm64.src deleted file mode 100644 index 5eec401..0000000 --- a/conf/go.arm64.src +++ /dev/null @@ -1,7 +0,0 @@ -SOURCE_URL=https://go.dev/dl/go1.21.5.linux-arm64.tar.gz -SOURCE_SUM=841cced7ecda9b2014f139f5bab5ae31785f35399f236b8b3e75dff2a2978d96 -SOURCE_SUM_PRG=sha256sum -SOURCE_FORMAT=tar.gz -SOURCE_IN_SUBDIR=true -SOURCE_FILENAME= -SOURCE_EXTRACT=true diff --git a/conf/go.i386.src b/conf/go.i386.src deleted file mode 100644 index 0d6add7..0000000 --- a/conf/go.i386.src +++ /dev/null @@ -1,7 +0,0 @@ -SOURCE_URL=https://go.dev/dl/go1.21.5.linux-386.tar.gz -SOURCE_SUM=8f4dba9cf5c61757bbd7e9ebdb93b6a30a1b03f4a636a1ba0cc2f27b907ab8e1 -SOURCE_SUM_PRG=sha256sum -SOURCE_FORMAT=tar.gz -SOURCE_IN_SUBDIR=true -SOURCE_FILENAME= -SOURCE_EXTRACT=true diff --git a/conf/lxd.src b/conf/lxd.src deleted file mode 100644 index 473da13..0000000 --- a/conf/lxd.src +++ /dev/null @@ -1,7 +0,0 @@ -SOURCE_URL=https://github.com/canonical/lxd/releases/download/lxd-5.20/lxd-5.20.tar.gz -SOURCE_SUM=2f958b757f4cde64d0f3578da0bda9ee5965a3a70ec0956eddf8287d1290167f -SOURCE_SUM_PRG=sha256sum -SOURCE_FORMAT=tar.gz -SOURCE_IN_SUBDIR=true -SOURCE_FILENAME= -SOURCE_EXTRACT=true 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 92f3592..0000000 --- a/manifest.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "name": "LXD", - "id": "lxd", - "packaging_format": 1, - "description": { - "en": "Offers a user experience similar to virtual machines but using Linux containers instead.", - "fr": "Offre une expérience utilisateur similaire aux machines virtuelles mais en utilisant des conteneurs Linux à la place." - }, - "version": "5.20~ynh1", - "url": "https://example.com", - "upstream": { - "license": "Apache-2.0", - "website": "https://linuxcontainers.org/lxd/", - "demo": "https://linuxcontainers.org/lxd/try-it/", - "admindoc": "https://linuxcontainers.org/lxd/docs/master/index.html", - "code": "https://github.com/canonical/lxd" - }, - "license": "Apache-2.0", - "maintainer": { - "name": "kay0u", - "email": "pierre@kayou.io" - }, - "requirements": { - "yunohost": ">= 4.3.0" - }, - "multi_instance": false, - "services": [], - "arguments": { - "install": [] - } -} diff --git a/manifest.toml b/manifest.toml new file mode 100644 index 0000000..5f82f70 --- /dev/null +++ b/manifest.toml @@ -0,0 +1,94 @@ +#:schema https://raw.githubusercontent.com/YunoHost/apps/master/schemas/manifest.v2.schema.json + +packaging_format = 2 + +id = "lxd" +name = "LXD" +description.en = "Offers a user experience similar to virtual machines but using Linux containers instead." +description.fr = "Offre une expérience utilisateur similaire aux machines virtuelles mais en utilisant des conteneurs Linux à la place." + +version = "5.20~ynh1" + +maintainers = ["kay0u"] + +[upstream] +license = "Apache-2.0" +website = "https://linuxcontainers.org/lxd/" +demo = "https://linuxcontainers.org/lxd/try-it/" +admindoc = "https://linuxcontainers.org/lxd/docs/master/index.html" +code = "https://github.com/canonical/lxd" +cpe = "???" + +[integration] +yunohost = ">= 4.3.0" +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 = "not_relevant" +sso = "not_relevant" +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] + +[resources] + [resources.sources] + [resources.sources.go] + amd64.url = "https://go.dev/dl/go1.21.5.linux-amd64.tar.gz" + amd64.sha256 = "e2bc0b3e4b64111ec117295c088bde5f00eeed1567999ff77bc859d7df70078e" + i386.url = "https://go.dev/dl/go1.21.5.linux-386.tar.gz" + i386.sha256 = "8f4dba9cf5c61757bbd7e9ebdb93b6a30a1b03f4a636a1ba0cc2f27b907ab8e1" + arm64.url = "https://go.dev/dl/go1.21.5.linux-arm64.tar.gz" + arm64.sha256 = "841cced7ecda9b2014f139f5bab5ae31785f35399f236b8b3e75dff2a2978d96" + armhf.url = "https://go.dev/dl/go1.21.5.linux-armv6l.tar.gz" + armhf.sha256 = "837f4bf4e22fcdf920ffeaa4abf3d02d1314e03725431065f4d44c46a01b42fe" + + [resources.sources.lxd] + url = "https://github.com/canonical/lxd/releases/download/lxd-5.20/lxd-5.20.tar.gz" + sha256 = "2f958b757f4cde64d0f3578da0bda9ee5965a3a70ec0956eddf8287d1290167f" + autoupdate.strategy = "latest_github_release" + + [resources.system_user] + + [resources.install_dir] + + [resources.permissions] + + [resources.apt] + packages = [ + "acl", + "attr", + "autoconf", + "dnsmasq-base", + "git", + "libacl1-dev", + "libcap-dev", + "liblxc1", + "lxc-dev", + "libsqlite3-dev", + "libtool", + "libudev-dev", + "liblz4-dev", + "libuv1-dev", + "make", + "pkg-config", + "rsync", + "squashfs-tools", + "tar", + "tcl", + "xz-utils", + "ebtables", + "libapparmor-dev", + "libseccomp-dev", + "libcap-dev", + "lvm2", + "thin-provisioning-tools", + "btrfs-progs", + "busybox|busybox-static", + "libattr1-dev", + "libuv1", + "libdevmapper-event1.02.1", + "dmeventd", + "lxc", + "tcl8.6", + ] diff --git a/scripts/_common.sh b/scripts/_common.sh index 37c653b..c841bf4 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -4,9 +4,6 @@ # COMMON VARIABLES #================================================= -# dependencies used by the app -pkg_dependencies="acl attr autoconf dnsmasq-base git libacl1-dev libcap-dev liblxc1 lxc-dev libsqlite3-dev libtool libudev-dev liblz4-dev libuv1-dev make pkg-config rsync squashfs-tools tar tcl xz-utils ebtables libapparmor-dev libseccomp-dev libcap-dev lvm2 thin-provisioning-tools btrfs-progs busybox|busybox-static libattr1-dev libuv1 libdevmapper-event1.02.1 dmeventd lxc tcl8.6" - #================================================= # PERSONAL HELPERS #================================================= @@ -61,7 +58,7 @@ ynh_add_systemd_socket_config () { for var_to_replace in $others_var do # ${var_to_replace^^} make the content of the variable on upper-cases - # ${!var_to_replace} get the content of the variable named $var_to_replace + # ${!var_to_replace} get the content of the variable named $var_to_replace ynh_replace_string --match_string="__${var_to_replace^^}__" --replace_string="${!var_to_replace}" --target_file="$finalsystemdconf" done diff --git a/scripts/install b/scripts/install index 0a5e584..ba6f8bd 100755 --- a/scripts/install +++ b/scripts/install @@ -19,52 +19,25 @@ ynh_clean_setup () { ynh_secure_remove --file="$go_tmp" ynh_secure_remove --file="$lxd_tmp" } -# Exit if an error occurs during the execution of the script -ynh_abort_if_errors - -#================================================= -# RETRIEVE ARGUMENTS FROM THE MANIFEST -#================================================= - -app=$YNH_APP_INSTANCE_NAME #================================================= # STORE SETTINGS FROM MANIFEST #================================================= ynh_script_progression --message="Storing installation settings..." -#================================================= -# STANDARD MODIFICATIONS -#================================================= -# INSTALL DEPENDENCIES -#================================================= -ynh_script_progression --message="Installing dependencies..." --weight=30 - -ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies - -#================================================= -# CREATE DEDICATED USER -#================================================= -ynh_script_progression --message="Configuring system user..." - -# Create a system user -ynh_system_user_create --username=$app - #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= ynh_script_progression --message="Setting up source files..." --weight=5 # Download, check integrity, uncompress and patch the source from app.src -go_tmp=$(mktemp -d) -ynh_setup_source --dest_dir="$go_tmp" --source_id="go.$YNH_ARCH" +ynh_setup_source --source_id="go" --dest_dir="$install_dir/go" -export PATH=$go_tmp/bin:$PATH +export PATH="$install_dir/go/bin:$PATH" -lxd_tmp=$(mktemp -d) -ynh_setup_source --dest_dir="$lxd_tmp" --source_id="lxd" +ynh_setup_source --source_id="lxd" --dest_dir="$install_dir/lxd" -export GOPATH=${lxd_tmp}/vendor/ +export GOPATH="$install_dir/lxd/vendor/" #================================================= # SPECIFIC SETUP @@ -73,7 +46,7 @@ export GOPATH=${lxd_tmp}/vendor/ #================================================= ynh_script_progression --message="Building lxd from sources..." --weight=60 -pushd ${lxd_tmp} +pushd "$install_dir/lxd" export HOME=${HOME:-"/root/"} ynh_exec_warn_less make deps @@ -88,25 +61,26 @@ pushd ${lxd_tmp} mkdir -p /var/log/$app cp -a ${GOPATH}/{raft,dqlite}/.libs/lib*.so* /usr/local/lib/$app/ cp ${GOPATH}/bin/{fuidshift,lxc,lxc-to-lxd,lxd,lxd-agent,lxd-benchmark,lxd-migrate,lxd-user} /usr/local/bin - cp ${lxd_tmp}/scripts/bash/lxd-client /etc/bash_completion.d/ + cp $install_dir/lxd/scripts/bash/lxd-client /etc/bash_completion.d/ popd -ynh_secure_remove --file="$go_tmp" -ynh_secure_remove --file="$lxd_tmp" +ynh_secure_remove --file="$install_dir/go" +ynh_secure_remove --file="$install_dir/lxd" #================================================= # ADD A CONFIGURATION #================================================= ynh_script_progression --message="Adding a configuration file..." +# TODO: handle this as a system config echo "bind-interfaces except-interface=lxdbr0" > /etc/dnsmasq.d/lxd systemctl restart dnsmasq ynh_store_file_checksum --file="/etc/dnsmasq.d/lxd" +# TODO: handle this as a system config echo "/usr/local/lib/$app/" > /etc/ld.so.conf.d/$app.conf - ynh_store_file_checksum --file="/etc/ld.so.conf.d/$app.conf" ldconfig @@ -115,22 +89,15 @@ echo "# Added by lxd root:100000:65536" | tee -a /etc/subuid /etc/subgid #================================================= -# SETUP SYSTEMD +# SYSTEM CONFIGURATION #================================================= -ynh_script_progression --message="Configuring a systemd service..." +ynh_script_progression --message="Adding system configurations related to $app..." --weight=1 # Create a dedicated systemd config ynh_add_systemd_socket_config ynh_add_systemd_config -#================================================= -# GENERIC FINALIZATION -#================================================= -# INTEGRATE SERVICE IN YUNOHOST -#================================================= -ynh_script_progression --message="Integrating service in YunoHost..." - -yunohost service add $app --log="/var/log/$app/$app.log" +yunohost service add "$app" --log="/var/log/$app/$app.log" #================================================= # START SYSTEMD SERVICE @@ -138,7 +105,7 @@ yunohost service add $app --log="/var/log/$app/$app.log" ynh_script_progression --message="Starting a systemd service..." # Start a systemd service -ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" +ynh_systemd_action --service_name="$app" --action="start" --log_path="/var/log/$app/$app.log" #================================================= # END OF SCRIPT diff --git a/tests.toml b/tests.toml new file mode 100644 index 0000000..ce11d20 --- /dev/null +++ b/tests.toml @@ -0,0 +1,7 @@ +#:schema https://raw.githubusercontent.com/YunoHost/apps/master/schemas/tests.v1.schema.json + +test_format = 1.0 + +[default] + + test_upgrade_from.b66ae64c2dae8595c817f058c4e45cd7cc40ac64.name = "5.16~ynh1" From 7fa83e961dcddd1688f072854087298f8e5ff5e3 Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Thu, 1 Feb 2024 11:15:41 +0000 Subject: [PATCH 02/20] Auto-update README --- README.md | 6 ------ README_fr.md | 6 ------ 2 files changed, 12 deletions(-) diff --git a/README.md b/README.md index 3f430f5..d1e9479 100644 --- a/README.md +++ b/README.md @@ -26,12 +26,6 @@ LXD is a next generation system container and virtual machine manager. It offers ![Screenshot of LXD](./doc/screenshots/LXD-logo.png) -## Disclaimers / important information - -## Configuration - -How to configure this app: In cli - ## Documentation and resources * Official app website: diff --git a/README_fr.md b/README_fr.md index 6acf499..441da08 100644 --- a/README_fr.md +++ b/README_fr.md @@ -27,12 +27,6 @@ LXD est un gestionnaire de conteneurs système et de machines virtuelles de nouv ![Capture d’écran de LXD](./doc/screenshots/LXD-logo.png) -## Avertissements / informations importantes - -## Configuration - -Comment configurer cette application : en cli - ## Documentations et ressources * Site officiel de l’app : From fdb943fdc7b3111bd3a83dcd5bbbe5407d5a71dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Thu, 1 Feb 2024 14:36:10 +0100 Subject: [PATCH 03/20] Fix dependencies --- manifest.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.toml b/manifest.toml index 5f82f70..87516df 100644 --- a/manifest.toml +++ b/manifest.toml @@ -84,7 +84,7 @@ ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requiremen "lvm2", "thin-provisioning-tools", "btrfs-progs", - "busybox|busybox-static", + "busybox", "libattr1-dev", "libuv1", "libdevmapper-event1.02.1", From d3c8e7c3bf50dce136b6cddc7f4613856eb5d8a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Thu, 1 Feb 2024 14:51:55 +0100 Subject: [PATCH 04/20] Update packaging v2 --- manifest.toml | 4 +-- scripts/backup | 17 ---------- scripts/remove | 50 ++++----------------------- scripts/restore | 52 +++-------------------------- scripts/upgrade | 89 +++++++++++-------------------------------------- 5 files changed, 32 insertions(+), 180 deletions(-) diff --git a/manifest.toml b/manifest.toml index 87516df..665910a 100644 --- a/manifest.toml +++ b/manifest.toml @@ -17,11 +17,11 @@ website = "https://linuxcontainers.org/lxd/" demo = "https://linuxcontainers.org/lxd/try-it/" admindoc = "https://linuxcontainers.org/lxd/docs/master/index.html" code = "https://github.com/canonical/lxd" -cpe = "???" +cpe = "cpe:2.3:a:canonical:lxd" [integration] yunohost = ">= 4.3.0" -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"] +architectures = "all" multi_instance = false ldap = "not_relevant" sso = "not_relevant" diff --git a/scripts/backup b/scripts/backup index 402b1e8..70cf656 100755 --- a/scripts/backup +++ b/scripts/backup @@ -10,23 +10,6 @@ source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers -#================================================= -# MANAGE SCRIPT FAILURE -#================================================= - -ynh_clean_setup () { - true -} -# Exit if an error occurs during the execution of the script -ynh_abort_if_errors - -#================================================= -# LOAD SETTINGS -#================================================= -ynh_print_info --message="Loading installation settings..." - -app=$YNH_APP_INSTANCE_NAME - #================================================= # DECLARE DATA AND CONF FILES TO BACKUP #================================================= diff --git a/scripts/remove b/scripts/remove index 95203ad..e47050c 100755 --- a/scripts/remove +++ b/scripts/remove @@ -10,30 +10,15 @@ source _common.sh source /usr/share/yunohost/helpers #================================================= -# LOAD SETTINGS -#================================================= -ynh_script_progression --message="Loading installation settings..." - -app=$YNH_APP_INSTANCE_NAME - -#================================================= -# STANDARD REMOVE -#================================================= -# REMOVE SERVICE INTEGRATION IN YUNOHOST +# REMOVE SYSTEM CONFIGURATIONS #================================================= +ynh_script_progression --message="Removing system configurations related to $app..." --weight=1 # Remove the service from the list of services known by YunoHost (added from `yunohost service add`) -if ynh_exec_warn_less yunohost service status $app >/dev/null -then - ynh_script_progression --message="Removing $app service integration..." - yunohost service remove $app +if ynh_exec_warn_less yunohost service status "$app" >/dev/null; then + yunohost service remove "$app" fi -#================================================= -# STOP AND REMOVE SERVICE -#================================================= -ynh_script_progression --message="Stopping and removing the systemd service..." - # Remove the dedicated systemd config ynh_exec_warn_less ynh_remove_systemd_socket_config ynh_exec_warn_less ynh_remove_systemd_config @@ -41,28 +26,16 @@ ynh_exec_warn_less ynh_remove_systemd_config #================================================= # REMOVE CONTAINERS #================================================= - # Remove the data directory if --purge option is used -if [ "${YNH_APP_PURGE:-0}" -eq 1 ] -then +if [ "${YNH_APP_PURGE:-0}" -eq 1 ]; then ynh_script_progression --message="Removing containers..." ynh_secure_remove --file="/var/lib/lxd" fi -#================================================= -# REMOVE DEPENDENCIES -#================================================= -ynh_script_progression --message="Removing dependencies..." --weight=20 - -# Remove metapackage and its dependencies -ynh_exec_warn_less ynh_remove_app_dependencies - #================================================= # CLOSE A PORT #================================================= - -if yunohost firewall list | grep -q "\- 67$" -then +if yunohost firewall list | grep -q "\- 67$"; then ynh_script_progression --message="Closing port 67..." ynh_exec_warn_less yunohost firewall disallow Both 67 fi @@ -76,7 +49,6 @@ ynh_script_progression --message="Removing various files..." # Remove a directory securely ynh_secure_remove --file="/etc/ld.so.conf.d/$app.conf" - ldconfig ynh_secure_remove --file="/usr/local/lib/$app" @@ -100,16 +72,6 @@ ynh_secure_remove --file="/etc/dnsmasq.d/lxd" systemctl restart dnsmasq -#================================================= -# GENERIC FINALIZATION -#================================================= -# REMOVE DEDICATED USER -#================================================= -ynh_script_progression --message="Removing the dedicated system user..." - -# Delete a system user -ynh_system_user_delete --username=$app - #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/restore b/scripts/restore index 635c162..2525656 100755 --- a/scripts/restore +++ b/scripts/restore @@ -10,43 +10,6 @@ source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers -#================================================= -# MANAGE SCRIPT FAILURE -#================================================= - -ynh_clean_setup () { - ynh_clean_check_starting -} -# Exit if an error occurs during the execution of the script -ynh_abort_if_errors - -#================================================= -# LOAD SETTINGS -#================================================= -ynh_script_progression --message="Loading installation settings..." - -app=$YNH_APP_INSTANCE_NAME - -#================================================= -# STANDARD RESTORATION STEPS -#================================================= -# RECREATE THE DEDICATED USER -#================================================= -ynh_script_progression --message="Recreating the dedicated system user..." - -# Create the dedicated user (if not existing) -ynh_system_user_create --username=$app - -#================================================= -# SPECIFIC RESTORATION -#================================================= -# REINSTALL DEPENDENCIES -#================================================= -ynh_script_progression --message="Reinstalling dependencies..." --weight=30 - -# Define and install dependencies -ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies - #================================================= # RESTORE VARIOUS FILES #================================================= @@ -78,27 +41,22 @@ echo "# Added by lxd root:100000:65536" | tee -a /etc/subuid /etc/subgid #================================================= -# RESTORE SYSTEMD +# RESTORE SYSTEM CONFIGURATIONS #================================================= -ynh_script_progression --message="Restoring the systemd configuration..." +ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1 ynh_restore_file --origin_path="/etc/systemd/system/$app.service" ynh_restore_file --origin_path="/etc/systemd/system/$app.socket" -systemctl enable $app.service --quiet +systemctl enable "$app.service" --quiet -#================================================= -# INTEGRATE SERVICE IN YUNOHOST -#================================================= -ynh_script_progression --message="Integrating service in YunoHost..." - -yunohost service add $app --log="/var/log/$app/$app.log" +yunohost service add "$app" --log="/var/log/$app/$app.log" #================================================= # START SYSTEMD SERVICE #================================================= ynh_script_progression --message="Starting a systemd service..." -ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" +ynh_systemd_action --service_name="$app" --action="start" --log_path="/var/log/$app/$app.log" #================================================= # END OF SCRIPT diff --git a/scripts/upgrade b/scripts/upgrade index 0048c21..baf347d 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -9,36 +9,6 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# LOAD SETTINGS -#================================================= -ynh_script_progression --message="Loading installation settings..." - -app=$YNH_APP_INSTANCE_NAME - -#================================================= -# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP -#================================================= -ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." - -# Backup the current version of the app -ynh_backup_before_upgrade -ynh_clean_setup () { - ynh_exec_warn_less popd - - ynh_secure_remove --file="$go_tmp" - ynh_secure_remove --file="$lxd_tmp" - # Restore it if the upgrade fails - ynh_restore_upgradebackup -} -# Exit if an error occurs during the execution of the script -ynh_abort_if_errors - -# Remove old file -if [ -f "/usr/local/bin/lxd-p2c" ]; then - ynh_secure_remove --file="/usr/local/bin/lxd-p2c" -fi - #================================================= # STANDARD UPGRADE STEPS #================================================= @@ -47,45 +17,33 @@ fi ynh_script_progression --message="Stopping a systemd service..." ynh_systemd_action --service_name="$app.socket" --action="stop" -ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log" +ynh_systemd_action --service_name="$app" --action="stop" --log_path="/var/log/$app/$app.log" #================================================= # ENSURE DOWNWARD COMPATIBILITY #================================================= -ynh_script_progression --message="Ensuring downward compatibility..." +ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 + +# Remove old file +if [ -f "/usr/local/bin/lxd-p2c" ]; then + ynh_secure_remove --file="/usr/local/bin/lxd-p2c" +fi sed -i "/root:1000000:65536 # Added by lxd#/d" /etc/sub{u,g}id -#================================================= -# CREATE DEDICATED USER -#================================================= -ynh_script_progression --message="Making sure dedicated system user exists..." - -# Create a dedicated user (if not existing) -ynh_system_user_create --username=$app - #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= ynh_script_progression --message="Setting up source files..." # Download, check integrity, uncompress and patch the source from app.src -go_tmp=$(mktemp -d) -ynh_setup_source --dest_dir="$go_tmp" --source_id="go.$YNH_ARCH" +ynh_setup_source --source_id="go" --dest_dir="$install_dir/go" --full_replace=1 -export PATH=$go_tmp/bin:$PATH +export PATH="$install_dir/go/bin:$PATH" -lxd_tmp=$(mktemp -d) -ynh_setup_source --dest_dir="$lxd_tmp" --source_id="lxd" +ynh_setup_source --source_id="lxd" --dest_dir="$install_dir/lxd" --full_replace=1 -export GOPATH=${lxd_tmp}/vendor/ - -#================================================= -# UPGRADE DEPENDENCIES -#================================================= -ynh_script_progression --message="Upgrading dependencies..." - -ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies +export GOPATH="$install_dir/lxd/vendor/" #================================================= # SPECIFIC UPGRADE @@ -94,7 +52,7 @@ ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies #================================================= ynh_script_progression --message="Building lxd from sources..." --weight=60 -pushd ${lxd_tmp} +pushd "$install_dir/lxd" export HOME=${HOME:-"/root/"} ynh_exec_warn_less make deps @@ -103,19 +61,17 @@ pushd ${lxd_tmp} export LD_LIBRARY_PATH="${GOPATH}/raft/.libs/:${GOPATH}/dqlite/.libs/" export CGO_LDFLAGS_ALLOW="(-Wl,-wrap,pthread_create)|(-Wl,-z,now)" - export GOCACHE=$go_tmp - ynh_exec_warn_less make mkdir -p /usr/local/lib/$app mkdir -p /var/log/$app cp -a ${GOPATH}/{raft,dqlite}/.libs/lib*.so* /usr/local/lib/$app/ cp ${GOPATH}/bin/{fuidshift,lxc,lxc-to-lxd,lxd,lxd-agent,lxd-benchmark,lxd-migrate,lxd-user} /usr/local/bin - cp ${lxd_tmp}/scripts/bash/lxd-client /etc/bash_completion.d/ + cp $install_dir/lxd/scripts/bash/lxd-client /etc/bash_completion.d/ popd -ynh_secure_remove --file="$go_tmp" -ynh_secure_remove --file="$lxd_tmp" +ynh_secure_remove --file="$install_dir/go" +ynh_secure_remove --file="$install_dir/lxd" #================================================= # UPDATE A CONFIG FILE @@ -142,29 +98,22 @@ echo "# Added by lxd root:100000:65536" | tee -a /etc/subuid /etc/subgid #================================================= -# SETUP SYSTEMD +# REAPPLY SYSTEM CONFIGURATIONS #================================================= -ynh_script_progression --message="Upgrading systemd configuration..." +ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=1 # Create a dedicated systemd config ynh_add_systemd_socket_config ynh_add_systemd_config -#================================================= -# GENERIC FINALIZATION -#================================================= -# INTEGRATE SERVICE IN YUNOHOST -#================================================= -ynh_script_progression --message="Integrating service in YunoHost..." - -yunohost service add $app --log="/var/log/$app/$app.log" +yunohost service add "$app" --log="/var/log/$app/$app.log" #================================================= # START SYSTEMD SERVICE #================================================= ynh_script_progression --message="Starting a systemd service..." -ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" +ynh_systemd_action --service_name="$app" --action="start" --log_path="/var/log/$app/$app.log" #================================================= # END OF SCRIPT From 733218bfcb230c7cb48c4f5e444b2728fa93d6ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Thu, 1 Feb 2024 15:20:59 +0100 Subject: [PATCH 05/20] Remove manifest fixmes --- manifest.toml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/manifest.toml b/manifest.toml index 665910a..81eb1bd 100644 --- a/manifest.toml +++ b/manifest.toml @@ -25,9 +25,9 @@ architectures = "all" multi_instance = false ldap = "not_relevant" sso = "not_relevant" -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, ... +disk = "500M" +ram.build = "600M" +ram.runtime = "500M" [install] From b90dd0295e3647cd2c9669af59c48126d616645d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Thu, 1 Feb 2024 15:50:28 +0100 Subject: [PATCH 06/20] Handle dnsmasq, ld.so, subuids as system configuration --- conf/dnsmasq.conf | 2 ++ conf/ld.so.conf | 1 + scripts/_common.sh | 47 ++++++++++++++++++++++++++++ scripts/install | 78 ++++++++++++++-------------------------------- scripts/remove | 16 ++++------ scripts/restore | 41 +++++++++++------------- scripts/upgrade | 32 +++++-------------- 7 files changed, 105 insertions(+), 112 deletions(-) create mode 100644 conf/dnsmasq.conf create mode 100644 conf/ld.so.conf diff --git a/conf/dnsmasq.conf b/conf/dnsmasq.conf new file mode 100644 index 0000000..1377981 --- /dev/null +++ b/conf/dnsmasq.conf @@ -0,0 +1,2 @@ +bind-interfaces +except-interface=lxdbr0 diff --git a/conf/ld.so.conf b/conf/ld.so.conf new file mode 100644 index 0000000..2eabc70 --- /dev/null +++ b/conf/ld.so.conf @@ -0,0 +1 @@ +/usr/local/lib/__APP__/ diff --git a/scripts/_common.sh b/scripts/_common.sh index c841bf4..1b94ab9 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -93,6 +93,53 @@ ynh_remove_systemd_socket_config () { fi } +_ynh_add_dnsmasq() { + # Declare an array to define the options of this helper. + local legacy_args=t + local -A args_array=( [t]=template= ) + local template + ynh_handle_getopts_args "$@" + local template="${template:-dnsmasq.conf}" + + ynh_add_config --template="$template" --destination="/etc/dnsmasq.d/$app" + + ynh_systemd_action --service_name=dnsmasq --action=restart +} + +_ynh_remove_dnsmasq() { + ynh_secure_remove --file="/etc/dnsmasq.d/$app" + + ynh_systemd_action --service_name=dnsmasq --action=restart +} + +_ynh_add_ld_so() { + # Declare an array to define the options of this helper. + local legacy_args=t + local -A args_array=( [t]=template= ) + local template + ynh_handle_getopts_args "$@" + local template="${template:-ld.so.conf}" + + ynh_add_config --template="$template" --destination="/etc/ld.so.conf.d/$app.conf" + + ldconfig +} + +_ynh_remove_ld_so() { + ynh_secure_remove --file="/etc/ld.so.conf.d/$app.conf" + + ldconfig +} + +_ynh_set_subuid_subgid() { + echo "# Added by lxd +root:100000:65536" | tee -a /etc/subuid /etc/subgid +} + +_ynh_unset_subuid_subgid() { + sed -i "/# Added by lxd$/{N;/root:100000:65536/d}" /etc/sub{u,g}id +} + #================================================= # EXPERIMENTAL HELPERS #================================================= diff --git a/scripts/install b/scripts/install index ba6f8bd..3bf9c53 100755 --- a/scripts/install +++ b/scripts/install @@ -9,22 +9,6 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# MANAGE SCRIPT FAILURE -#================================================= - -ynh_clean_setup () { - ynh_exec_warn_less popd - - ynh_secure_remove --file="$go_tmp" - ynh_secure_remove --file="$lxd_tmp" -} - -#================================================= -# STORE SETTINGS FROM MANIFEST -#================================================= -ynh_script_progression --message="Storing installation settings..." - #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= @@ -32,13 +16,8 @@ ynh_script_progression --message="Setting up source files..." --weight=5 # Download, check integrity, uncompress and patch the source from app.src ynh_setup_source --source_id="go" --dest_dir="$install_dir/go" - -export PATH="$install_dir/go/bin:$PATH" - ynh_setup_source --source_id="lxd" --dest_dir="$install_dir/lxd" -export GOPATH="$install_dir/lxd/vendor/" - #================================================= # SPECIFIC SETUP #================================================= @@ -47,47 +26,30 @@ export GOPATH="$install_dir/lxd/vendor/" ynh_script_progression --message="Building lxd from sources..." --weight=60 pushd "$install_dir/lxd" - export HOME=${HOME:-"/root/"} + ( + export PATH="$install_dir/go/bin:$PATH" + export GOPATH="$install_dir/lxd/vendor/" + export HOME=${HOME:-"/root/"} - ynh_exec_warn_less make deps - export CGO_CFLAGS="-I${GOPATH}/raft/include/ -I${GOPATH}/dqlite/include/" - export CGO_LDFLAGS="-L${GOPATH}/raft/.libs -L${GOPATH}/dqlite/.libs/" - export LD_LIBRARY_PATH="${GOPATH}/raft/.libs/:${GOPATH}/dqlite/.libs/" - export CGO_LDFLAGS_ALLOW="(-Wl,-wrap,pthread_create)|(-Wl,-z,now)" + ynh_exec_warn_less make deps + export CGO_CFLAGS="-I${GOPATH}/raft/include/ -I${GOPATH}/dqlite/include/" + export CGO_LDFLAGS="-L${GOPATH}/raft/.libs -L${GOPATH}/dqlite/.libs/" + export LD_LIBRARY_PATH="${GOPATH}/raft/.libs/:${GOPATH}/dqlite/.libs/" + export CGO_LDFLAGS_ALLOW="(-Wl,-wrap,pthread_create)|(-Wl,-z,now)" - ynh_exec_warn_less make + ynh_exec_warn_less make - mkdir -p /usr/local/lib/$app - mkdir -p /var/log/$app - cp -a ${GOPATH}/{raft,dqlite}/.libs/lib*.so* /usr/local/lib/$app/ - cp ${GOPATH}/bin/{fuidshift,lxc,lxc-to-lxd,lxd,lxd-agent,lxd-benchmark,lxd-migrate,lxd-user} /usr/local/bin - cp $install_dir/lxd/scripts/bash/lxd-client /etc/bash_completion.d/ + mkdir -p /usr/local/lib/$app + mkdir -p /var/log/$app + cp -a ${GOPATH}/{raft,dqlite}/.libs/lib*.so* /usr/local/lib/$app/ + cp ${GOPATH}/bin/{fuidshift,lxc,lxc-to-lxd,lxd,lxd-agent,lxd-benchmark,lxd-migrate,lxd-user} /usr/local/bin + cp $install_dir/lxd/scripts/bash/lxd-client /etc/bash_completion.d/ + ) popd ynh_secure_remove --file="$install_dir/go" ynh_secure_remove --file="$install_dir/lxd" -#================================================= -# ADD A CONFIGURATION -#================================================= -ynh_script_progression --message="Adding a configuration file..." - -# TODO: handle this as a system config -echo "bind-interfaces -except-interface=lxdbr0" > /etc/dnsmasq.d/lxd -systemctl restart dnsmasq - -ynh_store_file_checksum --file="/etc/dnsmasq.d/lxd" - -# TODO: handle this as a system config -echo "/usr/local/lib/$app/" > /etc/ld.so.conf.d/$app.conf -ynh_store_file_checksum --file="/etc/ld.so.conf.d/$app.conf" - -ldconfig - -echo "# Added by lxd -root:100000:65536" | tee -a /etc/subuid /etc/subgid - #================================================= # SYSTEM CONFIGURATION #================================================= @@ -95,10 +57,16 @@ ynh_script_progression --message="Adding system configurations related to $app.. # Create a dedicated systemd config ynh_add_systemd_socket_config -ynh_add_systemd_config +ynh_add_systemd_config yunohost service add "$app" --log="/var/log/$app/$app.log" +_ynh_add_dnsmasq + +_ynh_add_ld_so + +_ynh_set_subuid_subgid + #================================================= # START SYSTEMD SERVICE #================================================= diff --git a/scripts/remove b/scripts/remove index e47050c..ddcfe5d 100755 --- a/scripts/remove +++ b/scripts/remove @@ -23,6 +23,12 @@ fi ynh_exec_warn_less ynh_remove_systemd_socket_config ynh_exec_warn_less ynh_remove_systemd_config +_ynh_remove_ld_so + +_ynh_unset_subuid_subgid + +_ynh_remove_dnsmasq + #================================================= # REMOVE CONTAINERS #================================================= @@ -47,10 +53,6 @@ fi #================================================= ynh_script_progression --message="Removing various files..." -# Remove a directory securely -ynh_secure_remove --file="/etc/ld.so.conf.d/$app.conf" -ldconfig - ynh_secure_remove --file="/usr/local/lib/$app" # Remove the log files @@ -66,12 +68,6 @@ ynh_secure_remove --file="/usr/local/bin/lxd-migrate" ynh_secure_remove --file="/usr/local/bin/lxd-user" ynh_secure_remove --file="/etc/bash_completion.d/lxd-client" -sed -i "/# Added by lxd$/{N;/root:100000:65536/d}" /etc/sub{u,g}id - -ynh_secure_remove --file="/etc/dnsmasq.d/lxd" - -systemctl restart dnsmasq - #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/restore b/scripts/restore index 2525656..94d75f4 100755 --- a/scripts/restore +++ b/scripts/restore @@ -10,6 +10,25 @@ source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers +#================================================= +# RESTORE SYSTEM CONFIGURATIONS +#================================================= +ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1 + +ynh_restore_file --origin_path="/etc/systemd/system/$app.service" +ynh_restore_file --origin_path="/etc/systemd/system/$app.socket" +systemctl enable "$app.service" --quiet + +yunohost service add "$app" --log="/var/log/$app/$app.log" + +ynh_restore_file --origin_path="/etc/dnsmasq.d/lxd" +systemctl restart dnsmasq + +ynh_restore_file --origin_path="/etc/ld.so.conf.d/$app.conf" +ldconfig + +_ynh_set_subuid_subgid + #================================================= # RESTORE VARIOUS FILES #================================================= @@ -29,28 +48,6 @@ ynh_restore_file --origin_path="/usr/local/bin/lxd-migrate" ynh_restore_file --origin_path="/usr/local/bin/lxd-user" ynh_restore_file --origin_path="/etc/bash_completion.d/lxd-client" -ynh_restore_file --origin_path="/etc/dnsmasq.d/lxd" - -systemctl restart dnsmasq - -ynh_restore_file --origin_path="/etc/ld.so.conf.d/$app.conf" - -ldconfig - -echo "# Added by lxd -root:100000:65536" | tee -a /etc/subuid /etc/subgid - -#================================================= -# RESTORE SYSTEM CONFIGURATIONS -#================================================= -ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1 - -ynh_restore_file --origin_path="/etc/systemd/system/$app.service" -ynh_restore_file --origin_path="/etc/systemd/system/$app.socket" -systemctl enable "$app.service" --quiet - -yunohost service add "$app" --log="/var/log/$app/$app.log" - #================================================= # START SYSTEMD SERVICE #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index baf347d..a493a9a 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -73,30 +73,6 @@ popd ynh_secure_remove --file="$install_dir/go" ynh_secure_remove --file="$install_dir/lxd" -#================================================= -# UPDATE A CONFIG FILE -#================================================= -ynh_script_progression --message="Updating a configuration file..." - -ynh_backup_if_checksum_is_different --file="/etc/dnsmasq.d/lxd" - -echo "bind-interfaces -except-interface=lxdbr0" > /etc/dnsmasq.d/lxd -systemctl restart dnsmasq - -ynh_store_file_checksum --file="/etc/dnsmasq.d/lxd" - -ynh_backup_if_checksum_is_different --file="/etc/ld.so.conf.d/$app.conf" - -echo "/usr/local/lib/$app/" > /etc/ld.so.conf.d/$app.conf - -ynh_store_file_checksum --file="/etc/ld.so.conf.d/$app.conf" - -ldconfig - -echo "# Added by lxd -root:100000:65536" | tee -a /etc/subuid /etc/subgid - #================================================= # REAPPLY SYSTEM CONFIGURATIONS #================================================= @@ -104,10 +80,16 @@ ynh_script_progression --message="Upgrading system configurations related to $ap # Create a dedicated systemd config ynh_add_systemd_socket_config -ynh_add_systemd_config +ynh_add_systemd_config yunohost service add "$app" --log="/var/log/$app/$app.log" +_ynh_add_dnsmasq + +_ynh_add_ld_so + +_ynh_set_subuid_subgid + #================================================= # START SYSTEMD SERVICE #================================================= From 7c14999e174b6470218039446bcaef805ae115ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Thu, 1 Feb 2024 16:38:54 +0100 Subject: [PATCH 07/20] Restore files before restoring system config --- scripts/restore | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/scripts/restore b/scripts/restore index 94d75f4..59bb2eb 100755 --- a/scripts/restore +++ b/scripts/restore @@ -10,25 +10,6 @@ source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers -#================================================= -# RESTORE SYSTEM CONFIGURATIONS -#================================================= -ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1 - -ynh_restore_file --origin_path="/etc/systemd/system/$app.service" -ynh_restore_file --origin_path="/etc/systemd/system/$app.socket" -systemctl enable "$app.service" --quiet - -yunohost service add "$app" --log="/var/log/$app/$app.log" - -ynh_restore_file --origin_path="/etc/dnsmasq.d/lxd" -systemctl restart dnsmasq - -ynh_restore_file --origin_path="/etc/ld.so.conf.d/$app.conf" -ldconfig - -_ynh_set_subuid_subgid - #================================================= # RESTORE VARIOUS FILES #================================================= @@ -48,6 +29,25 @@ ynh_restore_file --origin_path="/usr/local/bin/lxd-migrate" ynh_restore_file --origin_path="/usr/local/bin/lxd-user" ynh_restore_file --origin_path="/etc/bash_completion.d/lxd-client" +#================================================= +# RESTORE SYSTEM CONFIGURATIONS +#================================================= +ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1 + +ynh_restore_file --origin_path="/etc/systemd/system/$app.service" +ynh_restore_file --origin_path="/etc/systemd/system/$app.socket" +systemctl enable "$app.service" --quiet + +yunohost service add "$app" --log="/var/log/$app/$app.log" + +ynh_restore_file --origin_path="/etc/dnsmasq.d/lxd" +systemctl restart dnsmasq + +ynh_restore_file --origin_path="/etc/ld.so.conf.d/$app.conf" +ldconfig + +_ynh_set_subuid_subgid + #================================================= # START SYSTEMD SERVICE #================================================= From c7f714917a436fb3dab519866c9d06b639c132df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Thu, 1 Feb 2024 16:50:39 +0100 Subject: [PATCH 08/20] debug --- manifest.toml | 3 +++ scripts/install | 4 ++++ scripts/remove | 4 ++++ 3 files changed, 11 insertions(+) diff --git a/manifest.toml b/manifest.toml index 81eb1bd..4dc1fb1 100644 --- a/manifest.toml +++ b/manifest.toml @@ -91,4 +91,7 @@ ram.runtime = "500M" "dmeventd", "lxc", "tcl8.6", + + # For debuging + "iproute2", ] diff --git a/scripts/install b/scripts/install index 3bf9c53..578f943 100755 --- a/scripts/install +++ b/scripts/install @@ -61,8 +61,12 @@ ynh_add_systemd_socket_config ynh_add_systemd_config yunohost service add "$app" --log="/var/log/$app/$app.log" +ynh_exec_warn ss -lp "sport = :domain" + _ynh_add_dnsmasq +ynh_exec_warn ss -lp "sport = :domain" + _ynh_add_ld_so _ynh_set_subuid_subgid diff --git a/scripts/remove b/scripts/remove index ddcfe5d..317f09a 100755 --- a/scripts/remove +++ b/scripts/remove @@ -27,8 +27,12 @@ _ynh_remove_ld_so _ynh_unset_subuid_subgid +ynh_exec_warn ss -lp "sport = :domain" + _ynh_remove_dnsmasq +ynh_exec_warn ss -lp "sport = :domain" + #================================================= # REMOVE CONTAINERS #================================================= From e55958c31952e16358b998bee2fba23cd66b81ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Thu, 1 Feb 2024 18:20:36 +0100 Subject: [PATCH 09/20] Stop lxc services --- scripts/remove | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/remove b/scripts/remove index 317f09a..36820d0 100755 --- a/scripts/remove +++ b/scripts/remove @@ -23,6 +23,10 @@ fi ynh_exec_warn_less ynh_remove_systemd_socket_config ynh_exec_warn_less ynh_remove_systemd_config +# Stop LXC systemd services +ynh_systemd_action --service_name="lxc-net" --action="stop" +ynh_systemd_action --service_name="lxc" --action="stop" + _ynh_remove_ld_so _ynh_unset_subuid_subgid From 73059a1b1fb018e8ad102ec3354ce7f96db99052 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Thu, 1 Feb 2024 18:25:32 +0100 Subject: [PATCH 10/20] restart lxc in case it was used in the system already --- scripts/remove | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scripts/remove b/scripts/remove index 36820d0..77d2f98 100755 --- a/scripts/remove +++ b/scripts/remove @@ -23,7 +23,7 @@ fi ynh_exec_warn_less ynh_remove_systemd_socket_config ynh_exec_warn_less ynh_remove_systemd_config -# Stop LXC systemd services +# Stop LXC systemd services, just for dnsmasq. ynh_systemd_action --service_name="lxc-net" --action="stop" ynh_systemd_action --service_name="lxc" --action="stop" @@ -37,6 +37,10 @@ _ynh_remove_dnsmasq ynh_exec_warn ss -lp "sport = :domain" +# Stop LXC systemd services, just for dnsmasq. +ynh_systemd_action --service_name="lxc-net" --action="start" +ynh_systemd_action --service_name="lxc" --action="start" + #================================================= # REMOVE CONTAINERS #================================================= From 3995c41222546514aa4096a1f9093355df93f693 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Thu, 1 Feb 2024 19:22:08 +0100 Subject: [PATCH 11/20] don't restart lxc, remove debug --- scripts/remove | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/scripts/remove b/scripts/remove index 77d2f98..b8398ce 100755 --- a/scripts/remove +++ b/scripts/remove @@ -23,7 +23,7 @@ fi ynh_exec_warn_less ynh_remove_systemd_socket_config ynh_exec_warn_less ynh_remove_systemd_config -# Stop LXC systemd services, just for dnsmasq. +# Stop LXC systemd services for dnsmasq. ynh_systemd_action --service_name="lxc-net" --action="stop" ynh_systemd_action --service_name="lxc" --action="stop" @@ -31,16 +31,8 @@ _ynh_remove_ld_so _ynh_unset_subuid_subgid -ynh_exec_warn ss -lp "sport = :domain" - _ynh_remove_dnsmasq -ynh_exec_warn ss -lp "sport = :domain" - -# Stop LXC systemd services, just for dnsmasq. -ynh_systemd_action --service_name="lxc-net" --action="start" -ynh_systemd_action --service_name="lxc" --action="start" - #================================================= # REMOVE CONTAINERS #================================================= From 152c64a62492cd7fb2dae5993c045b47b637f7dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Thu, 1 Feb 2024 19:26:20 +0100 Subject: [PATCH 12/20] echo -e --- scripts/_common.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index 1b94ab9..27d3ae3 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -132,8 +132,7 @@ _ynh_remove_ld_so() { } _ynh_set_subuid_subgid() { - echo "# Added by lxd -root:100000:65536" | tee -a /etc/subuid /etc/subgid + echo -e "# Added by lxd\nroot:100000:65536" | tee -a /etc/subuid /etc/subgid } _ynh_unset_subuid_subgid() { From 1a0b1cc8dd07c6ead6f0399a2d07c3d1b80fce68 Mon Sep 17 00:00:00 2001 From: Kayou Date: Tue, 6 Feb 2024 20:54:56 +0100 Subject: [PATCH 13/20] Apply suggestions from code review --- manifest.toml | 21 +++++++-------------- scripts/_common.sh | 18 ++---------------- scripts/restore | 2 +- scripts/upgrade | 2 +- 4 files changed, 11 insertions(+), 32 deletions(-) diff --git a/manifest.toml b/manifest.toml index 4dc1fb1..24a7a9d 100644 --- a/manifest.toml +++ b/manifest.toml @@ -56,15 +56,17 @@ ram.runtime = "500M" [resources.apt] packages = [ + # According to https://documentation.ubuntu.com/lxd/en/latest/installing/#install-lxd-from-source "acl", "attr", "autoconf", + "automake", "dnsmasq-base", "git", "libacl1-dev", "libcap-dev", "liblxc1", - "lxc-dev", + "liblxc-dev", "libsqlite3-dev", "libtool", "libudev-dev", @@ -78,20 +80,11 @@ ram.runtime = "500M" "tcl", "xz-utils", "ebtables", - "libapparmor-dev", - "libseccomp-dev", - "libcap-dev", + + # For lvm2 "lvm2", "thin-provisioning-tools", - "btrfs-progs", - "busybox", - "libattr1-dev", - "libuv1", - "libdevmapper-event1.02.1", - "dmeventd", - "lxc", - "tcl8.6", - # For debuging - "iproute2", + # For btrfs + "btrfs-progs" ] diff --git a/scripts/_common.sh b/scripts/_common.sh index 27d3ae3..7cee4c8 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -94,14 +94,7 @@ ynh_remove_systemd_socket_config () { } _ynh_add_dnsmasq() { - # Declare an array to define the options of this helper. - local legacy_args=t - local -A args_array=( [t]=template= ) - local template - ynh_handle_getopts_args "$@" - local template="${template:-dnsmasq.conf}" - - ynh_add_config --template="$template" --destination="/etc/dnsmasq.d/$app" + ynh_add_config --template="dnsmasq.conf" --destination="/etc/dnsmasq.d/$app" ynh_systemd_action --service_name=dnsmasq --action=restart } @@ -113,14 +106,7 @@ _ynh_remove_dnsmasq() { } _ynh_add_ld_so() { - # Declare an array to define the options of this helper. - local legacy_args=t - local -A args_array=( [t]=template= ) - local template - ynh_handle_getopts_args "$@" - local template="${template:-ld.so.conf}" - - ynh_add_config --template="$template" --destination="/etc/ld.so.conf.d/$app.conf" + ynh_add_config --template="ld.so.conf" --destination="/etc/ld.so.conf.d/$app.conf" ldconfig } diff --git a/scripts/restore b/scripts/restore index 59bb2eb..cb917d4 100755 --- a/scripts/restore +++ b/scripts/restore @@ -32,7 +32,7 @@ ynh_restore_file --origin_path="/etc/bash_completion.d/lxd-client" #================================================= # RESTORE SYSTEM CONFIGURATIONS #================================================= -ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1 +ynh_script_progression --message="Restoring system configurations related to $app..." ynh_restore_file --origin_path="/etc/systemd/system/$app.service" ynh_restore_file --origin_path="/etc/systemd/system/$app.socket" diff --git a/scripts/upgrade b/scripts/upgrade index a493a9a..86ae56c 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -22,7 +22,7 @@ ynh_systemd_action --service_name="$app" --action="stop" --log_path="/var/log/$a #================================================= # ENSURE DOWNWARD COMPATIBILITY #================================================= -ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 +ynh_script_progression --message="Ensuring downward compatibility..." # Remove old file if [ -f "/usr/local/bin/lxd-p2c" ]; then From bc8fdc21df2c81129dd4b3e05eadbeb67d29b6a9 Mon Sep 17 00:00:00 2001 From: Kay0u Date: Tue, 6 Feb 2024 22:51:20 +0100 Subject: [PATCH 14/20] fix deps --- manifest.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.toml b/manifest.toml index 24a7a9d..f754904 100644 --- a/manifest.toml +++ b/manifest.toml @@ -66,7 +66,7 @@ ram.runtime = "500M" "libacl1-dev", "libcap-dev", "liblxc1", - "liblxc-dev", + "lxc-dev", "libsqlite3-dev", "libtool", "libudev-dev", From cd8a6bc0f2a57e05ef085c8e05eeb95a18d0c1bf Mon Sep 17 00:00:00 2001 From: Kay0u Date: Tue, 6 Feb 2024 22:51:37 +0100 Subject: [PATCH 15/20] remove debug --- scripts/install | 4 ---- 1 file changed, 4 deletions(-) diff --git a/scripts/install b/scripts/install index 578f943..3bf9c53 100755 --- a/scripts/install +++ b/scripts/install @@ -61,12 +61,8 @@ ynh_add_systemd_socket_config ynh_add_systemd_config yunohost service add "$app" --log="/var/log/$app/$app.log" -ynh_exec_warn ss -lp "sport = :domain" - _ynh_add_dnsmasq -ynh_exec_warn ss -lp "sport = :domain" - _ynh_add_ld_so _ynh_set_subuid_subgid From e2d2fb8557177a4d0c0c865660cbdcf718868e3c Mon Sep 17 00:00:00 2001 From: Kay0u Date: Fri, 16 Feb 2024 12:12:34 +0100 Subject: [PATCH 16/20] add the updater back for go --- .github/workflows/updater.sh | 87 +++++++++++++++++++++++++++++++++++ .github/workflows/updater.yml | 49 ++++++++++++++++++++ 2 files changed, 136 insertions(+) create mode 100644 .github/workflows/updater.sh create mode 100644 .github/workflows/updater.yml diff --git a/.github/workflows/updater.sh b/.github/workflows/updater.sh new file mode 100644 index 0000000..6dcd9cf --- /dev/null +++ b/.github/workflows/updater.sh @@ -0,0 +1,87 @@ +#!/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. + +#================================================= +# Update Go +#================================================= +go_url="https://go.dev/dl/?mode=json" + +current_version=$(cat ../../manifest.toml | sed -n "s/\"https:\/\/go.dev\/dl\/go\(.*\).linux-amd64.tar.gz\"/\1/p" | cut -d'=' -f2) +go_version=$(curl --silent "$go_url" | jq -r '.[] | .version' | sort -V | tail -1) +go_arch=($(curl --silent "$go_url" | jq -r '.[] | select(.version=="'$go_version'") | .files[] | select(.os == "linux") | .arch')) + +# Setting up the environment variables +echo "Current version: $current_version" +echo "Latest release from upstream: $go_version" +echo "VERSION=$go_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" "$go_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-go-v$version ; then + echo "::warning ::A branch already exists for this update" + exit 0 +fi + +for arch in "${go_arch[@]}" +do + filename=$(curl --silent "$go_url" | jq -r '.[] | select(.version=="'$go_version'") | .files[] | select(.os == "linux") | select(.arch == "'$arch'") | .filename') + checksum=$(curl --silent "$go_url" | jq -r '.[] | select(.version=="'$go_version'") | .files[] | select(.os == "linux") | select(.arch == "'$arch'") | .sha256') + case $arch in + *"amd64"*) + src="amd64" + ;; + *"386"*) + src="i386" + ;; + *"arm64"*) + src="arm64" + ;; + *"armv6l"*) + src="arm" + ;; + *) + src="" + ;; + esac + + if [ -z "$src" ]; then + continue + fi + + # Rewrite manifest.toml file + sed -i "s/$src.url = \"https:\/\/go.dev.*/$src.url = \"https:\/\/go.dev\/dl\/$filename\"/g" manifest.toml + sed -i "s/$src.sha256 = \".*/$src.sha256 = \"$checksum\"/g" manifest.toml + + echo "... resource go.$src updated" + +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 +#================================================= + +# 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 \ No newline at end of file diff --git a/.github/workflows/updater.yml b/.github/workflows/updater.yml new file mode 100644 index 0000000..cdc9a4a --- /dev/null +++ b/.github/workflows/updater.yml @@ -0,0 +1,49 @@ +# 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 go 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 go to version ${{ env.VERSION }} + committer: 'yunohost-bot ' + author: 'yunohost-bot ' + signoff: false + base: testing + branch: ci-auto-update-go-v${{ env.VERSION }} + delete-branch: true + title: 'Upgrade go to version ${{ env.VERSION }}' + body: | + Upgrade go to v${{ env.VERSION }} + draft: false \ No newline at end of file From a33020b708f7ccce581d0fdac0d73472e6611b99 Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Fri, 16 Feb 2024 11:12:42 +0000 Subject: [PATCH 17/20] Auto-update README --- README.md | 4 ++-- README_fr.md | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index d1e9479..0dde584 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ @@ -46,4 +46,4 @@ or sudo yunohost app upgrade lxd -u https://github.com/YunoHost-Apps/lxd_ynh/tree/testing --debug ``` -**More info regarding app packaging:** +**More info regarding app packaging:** \ No newline at end of file diff --git a/README_fr.md b/README_fr.md index 441da08..c9cf7de 100644 --- a/README_fr.md +++ b/README_fr.md @@ -1,5 +1,5 @@ From dbf35f0ef8c26fcdc33d5e0b1ec9056abcdf8675 Mon Sep 17 00:00:00 2001 From: Kay0u Date: Fri, 16 Feb 2024 12:17:00 +0100 Subject: [PATCH 18/20] fix go version number --- .github/workflows/updater.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/updater.sh b/.github/workflows/updater.sh index 6dcd9cf..ce37614 100644 --- a/.github/workflows/updater.sh +++ b/.github/workflows/updater.sh @@ -20,8 +20,8 @@ go_arch=($(curl --silent "$go_url" | jq -r '.[] | select(.version=="'$go_version # Setting up the environment variables echo "Current version: $current_version" -echo "Latest release from upstream: $go_version" -echo "VERSION=$go_version" >> $GITHUB_ENV +echo "Latest release from upstream: ${go_version#go}" +echo "VERSION=${go_version#go}" >> $GITHUB_ENV # For the time being, let's assume the script will fail echo "PROCEED=false" >> $GITHUB_ENV From 81f07b2c69609ac4f3e4b401c5078ba8ef73e73d Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Fri, 16 Feb 2024 11:17:38 +0000 Subject: [PATCH 19/20] Upgrade go to v1.22.0 --- manifest.toml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/manifest.toml b/manifest.toml index f754904..5fc7c8d 100644 --- a/manifest.toml +++ b/manifest.toml @@ -34,12 +34,12 @@ ram.runtime = "500M" [resources] [resources.sources] [resources.sources.go] - amd64.url = "https://go.dev/dl/go1.21.5.linux-amd64.tar.gz" - amd64.sha256 = "e2bc0b3e4b64111ec117295c088bde5f00eeed1567999ff77bc859d7df70078e" - i386.url = "https://go.dev/dl/go1.21.5.linux-386.tar.gz" - i386.sha256 = "8f4dba9cf5c61757bbd7e9ebdb93b6a30a1b03f4a636a1ba0cc2f27b907ab8e1" - arm64.url = "https://go.dev/dl/go1.21.5.linux-arm64.tar.gz" - arm64.sha256 = "841cced7ecda9b2014f139f5bab5ae31785f35399f236b8b3e75dff2a2978d96" + amd64.url = "https://go.dev/dl/go1.22.0.linux-amd64.tar.gz" + amd64.sha256 = "f6c8a87aa03b92c4b0bf3d558e28ea03006eb29db78917daec5cfb6ec1046265" + i386.url = "https://go.dev/dl/go1.22.0.linux-386.tar.gz" + i386.sha256 = "1e209c4abde069067ac9afb341c8003db6a210f8173c77777f02d3a524313da3" + arm64.url = "https://go.dev/dl/go1.22.0.linux-arm64.tar.gz" + arm64.sha256 = "6a63fef0e050146f275bf02a0896badfe77c11b6f05499bb647e7bd613a45a10" armhf.url = "https://go.dev/dl/go1.21.5.linux-armv6l.tar.gz" armhf.sha256 = "837f4bf4e22fcdf920ffeaa4abf3d02d1314e03725431065f4d44c46a01b42fe" From 29bd1d5c803ce76cfd2a4fe7fe99e482c704cfdc Mon Sep 17 00:00:00 2001 From: Kay0u Date: Fri, 16 Feb 2024 12:19:31 +0100 Subject: [PATCH 20/20] =?UTF-8?q?fix=C2=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/updater.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/updater.sh b/.github/workflows/updater.sh index ce37614..1faa8ff 100644 --- a/.github/workflows/updater.sh +++ b/.github/workflows/updater.sh @@ -26,7 +26,7 @@ echo "VERSION=${go_version#go}" >> $GITHUB_ENV echo "PROCEED=false" >> $GITHUB_ENV # Proceed only if the retrieved version is greater than the current one -if ! dpkg --compare-versions "$current_version" "lt" "$go_version" ; then +if ! dpkg --compare-versions "$current_version" "lt" "${go_version#go}" ; then echo "::warning ::No new version available" exit 0 # Proceed only if a PR for this new version does not already exist