This commit is contained in:
pvincent
2026-08-21 09:28:27 +04:00
parent 5f35eaafbd
commit 0ff0eb4521
2 changed files with 37 additions and 3 deletions
+22 -3
View File
@@ -12,11 +12,12 @@ function assert_normal_user {
}
function assert_credentials {
echo "check for credentials"
local base_url
base_url=$(echo "$GIT_URL" | cut -d: -f1)
if ! ssh -T "${base_url}"; then
echo "credentials missing: $base_url"
return 2
>&2 echo "MIAOU ERROR: development mode unavailable because your credentials are missing: $base_url"
builtin exit 2
fi
}
@@ -31,11 +32,29 @@ function assert_reachable_target {
sudo -u nobody -g sudo test -x "$(dirname "$target")"
}
function assert_devmode_available {
fetch_mode
if [[ "$MIAOU_BASH_MODE" == development ]]; then
local realpath
realpath=$(realpath "$MIAOU_BASH_DIR"/) # / is required to get real target
if [[ "$MIAOU_BASH_MODE_OWNER" == "$USER" ]]; then
echo "you are already in development mode, check for: $realpath"
return 10
else
>&2 echo "MIAOU ERROR: already in develoment mode, but owned by: $MIAOU_BASH_MODE_OWNER"
return 11
fi
elif [[ "$MIAOU_BASH_MODE" = hosted ]]; then
>&2 echo "MIAOU ERROR: hosted mode detected"
return 12
fi
}
# Main
source "$MIAOU_BASH_DIR"/lib/functions.bash
assert_normal_user
assert_system_mode
assert_devmode_available
assert_credentials
name=$(echo "$GIT_URL" | cut -d/ -f2)
name="${name%.git}"