diff --git a/rmmagent-linux.sh b/rmmagent-linux.sh index bd7bf3c..54c1e62 100644 --- a/rmmagent-linux.sh +++ b/rmmagent-linux.sh @@ -1,12 +1,12 @@ -#!/bin/bash +#!/bin/ash -if [[ $1 == "" ]]; then +if [ "$1" = "" ]; then echo "First argument is empty!" echo "Type help for more information" exit 1 fi -if [[ $1 == "help" ]]; then +if [ "$1" = "help" ]; then echo "There is help but more information is available at github.com/ZoLuSs/rmmagent-script" echo "" echo "INSTALL args:" @@ -29,7 +29,7 @@ if [[ $1 == "help" ]]; then exit 0 fi -if [[ $1 != "install" && $1 != "update" && $1 != "uninstall" ]]; then +if [ "$1" != "install" ] && [ "$1" != "update" ] && [ "$1" != "uninstall" ]; then echo "First argument must be 'install', 'update', or 'uninstall'!" echo "Type help for more information" exit 1 @@ -61,7 +61,7 @@ go_url_arm64="https://go.dev/dl/go$go_version.linux-arm64.tar.gz" go_url_armv6="https://go.dev/dl/go$go_version.linux-armv6l.tar.gz" go_install() { - if ! command -v go &> /dev/null; then + if ! command -v go >/dev/null 2>&1; then case $system in amd64) url=$go_url_amd64 ;; x86) url=$go_url_x86 ;; @@ -82,7 +82,7 @@ agent_compile() { wget -O /tmp/rmmagent.tar.gz "https://github.com/amidaware/rmmagent/archive/refs/heads/master.tar.gz" tar -xf /tmp/rmmagent.tar.gz -C /tmp/ rm /tmp/rmmagent.tar.gz - cd /tmp/rmmagent-master + cd /tmp/rmmagent-master || exit 1 case $system in amd64) arch=amd64 ;; x86) arch=386 ;; @@ -101,7 +101,7 @@ install_agent() { -site-id "$rmm_site_id" -agent-type "$rmm_agent_type" -auth "$rmm_auth" # Create OpenRC service script - cat << "EOF" > /etc/init.d/tacticalagent + cat << 'EOF' > /etc/init.d/tacticalagent #!/sbin/openrc-run description="Tactical RMM Linux Agent" @@ -173,4 +173,4 @@ case $1 in echo "Tactical Agent Uninstall is done" exit 0 ;; -esac \ No newline at end of file +esac