diff --git a/.github/workflows/updater.sh b/.github/workflows/updater.sh new file mode 100644 index 0000000..7511368 --- /dev/null +++ b/.github/workflows/updater.sh @@ -0,0 +1,115 @@ +#!/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 + +#================================================= +# 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/README.md b/README.md index 72ae141..3a93048 100644 --- a/README.md +++ b/README.md @@ -1,63 +1,42 @@ + + # LXD for YunoHost [![Integration level](https://dash.yunohost.org/integration/lxd.svg)](https://dash.yunohost.org/appci/app/lxd) ![](https://ci-apps.yunohost.org/ci/badges/lxd.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/lxd.maintain.svg) -[![Install lxd with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=lxd) +[![Install LXD with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=lxd) -> *This package allows you to install lxd quickly and simply on a YunoHost server. +*[Lire ce readme en français.](./README_fr.md)* + +> *This package allows you to install LXD quickly and simply on a YunoHost server. If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/install) to learn how to install it.* ## Overview -LXD is a next generation system container manager. It offers a user experience similar to virtual machines but using Linux containers instead. -**Shipped version:** 4.21 +Offers a user experience similar to virtual machines but using Linux containers instead. -## Demo +**Shipped version:** 4.22~ynh2 -* [Official demo](https://linuxcontainers.org/lxd/try-it/) +**Demo:** https://linuxcontainers.org/lxd/try-it/ + +## Disclaimers / important information ## Configuration How to configure this app: In cli -## Documentation +## Documentation and resources - * Official documentation: https://linuxcontainers.org/lxd/ - -## YunoHost specific features - -#### Multi-user support - -Are LDAP and HTTP auth supported? -Can the app be used by multiple users? - -#### Supported architectures - -* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/lxd%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/lxd/) -* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/lxd%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/lxd/) - -## Limitations - -* Any known limitations. - -## Additional information - -* Other info you would like to add about this app. - -**More info on the documentation page:** -https://yunohost.org/packaging_apps - -## Links - - * Report a bug: https://github.com/YunoHost-Apps/lxd_ynh/issues - * App website: https://linuxcontainers.org - * Upstream app repository: https://github.com/lxc/lxd - * YunoHost website: https://yunohost.org/ - ---- +* Official app website: https://linuxcontainers.org/lxd/ +* Official admin documentation: https://linuxcontainers.org/lxd/docs/master/index.html +* Upstream app code repository: https://github.com/lxc/lxd +* YunoHost documentation for this app: https://yunohost.org/app_lxd +* Report a bug: https://github.com/YunoHost-Apps/lxd_ynh/issues ## Developer info -**Only if you want to use a testing branch for coding, instead of merging directly into master.** Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/lxd_ynh/tree/testing). To try the testing branch, please proceed like that. @@ -66,3 +45,5 @@ sudo yunohost app install https://github.com/YunoHost-Apps/lxd_ynh/tree/testing or sudo yunohost app upgrade lxd -u https://github.com/YunoHost-Apps/lxd_ynh/tree/testing --debug ``` + +**More info regarding app packaging:** https://yunohost.org/packaging_apps \ No newline at end of file diff --git a/README_fr.md b/README_fr.md new file mode 100644 index 0000000..6f3a863 --- /dev/null +++ b/README_fr.md @@ -0,0 +1,45 @@ +# LXD pour YunoHost + +[![Niveau d'intégration](https://dash.yunohost.org/integration/lxd.svg)](https://dash.yunohost.org/appci/app/lxd) ![](https://ci-apps.yunohost.org/ci/badges/lxd.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/lxd.maintain.svg) +[![Installer LXD avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=lxd) + +*[Read this readme in english.](./README.md)* +*[Lire ce readme en français.](./README_fr.md)* + +> *Ce package vous permet d'installer LXD rapidement et simplement sur un serveur YunoHost. +Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour savoir comment l'installer et en profiter.* + +## Vue d'ensemble + +Offre une expérience utilisateur similaire aux machines virtuelles mais en utilisant des conteneurs Linux à la place. + +**Version incluse :** 4.22~ynh2 + +**Démo :** https://linuxcontainers.org/lxd/try-it/ + +## Avertissements / informations importantes + +## Configuration + +How to configure this app: In cli + +## Documentations et ressources + +* Site officiel de l'app : https://linuxcontainers.org/lxd/ +* Documentation officielle de l'admin : https://linuxcontainers.org/lxd/docs/master/index.html +* Dépôt de code officiel de l'app : https://github.com/lxc/lxd +* Documentation YunoHost pour cette app : https://yunohost.org/app_lxd +* Signaler un bug : https://github.com/YunoHost-Apps/lxd_ynh/issues + +## Informations pour les développeurs + +Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/lxd_ynh/tree/testing). + +Pour essayer la branche testing, procédez comme suit. +``` +sudo yunohost app install https://github.com/YunoHost-Apps/lxd_ynh/tree/testing --debug +ou +sudo yunohost app upgrade lxd -u https://github.com/YunoHost-Apps/lxd_ynh/tree/testing --debug +``` + +**Plus d'infos sur le packaging d'applications :** https://yunohost.org/packaging_apps \ No newline at end of file diff --git a/doc/DISCLAIMER.md b/doc/DISCLAIMER.md new file mode 100644 index 0000000..a4ffe97 --- /dev/null +++ b/doc/DISCLAIMER.md @@ -0,0 +1,3 @@ +## Configuration + +How to configure this app: In cli diff --git a/manifest.json b/manifest.json index 896459e..2eb8e68 100644 --- a/manifest.json +++ b/manifest.json @@ -3,10 +3,18 @@ "id": "lxd", "packaging_format": 1, "description": { - "en": "Offers a user experience similar to virtual machines but using Linux containers instead." + "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": "4.22~ynh1", + "version": "4.22~ynh2", "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/lxc/lxd" + }, "license": "Apache-2.0", "maintainer": { "name": "kay0u",