Add install.sh, uninstall.sh and README
Distro-agnostic installer (dep check, sudo helper+policy install, per-user kpackagetool6 install/upgrade) and matching uninstaller; full public README covering requirements, usage, architecture and security notes. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Executable
+69
@@ -0,0 +1,69 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# install.sh — install the Synology NAS plasmoid + its privileged helper.
|
||||
#
|
||||
# Distro-agnostic: the plasmoid is installed per-user with kpackagetool6, and
|
||||
# the helper + polkit policy go to system paths via sudo. Re-running upgrades
|
||||
# in place (idempotent).
|
||||
#
|
||||
set -eu
|
||||
|
||||
HERE=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
|
||||
APPLET_ID="sk.houmeres.synologynas"
|
||||
HELPER_SRC="$HERE/helper/synology-nas-helper"
|
||||
POLICY_SRC="$HERE/helper/sk.houmeres.synologynas.policy"
|
||||
HELPER_DEST="/usr/lib/synology-nas/helper"
|
||||
POLICY_DEST="/usr/share/polkit-1/actions/sk.houmeres.synologynas.policy"
|
||||
|
||||
say() { printf '==> %s\n' "$1"; }
|
||||
warn() { printf 'WARNING: %s\n' "$1" >&2; }
|
||||
|
||||
# --- dependency check ---------------------------------------------------------
|
||||
missing=0
|
||||
check() {
|
||||
if command -v "$1" >/dev/null 2>&1; then
|
||||
return
|
||||
fi
|
||||
warn "missing '$1' — install $2"
|
||||
missing=1
|
||||
}
|
||||
say "Checking dependencies"
|
||||
check kpackagetool6 "plasma-workspace / plasma-sdk"
|
||||
check pkexec "polkit"
|
||||
check mount.cifs "cifs-utils"
|
||||
check smbclient "smbclient"
|
||||
check kwallet-query "kwallet (KF6)"
|
||||
check findmnt "util-linux"
|
||||
if [ "$missing" -ne 0 ]; then
|
||||
warn "resolve the above and re-run. Continuing anyway..."
|
||||
fi
|
||||
|
||||
# --- install helper + polkit policy (root) ------------------------------------
|
||||
say "Installing privileged helper to $HELPER_DEST"
|
||||
sudo install -Dm755 "$HELPER_SRC" "$HELPER_DEST"
|
||||
say "Installing polkit policy to $POLICY_DEST"
|
||||
sudo install -Dm644 "$POLICY_SRC" "$POLICY_DEST"
|
||||
|
||||
# --- install / upgrade the plasmoid (user) ------------------------------------
|
||||
if kpackagetool6 --type Plasma/Applet --list 2>/dev/null | grep -qx "$APPLET_ID"; then
|
||||
say "Upgrading plasmoid $APPLET_ID"
|
||||
kpackagetool6 --type Plasma/Applet --upgrade "$HERE/package"
|
||||
else
|
||||
say "Installing plasmoid $APPLET_ID"
|
||||
kpackagetool6 --type Plasma/Applet --install "$HERE/package"
|
||||
fi
|
||||
|
||||
cat <<EOF
|
||||
|
||||
Done.
|
||||
|
||||
Add the widget:
|
||||
Right-click your panel or system tray -> "Add Widgets..." -> search
|
||||
"Synology NAS", or add it to the System Tray's configured entries.
|
||||
|
||||
Test it standalone (no panel needed):
|
||||
plasmawindowed $APPLET_ID
|
||||
|
||||
If the widget was already loaded, restart the shell to pick up changes:
|
||||
kquitapp6 plasmashell && kstart plasmashell >/dev/null 2>&1 &
|
||||
EOF
|
||||
Reference in New Issue
Block a user