Compare commits

...

1 Commits

Author SHA1 Message Date
MickLesk 3b45fc21ef fix(librenms): run daily.sh as librenms user with git available
Install git, initialize git metadata for tarball deployments, and execute
daily.sh via su so updates no longer fail with permission or missing git.
2026-06-22 21:39:17 +02:00
2 changed files with 25 additions and 3 deletions
+14 -3
View File
@@ -29,10 +29,21 @@ function update_script() {
exit exit
fi fi
setup_mariadb setup_mariadb
ensure_dependencies git
if [[ ! -d /opt/librenms/.git ]]; then
msg_info "Initializing LibreNMS git metadata"
LIBRENMS_VERSION=$(cat ~/.librenms 2>/dev/null)
cd /opt/librenms
git init -q
git remote add origin https://github.com/librenms/librenms.git
git fetch --depth 1 origin "refs/tags/v${LIBRENMS_VERSION}" 2>/dev/null ||
git fetch --depth 1 origin "refs/tags/${LIBRENMS_VERSION}" 2>/dev/null || true
git checkout -qf FETCH_HEAD 2>/dev/null || true
chown -R librenms:librenms .git
msg_ok "Initialized LibreNMS git metadata"
fi
msg_info "Updating LibreNMS" msg_info "Updating LibreNMS"
su librenms $STD su - librenms -s /bin/bash -c 'cd /opt/librenms && ./daily.sh'
cd /opt/librenms
./daily.sh
msg_ok "Updated LibreNMS" msg_ok "Updated LibreNMS"
exit exit
} }
+11
View File
@@ -17,6 +17,7 @@ msg_info "Installing Dependencies"
$STD apt install -y \ $STD apt install -y \
acl \ acl \
fping \ fping \
git \
graphviz \ graphviz \
imagemagick \ imagemagick \
mtr-tiny \ mtr-tiny \
@@ -64,6 +65,16 @@ EOF
chown -R librenms:librenms /opt/librenms chown -R librenms:librenms /opt/librenms
chmod 771 /opt/librenms chmod 771 /opt/librenms
chmod -R ug=rwX /opt/librenms/bootstrap/cache /opt/librenms/storage /opt/librenms/logs /opt/librenms/rrd chmod -R ug=rwX /opt/librenms/bootstrap/cache /opt/librenms/storage /opt/librenms/logs /opt/librenms/rrd
if [[ ! -d /opt/librenms/.git ]]; then
LIBRENMS_VERSION=$(cat ~/.librenms 2>/dev/null)
cd /opt/librenms
git init -q
git remote add origin https://github.com/librenms/librenms.git
git fetch --depth 1 origin "refs/tags/v${LIBRENMS_VERSION}" 2>/dev/null ||
git fetch --depth 1 origin "refs/tags/${LIBRENMS_VERSION}" 2>/dev/null || true
git checkout -qf FETCH_HEAD 2>/dev/null || true
chown -R librenms:librenms .git
fi
msg_ok "Configured LibreNMS" msg_ok "Configured LibreNMS"
msg_info "Configure MariaDB" msg_info "Configure MariaDB"