From 2d9a929aa1155048de63a19e077136a3716c995e Mon Sep 17 00:00:00 2001 From: selfhoster1312 Date: Wed, 8 May 2024 17:59:03 +0200 Subject: [PATCH 1/3] Use command, not which (more portable) --- ynh-dev | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ynh-dev b/ynh-dev index 08e0669..0bd1f6e 100755 --- a/ynh-dev +++ b/ynh-dev @@ -180,7 +180,7 @@ function prepare_cache_and_deps() { function check_incus_setup() { # Check incus is installed somehow - if ! which incus &>/dev/null; then + if ! command -v incus &>/dev/null; then critical "You need to have Incus installed for ynh-dev to be usable from the host machine. Refer to the README to know how to install it." fi if ! id -nG "$(whoami)" | grep -qw "incus-admin"; then @@ -455,7 +455,7 @@ function dev() { assert_inside_vm - which inotifywait &>/dev/null || critical "You should first run: apt install inotify-tools" + command -v inotifywait &>/dev/null || critical "You should first run: apt install inotify-tools" info "Now monitoring for changes in python files, restarting yunohost-api and yunohost-portal-api when changes occur!" From 2e547075dc5acd5b66065ea05d8d94dc8e437c76 Mon Sep 17 00:00:00 2001 From: selfhoster1312 Date: Wed, 8 May 2024 18:00:42 +0200 Subject: [PATCH 2/3] root user doesn't need to be an incus admin --- ynh-dev | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ynh-dev b/ynh-dev index 0bd1f6e..578eb6e 100755 --- a/ynh-dev +++ b/ynh-dev @@ -183,7 +183,7 @@ function check_incus_setup() if ! command -v incus &>/dev/null; then critical "You need to have Incus installed for ynh-dev to be usable from the host machine. Refer to the README to know how to install it." fi - if ! id -nG "$(whoami)" | grep -qw "incus-admin"; then + if ! id -nG "$(whoami)" | grep -qw "incus-admin" && [ ! $(id -u) -eq 0 ]; then critical "You need to be in the incus-admin group!" fi From c38f528748f1825f55d038bf0623bbba5b54ebf8 Mon Sep 17 00:00:00 2001 From: selfhoster1312 Date: Wed, 8 May 2024 18:02:53 +0200 Subject: [PATCH 3/3] Ensure jq is installed --- ynh-dev | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ynh-dev b/ynh-dev index 578eb6e..f10f0df 100755 --- a/ynh-dev +++ b/ynh-dev @@ -195,6 +195,11 @@ function check_incus_setup() function set_incus_remote() { + # Check jq is installed somehow + if ! command -v jq &>/dev/null; then + critical "You need jq installed for ynh-dev" + fi + configured=$(incus remote list -f json | jq 'has("yunohost")') if [[ "$configured" != "true" ]]; then incus remote add yunohost https://devbaseimgs.yunohost.org --public