Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

switch to ynh_install_go #189

Open
wants to merge 2 commits into
base: testing
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ It shall NOT be edited by hand.

LXD is a next generation system container and virtual machine manager. It offers a unified user experience around full Linux systems running inside containers or virtual machines.

**Shipped version:** 6.2~ynh2
**Shipped version:** 6.2~ynh3

**Demo:** <https://linuxcontainers.org/lxd/try-it/>

Expand Down
2 changes: 1 addition & 1 deletion README_es.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ No se debe editar a mano.

LXD is a next generation system container and virtual machine manager. It offers a unified user experience around full Linux systems running inside containers or virtual machines.

**Versión actual:** 6.2~ynh2
**Versión actual:** 6.2~ynh3

**Demo:** <https://linuxcontainers.org/lxd/try-it/>

Expand Down
2 changes: 1 addition & 1 deletion README_eu.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ EZ editatu eskuz.

LXD is a next generation system container and virtual machine manager. It offers a unified user experience around full Linux systems running inside containers or virtual machines.

**Paketatutako bertsioa:** 6.2~ynh2
**Paketatutako bertsioa:** 6.2~ynh3

**Demoa:** <https://linuxcontainers.org/lxd/try-it/>

Expand Down
2 changes: 1 addition & 1 deletion README_fr.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Il NE doit PAS être modifié à la main.
LXD est un gestionnaire de conteneurs système et de machines virtuelles de nouvelle génération. Il offre une expérience utilisateur unifiée autour de systèmes Linux complets fonctionnant dans des conteneurs ou des machines virtuelles.


**Version incluse :** 6.2~ynh2
**Version incluse :** 6.2~ynh3

**Démo :** <https://linuxcontainers.org/lxd/try-it/>

Expand Down
2 changes: 1 addition & 1 deletion README_gl.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ NON debe editarse manualmente.

LXD is a next generation system container and virtual machine manager. It offers a unified user experience around full Linux systems running inside containers or virtual machines.

**Versión proporcionada:** 6.2~ynh2
**Versión proporcionada:** 6.2~ynh3

**Demo:** <https://linuxcontainers.org/lxd/try-it/>

Expand Down
2 changes: 1 addition & 1 deletion README_id.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Ini TIDAK boleh diedit dengan tangan.

LXD is a next generation system container and virtual machine manager. It offers a unified user experience around full Linux systems running inside containers or virtual machines.

**Versi terkirim:** 6.2~ynh2
**Versi terkirim:** 6.2~ynh3

**Demo:** <https://linuxcontainers.org/lxd/try-it/>

Expand Down
2 changes: 1 addition & 1 deletion README_nl.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Hij mag NIET handmatig aangepast worden.

LXD is a next generation system container and virtual machine manager. It offers a unified user experience around full Linux systems running inside containers or virtual machines.

**Geleverde versie:** 6.2~ynh2
**Geleverde versie:** 6.2~ynh3

**Demo:** <https://linuxcontainers.org/lxd/try-it/>

Expand Down
2 changes: 1 addition & 1 deletion README_pl.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Nie powinno być ono edytowane ręcznie.

LXD is a next generation system container and virtual machine manager. It offers a unified user experience around full Linux systems running inside containers or virtual machines.

**Dostarczona wersja:** 6.2~ynh2
**Dostarczona wersja:** 6.2~ynh3

**Demo:** <https://linuxcontainers.org/lxd/try-it/>

Expand Down
2 changes: 1 addition & 1 deletion README_ru.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

LXD is a next generation system container and virtual machine manager. It offers a unified user experience around full Linux systems running inside containers or virtual machines.

**Поставляемая версия:** 6.2~ynh2
**Поставляемая версия:** 6.2~ynh3

**Демо-версия:** <https://linuxcontainers.org/lxd/try-it/>

Expand Down
2 changes: 1 addition & 1 deletion README_zh_Hans.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

LXD is a next generation system container and virtual machine manager. It offers a unified user experience around full Linux systems running inside containers or virtual machines.

**分发版本:** 6.2~ynh2
**分发版本:** 6.2~ynh3

**演示:** <https://linuxcontainers.org/lxd/try-it/>

Expand Down
6 changes: 1 addition & 5 deletions conf/systemd.service
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,13 @@ Environment=LXD_OVMF_PATH=/usr/share/ovmf/x64
ExecStart=/usr/local/bin/__APP__ --group=__APP__ --logfile=/var/log/__APP__/__APP__.log
ExecStartPost=/usr/local/bin/__APP__ waitready --timeout=600
ExecStop=/usr/local/bin/__APP__ shutdown
User=root
Group=root
KillMode=process
TimeoutStartSec=600s
TimeoutStopSec=30s
Restart=on-failure
LimitNOFILE=1048576
LimitNPROC=infinity
LimitCORE=infinity
TasksMax=infinity
Delegate=yes
KillMode=process

[Install]
WantedBy=multi-user.target
5 changes: 3 additions & 2 deletions conf/systemd.socket
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
Description=LXD - unix socket

[Socket]
FileDescriptorName=unix
ListenStream=/var/lib/__APP__/unix.socket
SocketMode=0660
SocketGroup=__APP__
SocketMode=0660
Service=__APP__.service

[Install]
WantedBy=sockets.target
WantedBy=sockets.target
16 changes: 2 additions & 14 deletions manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ 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 = "6.2~ynh2"
version = "6.2~ynh3"

maintainers = ["kay0u"]

Expand All @@ -33,15 +33,6 @@ ram.runtime = "500M"

[resources]
[resources.sources]
[resources.sources.go]
amd64.url = "https://go.dev/dl/go1.23.4.linux-amd64.tar.gz"
amd64.sha256 = "6924efde5de86fe277676e929dc9917d466efa02fb934197bc2eba35d5680971"
i386.url = "https://go.dev/dl/go1.23.4.linux-386.tar.gz"
i386.sha256 = "4a4a0e7587ef8c8a326439b957027f2791795e2d29d4ae3885b4091a48f843bc"
arm64.url = "https://go.dev/dl/go1.23.4.linux-arm64.tar.gz"
arm64.sha256 = "16e5017863a7f6071363782b1b8042eb12c6ca4f4cd71528b2123f0a1275b13e"
armhf.url = "https://go.dev/dl/go1.21.5.linux-armv6l.tar.gz"
armhf.sha256 = "837f4bf4e22fcdf920ffeaa4abf3d02d1314e03725431065f4d44c46a01b42fe"

[resources.sources.main]
url = "https://github.com/canonical/lxd/releases/download/lxd-6.2/lxd-6.2.tar.gz"
Expand All @@ -53,10 +44,6 @@ ram.runtime = "500M"

[resources.system_user]

[resources.install_dir]

[resources.permissions]

[resources.apt]
packages = [
# According to https://documentation.ubuntu.com/lxd/en/latest/installing/#install-lxd-from-source
Expand All @@ -83,6 +70,7 @@ ram.runtime = "500M"
"tcl",
"xz-utils",
"ebtables",
"gcc",

# For lvm2
"lvm2",
Expand Down
2 changes: 2 additions & 0 deletions scripts/_common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
# COMMON VARIABLES
#=================================================

GO_VERSION="1"

#=================================================
# PERSONAL HELPERS
#=================================================
Expand Down
45 changes: 22 additions & 23 deletions scripts/install
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@ source /usr/share/yunohost/helpers
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"
ynh_setup_source --source_id="main" --dest_dir="$install_dir/lxd"
install_dir="$(mktemp -d)"
export HOME=${HOME:-"/root/"}
ynh_exec_warn_less ynh_install_go --go_version=$GO_VERSION
ynh_setup_source --source_id="main" --dest_dir="$install_dir"

#=================================================
# SPECIFIC SETUP
Expand All @@ -25,29 +27,26 @@ ynh_setup_source --source_id="main" --dest_dir="$install_dir/lxd"
#=================================================
ynh_script_progression --message="Building lxd from sources..." --weight=60

pushd "$install_dir/lxd"
(
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}dqlite/include/"
export CGO_LDFLAGS="-L${GOPATH}dqlite/.libs/"
export LD_LIBRARY_PATH="${GOPATH}dqlite/.libs/"
export CGO_LDFLAGS_ALLOW="(-Wl,-wrap,pthread_create)|(-Wl,-z,now)"

ynh_exec_warn_less make

mkdir -p /usr/local/lib/$app
mkdir -p /var/log/$app
cp -a ${GOPATH}/dqlite/.libs/lib*.so* /usr/local/lib/$app/
cp ${GOPATH}/bin/{lxc,lxc-to-lxd,lxd,lxd-agent,lxd-benchmark,lxd-metadata,lxd-migrate,lxd-user} /usr/local/bin
)
pushd "$install_dir"
export GOPATH="$install_dir/vendor/"
ynh_use_go

ynh_exec_warn_less make deps
export CGO_CFLAGS="-I$install_dir/vendor/dqlite/include/"
export CGO_LDFLAGS="-L$install_dir/vendor/dqlite/.libs/"
export LD_LIBRARY_PATH="$install_dir/vendor/dqlite/.libs/"
export CGO_LDFLAGS_ALLOW="(-Wl,-wrap,pthread_create)|(-Wl,-z,now)"

ynh_exec_warn_less make

mkdir -p /usr/local/lib/$app
mkdir -p /var/log/$app
cp -a $install_dir/vendor/dqlite/.libs/lib*.so* /usr/local/lib/$app/
cp $install_dir/vendor/bin/{lxc,lxc-to-lxd,lxd,lxd-agent,lxd-benchmark,lxd-metadata,lxd-migrate,lxd-user} /usr/local/bin
popd

ynh_secure_remove --file="$install_dir/go"
ynh_secure_remove --file="$install_dir/lxd"
ynh_remove_go
ynh_secure_remove --file="$install_dir"

#=================================================
# SYSTEM CONFIGURATION
Expand Down
30 changes: 14 additions & 16 deletions scripts/upgrade
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,10 @@ sed -i "/root:1000000:65536 # Added by lxd#/d" /etc/sub{u,g}id
ynh_script_progression --message="Setting up source files..."

# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --source_id="go" --dest_dir="$install_dir/go" --full_replace=1

export PATH="$install_dir/go/bin:$PATH"

ynh_setup_source --source_id="main" --dest_dir="$install_dir/lxd" --full_replace=1

export GOPATH="$install_dir/lxd/vendor/"
install_dir="$(mktemp -d)"
export HOME=${HOME:-"/root/"}
ynh_exec_warn_less ynh_install_go --go_version=$GO_VERSION
ynh_setup_source --source_id="main" --dest_dir="$install_dir"

#=================================================
# SPECIFIC UPGRADE
Expand All @@ -52,20 +49,21 @@ export GOPATH="$install_dir/lxd/vendor/"
#=================================================
ynh_script_progression --message="Building lxd from sources..." --weight=60

pushd "$install_dir/lxd"
export HOME=${HOME:-"/root/"}
pushd "$install_dir"
export GOPATH="$install_dir/vendor/"
ynh_use_go

ynh_exec_warn_less make deps
export CGO_CFLAGS="-I${GOPATH}dqlite/include/"
export CGO_LDFLAGS="-L${GOPATH}dqlite/.libs/"
export LD_LIBRARY_PATH="${GOPATH}dqlite/.libs/"
export CGO_CFLAGS="-I$install_dir/vendor/dqlite/include/"
export CGO_LDFLAGS="-L$install_dir/vendor/dqlite/.libs/"
export LD_LIBRARY_PATH="$install_dir/vendor/dqlite/.libs/"
export CGO_LDFLAGS_ALLOW="(-Wl,-wrap,pthread_create)|(-Wl,-z,now)"

ynh_exec_warn_less make

mkdir -p /usr/local/lib/$app
mkdir -p /var/log/$app
cp -a ${GOPATH}/dqlite/.libs/lib*.so* /usr/local/lib/$app/
cp -a $install_dir/vendor/dqlite/.libs/lib*.so* /usr/local/lib/$app/
# No longer exists
if [ -f "/usr/local/bin/fuidshift" ]
then
Expand All @@ -75,11 +73,11 @@ pushd "$install_dir/lxd"
then
ynh_secure_remove --file="/etc/bash_completion.d/lxd-client"
fi
cp ${GOPATH}/bin/{lxc,lxc-to-lxd,lxd,lxd-agent,lxd-benchmark,lxd-metadata,lxd-migrate,lxd-user} /usr/local/bin
cp -f $install_dir/vendor/bin/{lxc,lxc-to-lxd,lxd,lxd-agent,lxd-benchmark,lxd-metadata,lxd-migrate,lxd-user} /usr/local/bin
popd

ynh_secure_remove --file="$install_dir/go"
ynh_secure_remove --file="$install_dir/lxd"
ynh_remove_go
ynh_secure_remove --file="$install_dir"

#=================================================
# REAPPLY SYSTEM CONFIGURATIONS
Expand Down
1 change: 1 addition & 0 deletions tests.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ test_format = 1.0
[default]

test_upgrade_from.b66ae64c2dae8595c817f058c4e45cd7cc40ac64.name = "5.16~ynh1"
test_upgrade_from.891fb3187e2b1f88b8ce6332c6e4b741667634f5.name = "6.2~ynh2"