mirror of
https://github.com/YunoHost-Apps/lxd_ynh.git
synced 2024-09-03 19:45:53 +02:00
Packaging v2
This commit is contained in:
parent
68820935ec
commit
6b2ddd8f77
15 changed files with 116 additions and 340 deletions
162
.github/workflows/updater.sh
vendored
162
.github/workflows/updater.sh
vendored
|
@ -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 <<EOT > 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 <<EOT > 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
|
|
49
.github/workflows/updater.yml
vendored
49
.github/workflows/updater.yml
vendored
|
@ -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 <yunohost-bot@users.noreply.github.com>'
|
|
||||||
author: 'yunohost-bot <yunohost-bot@users.noreply.github.com>'
|
|
||||||
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
|
|
|
@ -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
|
|
||||||
|
|
|
@ -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
|
|
|
@ -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
|
|
|
@ -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
|
|
|
@ -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
|
|
|
@ -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
|
|
|
@ -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": []
|
|
||||||
}
|
|
||||||
}
|
|
94
manifest.toml
Normal file
94
manifest.toml
Normal file
|
@ -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",
|
||||||
|
]
|
|
@ -4,9 +4,6 @@
|
||||||
# COMMON VARIABLES
|
# 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
|
# PERSONAL HELPERS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -61,7 +58,7 @@ ynh_add_systemd_socket_config () {
|
||||||
for var_to_replace in $others_var
|
for var_to_replace in $others_var
|
||||||
do
|
do
|
||||||
# ${var_to_replace^^} make the content of the variable on upper-cases
|
# ${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"
|
ynh_replace_string --match_string="__${var_to_replace^^}__" --replace_string="${!var_to_replace}" --target_file="$finalsystemdconf"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
|
@ -19,52 +19,25 @@ ynh_clean_setup () {
|
||||||
ynh_secure_remove --file="$go_tmp"
|
ynh_secure_remove --file="$go_tmp"
|
||||||
ynh_secure_remove --file="$lxd_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
|
# STORE SETTINGS FROM MANIFEST
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Storing installation settings..."
|
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
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Setting up source files..." --weight=5
|
ynh_script_progression --message="Setting up source files..." --weight=5
|
||||||
|
|
||||||
# Download, check integrity, uncompress and patch the source from app.src
|
# Download, check integrity, uncompress and patch the source from app.src
|
||||||
go_tmp=$(mktemp -d)
|
ynh_setup_source --source_id="go" --dest_dir="$install_dir/go"
|
||||||
ynh_setup_source --dest_dir="$go_tmp" --source_id="go.$YNH_ARCH"
|
|
||||||
|
|
||||||
export PATH=$go_tmp/bin:$PATH
|
export PATH="$install_dir/go/bin:$PATH"
|
||||||
|
|
||||||
lxd_tmp=$(mktemp -d)
|
ynh_setup_source --source_id="lxd" --dest_dir="$install_dir/lxd"
|
||||||
ynh_setup_source --dest_dir="$lxd_tmp" --source_id="lxd"
|
|
||||||
|
|
||||||
export GOPATH=${lxd_tmp}/vendor/
|
export GOPATH="$install_dir/lxd/vendor/"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC SETUP
|
# SPECIFIC SETUP
|
||||||
|
@ -73,7 +46,7 @@ export GOPATH=${lxd_tmp}/vendor/
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Building lxd from sources..." --weight=60
|
ynh_script_progression --message="Building lxd from sources..." --weight=60
|
||||||
|
|
||||||
pushd ${lxd_tmp}
|
pushd "$install_dir/lxd"
|
||||||
export HOME=${HOME:-"/root/"}
|
export HOME=${HOME:-"/root/"}
|
||||||
|
|
||||||
ynh_exec_warn_less make deps
|
ynh_exec_warn_less make deps
|
||||||
|
@ -88,25 +61,26 @@ pushd ${lxd_tmp}
|
||||||
mkdir -p /var/log/$app
|
mkdir -p /var/log/$app
|
||||||
cp -a ${GOPATH}/{raft,dqlite}/.libs/lib*.so* /usr/local/lib/$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 ${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
|
popd
|
||||||
|
|
||||||
ynh_secure_remove --file="$go_tmp"
|
ynh_secure_remove --file="$install_dir/go"
|
||||||
ynh_secure_remove --file="$lxd_tmp"
|
ynh_secure_remove --file="$install_dir/lxd"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# ADD A CONFIGURATION
|
# ADD A CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Adding a configuration file..."
|
ynh_script_progression --message="Adding a configuration file..."
|
||||||
|
|
||||||
|
# TODO: handle this as a system config
|
||||||
echo "bind-interfaces
|
echo "bind-interfaces
|
||||||
except-interface=lxdbr0" > /etc/dnsmasq.d/lxd
|
except-interface=lxdbr0" > /etc/dnsmasq.d/lxd
|
||||||
systemctl restart dnsmasq
|
systemctl restart dnsmasq
|
||||||
|
|
||||||
ynh_store_file_checksum --file="/etc/dnsmasq.d/lxd"
|
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
|
echo "/usr/local/lib/$app/" > /etc/ld.so.conf.d/$app.conf
|
||||||
|
|
||||||
ynh_store_file_checksum --file="/etc/ld.so.conf.d/$app.conf"
|
ynh_store_file_checksum --file="/etc/ld.so.conf.d/$app.conf"
|
||||||
|
|
||||||
ldconfig
|
ldconfig
|
||||||
|
@ -115,22 +89,15 @@ echo "# Added by lxd
|
||||||
root:100000:65536" | tee -a /etc/subuid /etc/subgid
|
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
|
# Create a dedicated systemd config
|
||||||
ynh_add_systemd_socket_config
|
ynh_add_systemd_socket_config
|
||||||
ynh_add_systemd_config
|
ynh_add_systemd_config
|
||||||
|
|
||||||
#=================================================
|
yunohost service add "$app" --log="/var/log/$app/$app.log"
|
||||||
# GENERIC FINALIZATION
|
|
||||||
#=================================================
|
|
||||||
# INTEGRATE SERVICE IN YUNOHOST
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Integrating service in YunoHost..."
|
|
||||||
|
|
||||||
yunohost service add $app --log="/var/log/$app/$app.log"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# START SYSTEMD SERVICE
|
# 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..."
|
ynh_script_progression --message="Starting a systemd service..."
|
||||||
|
|
||||||
# Start 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
|
# END OF SCRIPT
|
||||||
|
|
7
tests.toml
Normal file
7
tests.toml
Normal file
|
@ -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"
|
Loading…
Add table
Reference in a new issue