Initial LanUps implementation and native installers

This commit is contained in:
tongtong committed 2026-11-28 16:26:39 +08:00
commit 67a043c89b
66 files changed
+2870

No files matched your search

+14
View File
@@ -0,0 +1,14 @@
[Unit]
Description=LAN UPS Agent
After=network-online.target
Wants=network-online.target
[Service]
Type=exec
ExecStart=/opt/lanups/agent/LanUps.Agent
Restart=on-failure
RestartSec=5
UMask=0077
[Install]
WantedBy=multi-user.target
@@ -0,0 +1,5 @@
[Desktop Entry]
Type=Application
Name=局域网 UPS
Exec=/opt/lanups/desktop/LanUps.Desktop --tray
Terminal=false
+23
View File
@@ -0,0 +1,23 @@
#!/bin/sh
set -eu
[ "${1:-}" = configure ] || exit 0
data=/etc/LanUps
token=$data/agent.token
group=lanups-operators
install -d -m 0755 -o root -g root "$data"
getent group "$group" >/dev/null || groupadd --system "$group"
if [ ! -f "$token" ]; then LANUPS_AGENT_TOKEN="$token" /opt/lanups/agent/LanUps.Agent --provision; fi
chown root:"$group" "$token"
chmod 0640 "$token"
operator=${SUDO_USER:-}
if [ -z "$operator" ] || [ "$operator" = root ]; then operator=$(getent passwd 1000 | cut -d: -f1); fi
if [ -n "$operator" ] && [ "$(id -u "$operator")" -ge 1000 ]; then usermod -a -G "$group" "$operator"; fi
if command -v systemctl >/dev/null; then
systemctl enable lanups-agent.service
if [ -d /run/systemd/system ]; then
systemctl daemon-reload
deb-systemd-invoke restart lanups-agent.service
fi
fi
+3
View File
@@ -0,0 +1,3 @@
#!/bin/sh
set -eu
if [ -d /run/systemd/system ] && command -v systemctl >/dev/null; then systemctl daemon-reload; fi
+6
View File
@@ -0,0 +1,6 @@
#!/bin/sh
set -eu
if [ "${1:-}" = remove ] && command -v systemctl >/dev/null; then
if [ -d /run/systemd/system ]; then deb-systemd-invoke stop lanups-agent.service || :; fi
systemctl disable lanups-agent.service || :
fi
+3
View File
@@ -0,0 +1,3 @@
#!/bin/sh
[ -r /etc/LanUps/agent.token ] || exit 0
exec /opt/lanups/desktop/LanUps.Desktop --tray