From af694f1ce9d63feee081ee1ac8bf1a252b3c0071 Mon Sep 17 00:00:00 2001 From: wh1te909 Date: Tue, 4 Jul 2023 08:53:06 +0000 Subject: [PATCH] arm64/deb12/ubuntu22 support, remove mongo, postgres 15 and node 18 --- backup.sh | 15 ++--- install.sh | 126 +++++++++++++++++++++++---------------- restore.sh | 170 ++++++++++++++++++++++++++++++++++------------------- update.sh | 53 ++++++++--------- 4 files changed, 215 insertions(+), 149 deletions(-) diff --git a/backup.sh b/backup.sh index def15ee3..8eb8f85a 100755 --- a/backup.sh +++ b/backup.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -SCRIPT_VERSION="24" +SCRIPT_VERSION="25" GREEN='\033[0;32m' YELLOW='\033[1;33m' @@ -18,11 +18,11 @@ if [[ $* == *--schedule* ]]; then crontab -l 2>/dev/null echo "0 0 * * * /rmm/backup.sh --auto" ) | crontab - - - if [ ! -d /rmmbackups ]; then + + if [ ! -d /rmmbackups ]; then sudo mkdir /rmmbackups fi - + if [ ! -d /rmmbackups/daily ]; then sudo mkdir /rmmbackups/daily fi @@ -35,7 +35,7 @@ if [[ $* == *--schedule* ]]; then sudo mkdir /rmmbackups/monthly fi sudo chown ${USER}:${USER} -R /rmmbackups - + printf >&2 "${GREEN}Backups setup to run at midnight and rotate.${NC}\n" exit 0 fi @@ -70,7 +70,7 @@ POSTGRES_PW=$(/rmm/api/env/bin/python /rmm/api/tacticalrmm/manage.py get_config pg_dump --dbname=postgresql://"${POSTGRES_USER}":"${POSTGRES_PW}"@127.0.0.1:5432/tacticalrmm | gzip -9 >${tmp_dir}/postgres/db-${dt_now}.psql.gz -tar -czvf ${tmp_dir}/meshcentral/mesh.tar.gz --exclude=/meshcentral/node_modules /meshcentral +node /meshcentral/node_modules/meshcentral --dbexport # for import to postgres if grep -q postgres "/meshcentral/meshcentral-data/config.json"; then if ! which jq >/dev/null; then @@ -83,6 +83,8 @@ else mongodump --gzip --out=${tmp_dir}/meshcentral/mongo fi +tar -czvf ${tmp_dir}/meshcentral/mesh.tar.gz --exclude=/meshcentral/node_modules /meshcentral + sudo tar -czvf ${tmp_dir}/certs/etc-letsencrypt.tar.gz -C /etc/letsencrypt . for i in rmm frontend meshcentral; do @@ -93,7 +95,6 @@ sudo tar -czvf ${tmp_dir}/confd/etc-confd.tar.gz -C /etc/conf.d . sudo cp ${sysd}/rmm.service ${sysd}/celery.service ${sysd}/celerybeat.service ${sysd}/meshcentral.service ${sysd}/nats.service ${sysd}/daphne.service ${sysd}/nats-api.service ${tmp_dir}/systemd/ -cat /rmm/api/tacticalrmm/tacticalrmm/private/log/django_debug.log | gzip -9 >${tmp_dir}/rmm/debug.log.gz cp /rmm/api/tacticalrmm/tacticalrmm/local_settings.py ${tmp_dir}/rmm/ if [[ $* == *--auto* ]]; then diff --git a/install.sh b/install.sh index 83712267..9021b4bd 100644 --- a/install.sh +++ b/install.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -SCRIPT_VERSION="73" +SCRIPT_VERSION="74" SCRIPT_URL='https://raw.githubusercontent.com/amidaware/tacticalrmm/master/install.sh' sudo apt install -y curl wget dirmngr gnupg lsb-release @@ -30,8 +30,8 @@ fi rm -f $TMP_FILE arch=$(uname -m) -if [ "$arch" != "x86_64" ]; then - echo -ne "${RED}ERROR: Only x86_64 arch is supported, not ${arch}${NC}\n" +if [[ "$arch" != "x86_64" ]] && [[ "$arch" != "aarch64" ]]; then + echo -ne "${RED}ERROR: Only x86_64 and aarch64 is supported, not ${arch}${NC}\n" exit 1 fi @@ -49,19 +49,22 @@ codename=$(lsb_release -sc) relno=$(lsb_release -sr | cut -d. -f1) fullrelno=$(lsb_release -sr) -# Fallback if lsb_release -si returns anything else than Ubuntu, Debian or Raspbian -if [ ! "$osname" = "ubuntu" ] && [ ! "$osname" = "debian" ]; then - osname=$(grep -oP '(?<=^ID=).+' /etc/os-release | tr -d '"') - osname=${osname^} -fi +not_supported() { + echo -ne "${RED}ERROR: Only Debian 11, Debian 12 and Ubuntu 22.04 are supported.${NC}\n" +} -# determine system -if ([ "$osname" = "ubuntu" ] && [ "$fullrelno" = "20.04" ]) || ([ "$osname" = "debian" ] && [ $relno -ge 10 ]); then - echo $fullrel +if [[ "$osname" == "debian" ]]; then + if [[ "$relno" -ne 11 && "$relno" -ne 12 ]]; then + not_supported + exit 1 + fi +elif [[ "$osname" == "ubuntu" ]]; then + if [[ "$fullrelno" != "22.04" ]]; then + not_supported + exit 1 + fi else - echo $fullrel - echo -ne "${RED}Supported versions: Ubuntu 20.04, Debian 10 and 11\n" - echo -ne "Your system does not appear to be supported${NC}\n" + not_supported exit 1 fi @@ -78,16 +81,12 @@ if [[ "$LANG" != *".UTF-8" ]]; then exit 1 fi -if ([ "$osname" = "ubuntu" ]); then - mongodb_repo="deb [arch=amd64] https://repo.mongodb.org/apt/$osname $codename/mongodb-org/4.4 multiverse" -# there is no bullseye repo yet for mongo so just use buster on debian 11 -elif ([ "$osname" = "debian" ] && [ $relno -eq 11 ]); then - mongodb_repo="deb [arch=amd64] https://repo.mongodb.org/apt/$osname buster/mongodb-org/4.4 main" +if [ "$arch" = "x86_64" ]; then + pgarch='amd64' else - mongodb_repo="deb [arch=amd64] https://repo.mongodb.org/apt/$osname $codename/mongodb-org/4.4 main" + pgarch='arm64' fi - -postgresql_repo="deb [arch=amd64] https://apt.postgresql.org/pub/repos/apt/ $codename-pgdg main" +postgresql_repo="deb [arch=${pgarch}] https://apt.postgresql.org/pub/repos/apt/ $codename-pgdg main" # prevents logging issues with some VPS providers like Vultr if this is a freshly provisioned instance that hasn't been rebooted yet sudo systemctl restart systemd-journald.service @@ -98,6 +97,8 @@ MESHPASSWD=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 25 | head -n 1) pgusername=$(cat /dev/urandom | tr -dc 'a-z' | fold -w 8 | head -n 1) pgpw=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 20 | head -n 1) meshusername=$(cat /dev/urandom | tr -dc 'a-z' | fold -w 8 | head -n 1) +MESHPGUSER=$(cat /dev/urandom | tr -dc 'a-z' | fold -w 8 | head -n 1) +MESHPGPWD=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 20 | head -n 1) cls() { printf "\033c" @@ -136,11 +137,6 @@ while [[ $letsemail != *[@]*[.]* ]]; do read letsemail done -# if server is behind NAT we need to add the 3 subdomains to the host file -# so that nginx can properly route between the frontend, backend and meshcentral -# EDIT 8-29-2020 -# running this even if server is __not__ behind NAT just to make DNS resolving faster -# this also allows the install script to properly finish even if DNS has not fully propagated CHECK_HOSTS=$(grep 127.0.1.1 /etc/hosts | grep "$rmmdomain" | grep "$meshdomain" | grep "$frontenddomain") HAS_11=$(grep 127.0.1.1 /etc/hosts) @@ -230,21 +226,12 @@ done print_green 'Installing NodeJS' -curl -sL https://deb.nodesource.com/setup_16.x | sudo -E bash - +curl -sL https://deb.nodesource.com/setup_18.x | sudo -E bash - sudo apt update sudo apt install -y gcc g++ make sudo apt install -y nodejs sudo npm install -g npm -print_green 'Installing MongoDB' - -wget -qO - https://www.mongodb.org/static/pgp/server-4.4.asc | sudo apt-key add - -echo "$mongodb_repo" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.4.list -sudo apt update -sudo apt install -y mongodb-org -sudo systemctl enable mongod -sudo systemctl restart mongod - print_green "Installing Python ${PYTHON_VER}" sudo apt install -y build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev libsqlite3-dev libbz2-dev @@ -268,7 +255,7 @@ echo "$postgresql_repo" | sudo tee /etc/apt/sources.list.d/pgdg.list wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add - sudo apt update -sudo apt install -y postgresql-14 +sudo apt install -y postgresql-15 sleep 2 sudo systemctl enable --now postgresql @@ -277,7 +264,7 @@ until pg_isready >/dev/null; do sleep 3 done -print_green 'Creating database for the rmm' +print_green 'Creating database for trmm' sudo -u postgres psql -c "CREATE DATABASE tacticalrmm" sudo -u postgres psql -c "CREATE USER ${pgusername} WITH PASSWORD '${pgpw}'" @@ -285,6 +272,19 @@ sudo -u postgres psql -c "ALTER ROLE ${pgusername} SET client_encoding TO 'utf8' sudo -u postgres psql -c "ALTER ROLE ${pgusername} SET default_transaction_isolation TO 'read committed'" sudo -u postgres psql -c "ALTER ROLE ${pgusername} SET timezone TO 'UTC'" sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE tacticalrmm TO ${pgusername}" +sudo -u postgres psql -c "ALTER DATABASE tacticalrmm OWNER TO ${pgusername}" +sudo -u postgres psql -c "GRANT USAGE, CREATE ON SCHEMA PUBLIC TO ${pgusername}" + +print_green 'Creating database for meshcentral' + +sudo -u postgres psql -c "CREATE DATABASE meshcentral" +sudo -u postgres psql -c "CREATE USER ${MESHPGUSER} WITH PASSWORD '${MESHPGPWD}'" +sudo -u postgres psql -c "ALTER ROLE ${MESHPGUSER} SET client_encoding TO 'utf8'" +sudo -u postgres psql -c "ALTER ROLE ${MESHPGUSER} SET default_transaction_isolation TO 'read committed'" +sudo -u postgres psql -c "ALTER ROLE ${MESHPGUSER} SET timezone TO 'UTC'" +sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE meshcentral TO ${MESHPGUSER}" +sudo -u postgres psql -c "ALTER DATABASE meshcentral OWNER TO ${MESHPGUSER}" +sudo -u postgres psql -c "GRANT USAGE, CREATE ON SCHEMA PUBLIC TO ${MESHPGUSER}" print_green 'Cloning repos' @@ -308,11 +308,17 @@ git checkout main print_green 'Downloading NATS' +if [ "$arch" = "x86_64" ]; then + natsarch='amd64' +else + natsarch='arm64' +fi + NATS_SERVER_VER=$(grep "^NATS_SERVER_VER" "$SETTINGS_FILE" | awk -F'[= "]' '{print $5}') nats_tmp=$(mktemp -d -t nats-XXXXXXXXXX) -wget https://github.com/nats-io/nats-server/releases/download/v${NATS_SERVER_VER}/nats-server-v${NATS_SERVER_VER}-linux-amd64.tar.gz -P ${nats_tmp} -tar -xzf ${nats_tmp}/nats-server-v${NATS_SERVER_VER}-linux-amd64.tar.gz -C ${nats_tmp} -sudo mv ${nats_tmp}/nats-server-v${NATS_SERVER_VER}-linux-amd64/nats-server /usr/local/bin/ +wget https://github.com/nats-io/nats-server/releases/download/v${NATS_SERVER_VER}/nats-server-v${NATS_SERVER_VER}-linux-${natsarch}.tar.gz -P ${nats_tmp} +tar -xzf ${nats_tmp}/nats-server-v${NATS_SERVER_VER}-linux-${natsarch}.tar.gz -C ${nats_tmp} +sudo mv ${nats_tmp}/nats-server-v${NATS_SERVER_VER}-linux-${natsarch}/nats-server /usr/local/bin/ sudo chmod +x /usr/local/bin/nats-server sudo chown ${USER}:${USER} /usr/local/bin/nats-server rm -rf ${nats_tmp} @@ -332,8 +338,6 @@ meshcfg="$( { "settings": { "cert": "${meshdomain}", - "mongoDb": "mongodb://127.0.0.1:27017", - "mongoDbName": "meshcentral", "WANonly": true, "minify": 1, "port": 4430, @@ -341,15 +345,20 @@ meshcfg="$( "redirPort": 800, "allowLoginToken": true, "allowFraming": true, - "_agentPing": 60, - "agentPong": 300, + "agentPing": 35, "allowHighQualityDesktop": true, "tlsOffload": "127.0.0.1", "agentCoreDump": false, "compression": true, "wsCompression": true, "agentWsCompression": true, - "maxInvalidLogin": { "time": 5, "count": 5, "coolofftime": 30 } + "maxInvalidLogin": { "time": 5, "count": 5, "coolofftime": 30 }, + "postgres": { + "user": "${MESHPGUSER}", + "password": "${MESHPGPWD}", + "port": "5432", + "host": "localhost" + } }, "domains": { "": { @@ -400,7 +409,13 @@ EOF )" echo "${localvars}" >/rmm/api/tacticalrmm/tacticalrmm/local_settings.py -sudo cp /rmm/natsapi/bin/nats-api /usr/local/bin +if [ "$arch" = "x86_64" ]; then + natsapi='nats-api' +else + natsapi='nats-api-arm64' +fi + +sudo cp /rmm/natsapi/bin/${natsapi} /usr/local/bin/nats-api sudo chown ${USER}:${USER} /usr/local/bin/nats-api sudo chmod +x /usr/local/bin/nats-api @@ -495,7 +510,7 @@ ExecStart=/usr/local/bin/nats-server -c /rmm/api/tacticalrmm/nats-rmm.conf ExecReload=/usr/bin/kill -s HUP \$MAINPID ExecStop=/usr/bin/kill -s SIGINT \$MAINPID User=${USER} -Group=www-data +Group=${USER} Restart=always RestartSec=5s LimitNOFILE=1000000 @@ -567,6 +582,7 @@ server { location /static/ { root /rmm/api/tacticalrmm; + add_header "Access-Control-Allow-Origin" "https://${frontenddomain}"; } location /private/ { @@ -575,6 +591,12 @@ server { alias /rmm/api/tacticalrmm/tacticalrmm/private/; } + location /assets/ { + internal; + add_header "Access-Control-Allow-Origin" "https://${frontenddomain}"; + alias /opt/tactical/reporting/assets/; + } + location ~ ^/ws/ { proxy_pass http://unix:/rmm/daphne.sock; @@ -736,7 +758,7 @@ meshservice="$( cat <${mesh_data}/config-postgres.json + + mv ${mesh_data}/config-postgres.json ${mesh_data}/config.json +else + gzip -d $tmp_dir/postgres/mesh-db*.psql.gz + PGPASSWORD=${MESH_POSTGRES_PW} psql -h localhost -U ${MESH_POSTGRES_USER} -d meshcentral -f $tmp_dir/postgres/mesh-db*.psql +fi + cd /meshcentral npm install meshcentral@${MESH_VER} -print_green 'Restoring MeshCentral DB' - -if grep -q postgres "/meshcentral/meshcentral-data/config.json"; then - if ! which jq >/dev/null; then - sudo apt-get install -y jq >null - fi - MESH_POSTGRES_USER=$(jq '.settings.postgres.user' /meshcentral/meshcentral-data/config.json -r) - MESH_POSTGRES_PW=$(jq '.settings.postgres.password' /meshcentral/meshcentral-data/config.json -r) - sudo -u postgres psql -c "DROP DATABASE IF EXISTS meshcentral" - sudo -u postgres psql -c "CREATE DATABASE meshcentral" - sudo -u postgres psql -c "CREATE USER ${MESH_POSTGRES_USER} WITH PASSWORD '${MESH_POSTGRES_PW}'" - sudo -u postgres psql -c "ALTER ROLE ${MESH_POSTGRES_USER} SET client_encoding TO 'utf8'" - sudo -u postgres psql -c "ALTER ROLE ${MESH_POSTGRES_USER} SET default_transaction_isolation TO 'read committed'" - sudo -u postgres psql -c "ALTER ROLE ${MESH_POSTGRES_USER} SET timezone TO 'UTC'" - sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE meshcentral TO ${MESH_POSTGRES_USER}" - gzip -d $tmp_dir/postgres/mesh-db*.psql.gz - PGPASSWORD=${MESH_POSTGRES_PW} psql -h localhost -U ${MESH_POSTGRES_USER} -d meshcentral -f $tmp_dir/postgres/mesh-db*.psql -else - print_green 'Installing MongoDB' - wget -qO - https://www.mongodb.org/static/pgp/server-4.4.asc | sudo apt-key add - - echo "$mongodb_repo" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.4.list - sudo apt update - sudo apt install -y mongodb-org - sudo systemctl enable --now mongod - sleep 5 - mongorestore --gzip $tmp_dir/meshcentral/mongo +if [ "$FROM_MONGO" = true ]; then + node node_modules/meshcentral --dbimport >/dev/null fi print_green 'Restoring the backend' cp $tmp_dir/rmm/local_settings.py /rmm/api/tacticalrmm/tacticalrmm/ -gzip -d $tmp_dir/rmm/debug.log.gz -cp $tmp_dir/rmm/django_debug.log /rmm/api/tacticalrmm/tacticalrmm/private/log/ -sudo cp /rmm/natsapi/bin/nats-api /usr/local/bin +if [ "$arch" = "x86_64" ]; then + natsapi='nats-api' +else + natsapi='nats-api-arm64' +fi + +sudo cp /rmm/natsapi/bin/${natsapi} /usr/local/bin/nats-api sudo chown ${USER}:${USER} /usr/local/bin/nats-api sudo chmod +x /usr/local/bin/nats-api -print_green 'Restoring the database' +print_green 'Restoring the trmm database' pgusername=$(grep -w USER /rmm/api/tacticalrmm/tacticalrmm/local_settings.py | sed 's/^.*: //' | sed 's/.//' | sed -r 's/.{2}$//') pgpw=$(grep -w PASSWORD /rmm/api/tacticalrmm/tacticalrmm/local_settings.py | sed 's/^.*: //' | sed 's/.//' | sed -r 's/.{2}$//') -sudo -u postgres psql -c "DROP DATABASE IF EXISTS tacticalrmm" sudo -u postgres psql -c "CREATE DATABASE tacticalrmm" sudo -u postgres psql -c "CREATE USER ${pgusername} WITH PASSWORD '${pgpw}'" sudo -u postgres psql -c "ALTER ROLE ${pgusername} SET client_encoding TO 'utf8'" sudo -u postgres psql -c "ALTER ROLE ${pgusername} SET default_transaction_isolation TO 'read committed'" sudo -u postgres psql -c "ALTER ROLE ${pgusername} SET timezone TO 'UTC'" sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE tacticalrmm TO ${pgusername}" +sudo -u postgres psql -c "ALTER DATABASE tacticalrmm OWNER TO ${pgusername}" +sudo -u postgres psql -c "GRANT USAGE, CREATE ON SCHEMA PUBLIC TO ${pgusername}" gzip -d $tmp_dir/postgres/db*.psql.gz PGPASSWORD=${pgpw} psql -h localhost -U ${pgusername} -d tacticalrmm -f $tmp_dir/postgres/db*.psql @@ -384,7 +424,13 @@ sudo chown -R $USER:$GROUP /home/${USER}/.npm sudo chown -R $USER:$GROUP /home/${USER}/.config sudo chown -R $USER:$GROUP /home/${USER}/.cache -print_green 'Enabling Services' +print_green 'Enabling and starting services' + +HAS_OLD_MONGO_DEP=$(grep mongod /etc/systemd/system/meshcentral.service) +if [[ $HAS_OLD_MONGO_DEP ]]; then + sudo sed -i 's/mongod.service/postgresql.service/g' /etc/systemd/system/meshcentral.service +fi + sudo systemctl daemon-reload for i in celery.service celerybeat.service rmm.service daphne.service nats-api.service nginx; do diff --git a/update.sh b/update.sh index 1705c925..bebad055 100644 --- a/update.sh +++ b/update.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -SCRIPT_VERSION="144" +SCRIPT_VERSION="145" SCRIPT_URL='https://raw.githubusercontent.com/amidaware/tacticalrmm/master/update.sh' LATEST_SETTINGS_URL='https://raw.githubusercontent.com/amidaware/tacticalrmm/master/api/tacticalrmm/tacticalrmm/settings.py' YELLOW='\033[1;33m' @@ -225,16 +225,24 @@ if ! [[ $HAS_PY311 ]]; then sudo rm -rf Python-${PYTHON_VER} Python-${PYTHON_VER}.tgz fi +arch=$(uname -m) +nats_server='/usr/local/bin/nats-server' + HAS_LATEST_NATS=$(/usr/local/bin/nats-server -version | grep "${NATS_SERVER_VER}") if ! [[ $HAS_LATEST_NATS ]]; then printf >&2 "${GREEN}Updating nats to v${NATS_SERVER_VER}${NC}\n" nats_tmp=$(mktemp -d -t nats-XXXXXXXXXX) - wget https://github.com/nats-io/nats-server/releases/download/v${NATS_SERVER_VER}/nats-server-v${NATS_SERVER_VER}-linux-amd64.tar.gz -P ${nats_tmp} - tar -xzf ${nats_tmp}/nats-server-v${NATS_SERVER_VER}-linux-amd64.tar.gz -C ${nats_tmp} - sudo rm -f /usr/local/bin/nats-server - sudo mv ${nats_tmp}/nats-server-v${NATS_SERVER_VER}-linux-amd64/nats-server /usr/local/bin/ - sudo chmod +x /usr/local/bin/nats-server - sudo chown ${USER}:${USER} /usr/local/bin/nats-server + if [ "$arch" = "x86_64" ]; then + natsarch='amd64' + else + natsarch='arm64' + fi + wget https://github.com/nats-io/nats-server/releases/download/v${NATS_SERVER_VER}/nats-server-v${NATS_SERVER_VER}-linux-${natsarch}.tar.gz -P ${nats_tmp} + tar -xzf ${nats_tmp}/nats-server-v${NATS_SERVER_VER}-linux-${natsarch}.tar.gz -C ${nats_tmp} + sudo rm -f $nats_server + sudo mv ${nats_tmp}/nats-server-v${NATS_SERVER_VER}-linux-${natsarch}/nats-server /usr/local/bin/ + sudo chmod +x $nats_server + sudo chown ${USER}:${USER} $nats_server rm -rf ${nats_tmp} fi @@ -250,24 +258,6 @@ if [ -d ~/.config ]; then sudo chown -R $USER:$GROUP ~/.config fi -HAS_NODE16=$(node --version | grep v16) -if ! [[ $HAS_NODE16 ]]; then - printf >&2 "${GREEN}Updating NodeJS to v16${NC}\n" - rm -rf /rmm/web/node_modules - sudo systemctl stop meshcentral - sudo apt remove -y nodejs - sudo rm -rf /usr/lib/node_modules - curl -sL https://deb.nodesource.com/setup_16.x | sudo -E bash - - sudo apt update - sudo apt install -y nodejs - sudo npm install -g npm - sudo chown ${USER}:${USER} -R /meshcentral - cd /meshcentral - rm -rf node_modules/ - npm install meshcentral@${LATEST_MESH_VER} - sudo systemctl start meshcentral -fi - sudo npm install -g npm # update from main repo @@ -324,9 +314,16 @@ EOF echo "${adminenabled}" | tee --append /rmm/api/tacticalrmm/tacticalrmm/local_settings.py >/dev/null fi -sudo cp /rmm/natsapi/bin/nats-api /usr/local/bin -sudo chown ${USER}:${USER} /usr/local/bin/nats-api -sudo chmod +x /usr/local/bin/nats-api +if [ "$arch" = "x86_64" ]; then + natsapi='nats-api' +else + natsapi='nats-api-arm64' +fi + +nats_api='/usr/local/bin/nats-api' +sudo cp /rmm/natsapi/bin/${natsapi} $nats_api +sudo chown ${USER}:${USER} $nats_api +sudo chmod +x $nats_api if [[ "${CURRENT_PIP_VER}" != "${LATEST_PIP_VER}" ]] || [[ "$force" = true ]]; then rm -rf /rmm/api/env