Update rmmagent-linux.sh

This commit is contained in:
edschuy95 2025-09-04 18:39:21 +00:00
parent 38d426c1fb
commit c6ba5b02b0

View file

@ -1,12 +1,12 @@
#!/bin/bash #!/bin/ash
if [[ $1 == "" ]]; then if [ "$1" = "" ]; then
echo "First argument is empty!" echo "First argument is empty!"
echo "Type help for more information" echo "Type help for more information"
exit 1 exit 1
fi 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 "There is help but more information is available at github.com/ZoLuSs/rmmagent-script"
echo "" echo ""
echo "INSTALL args:" echo "INSTALL args:"
@ -29,7 +29,7 @@ if [[ $1 == "help" ]]; then
exit 0 exit 0
fi 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 "First argument must be 'install', 'update', or 'uninstall'!"
echo "Type help for more information" echo "Type help for more information"
exit 1 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_url_armv6="https://go.dev/dl/go$go_version.linux-armv6l.tar.gz"
go_install() { go_install() {
if ! command -v go &> /dev/null; then if ! command -v go >/dev/null 2>&1; then
case $system in case $system in
amd64) url=$go_url_amd64 ;; amd64) url=$go_url_amd64 ;;
x86) url=$go_url_x86 ;; 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" 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/ tar -xf /tmp/rmmagent.tar.gz -C /tmp/
rm /tmp/rmmagent.tar.gz rm /tmp/rmmagent.tar.gz
cd /tmp/rmmagent-master cd /tmp/rmmagent-master || exit 1
case $system in case $system in
amd64) arch=amd64 ;; amd64) arch=amd64 ;;
x86) arch=386 ;; x86) arch=386 ;;
@ -101,7 +101,7 @@ install_agent() {
-site-id "$rmm_site_id" -agent-type "$rmm_agent_type" -auth "$rmm_auth" -site-id "$rmm_site_id" -agent-type "$rmm_agent_type" -auth "$rmm_auth"
# Create OpenRC service script # Create OpenRC service script
cat << "EOF" > /etc/init.d/tacticalagent cat << 'EOF' > /etc/init.d/tacticalagent
#!/sbin/openrc-run #!/sbin/openrc-run
description="Tactical RMM Linux Agent" description="Tactical RMM Linux Agent"