Skip to content

Commit

Permalink
Merge pull request #82 from selfhoster1312/no-dep-which
Browse files Browse the repository at this point in the history
More portable dependency checks
  • Loading branch information
alexAubin authored May 8, 2024
2 parents 12e0539 + c38f528 commit 0215146
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions ynh-dev
Original file line number Diff line number Diff line change
Expand Up @@ -180,10 +180,10 @@ 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
if ! id -nG "$(whoami)" | grep -qw "incus-admin" && [ ! $(id -u) -eq 0 ]; then
critical "You need to be in the incus-admin group!"
fi

Expand All @@ -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
Expand Down Expand Up @@ -455,7 +460,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!"

Expand Down

0 comments on commit 0215146

Please sign in to comment.