mirror of
https://github.com/YunoHost/package_check.git
synced 2024-09-03 20:06:20 +02:00
Autodetect incus/lxd unless specific YNHDEV_BACKEND
This commit is contained in:
parent
8db653ea9e
commit
2490e35731
3 changed files with 12 additions and 7 deletions
|
@ -33,9 +33,9 @@ assert_we_are_connected_to_the_internets() {
|
|||
|
||||
assert_we_have_all_dependencies() {
|
||||
deps=("lynx" "jq" "python3" "pip3")
|
||||
if [[ "${YNHDEV_BACKEND:-}" == "incus" ]]; then
|
||||
if [[ "${lxc}" == "incus" ]]; then
|
||||
deps+=(incus)
|
||||
else
|
||||
elif [[ "${lxc}" == "lxc" ]]; then
|
||||
deps+=(lxc lxd)
|
||||
fi
|
||||
|
||||
|
@ -87,7 +87,7 @@ function set_incus_remote()
|
|||
|
||||
function check_lxc_setup()
|
||||
{
|
||||
if [[ "${YNHDEV_BACKEND:-}" == "incus" ]]; then
|
||||
if [[ "${lxc}" == "incus" ]]; then
|
||||
check_incus_setup
|
||||
else
|
||||
check_lxd_setup
|
||||
|
|
11
lib/lxc.sh
11
lib/lxc.sh
|
@ -3,10 +3,15 @@
|
|||
# Check for LXC or Incus
|
||||
function switch_lxc_incus()
|
||||
{
|
||||
if [[ "${YNHDEV_BACKEND:-}" == "incus" ]]; then
|
||||
lxc=incus
|
||||
if [[ -z "${YNHDEV_BACKEND:-}" ]]; then
|
||||
# Autodetect because no preference was specified
|
||||
if command -v incus 2>&1 >/dev/null; then
|
||||
lxc="incus"
|
||||
else
|
||||
lxc=lxc
|
||||
lxc="lxc"
|
||||
fi
|
||||
else
|
||||
lxc="${YNHDEV_BACKEND}"
|
||||
fi
|
||||
}
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ print_help() {
|
|||
-S, --storage-dir DIRECTORY Where to store temporary test files like yunohost backups
|
||||
-h, --help Display this help
|
||||
|
||||
Pass YNHDEV_BACKEND=incus to use incus instead of lxd.
|
||||
Pass YNHDEV_BACKEND=incus|lxd to use a specific LXD-compatible backend.
|
||||
|
||||
EOF
|
||||
exit 0
|
||||
|
|
Loading…
Add table
Reference in a new issue