fix(librenms): run daily.sh as librenms user with git available (#15314)

This commit is contained in:
CanbiZ (MickLesk)
2026-06-23 07:48:52 +02:00
committed by GitHub
parent eabfaf25dc
commit 33a18190fc
2 changed files with 25 additions and 3 deletions
+14 -3
View File
@@ -29,10 +29,21 @@ function update_script() {
exit
fi
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"
su librenms
cd /opt/librenms
./daily.sh
$STD su - librenms -s /bin/bash -c 'cd /opt/librenms && ./daily.sh'
msg_ok "Updated LibreNMS"
exit
}