diff --git a/.github/workflows/action.yml b/.github/workflows/action.yml index 8b4e1c3..c3b54e5 100644 --- a/.github/workflows/action.yml +++ b/.github/workflows/action.yml @@ -21,7 +21,7 @@ jobs: runs-on: ubuntu-latest steps: - name: deploy with sh script - run: sh -c "$(curl -fsSL https://raw.githubusercontent.com/IgorKha/Grafana-Mikrotik/master/run.sh)" "" + run: curl -fsSL https://raw.githubusercontent.com/IgorKha/Grafana-Mikrotik/master/run.sh | bash -s -- - name: Test Grafana run: sleep 5 && curl -ILsS --retry 5 --retry-delay 2 "http://localhost:3000/login" diff --git a/README.md b/README.md index f3ef169..0081397 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ ### Deploy with sh script ```console -sh -c "$(curl -fsSL https://raw.githubusercontent.com/IgorKha/Grafana-Mikrotik/master/run.sh)" "" --config +curl -fsSL https://raw.githubusercontent.com/IgorKha/Grafana-Mikrotik/master/run.sh | bash -s -- --config ``` ```console diff --git a/run.sh b/run.sh index 232129b..0df304c 100755 --- a/run.sh +++ b/run.sh @@ -62,10 +62,10 @@ ask() { } command_exists() { - command -v "$@" || { + command -v "$@" >/dev/null 2>&1 || { fmt_error "$* is not installed. Please install $* first." exit 1 - } + } } fmt_error() { @@ -94,7 +94,7 @@ clone_git() { router_ip() { if [[ "${CONFIG}" = yes ]]; then - IP=$(grep -R 'MIKROTIK_IP' "${ENV_FILE}" 2>&1 | cut -d= -f2) + IP=$(grep -R 'MIKROTIK_IP' "${ENV_FILE}" | cut -d= -f2) echo -e "\n${BLUE}====================================" echo -e "\n${BOLD}Prometheus${RESET}\n" if ask "Change target mikrotik IP address ? (current ${IP})" Y; then