Files
Plasma-Addon-Synology-NAS/install.sh
T
Jaroslav Beneš 742d2416d7 Fix: store KWallet passwords via D-Bus (kwallet-query -w never persists)
kwallet-query --write-password returns success but does not create the folder
or persist the secret, so saved host passwords were silently lost and share
enumeration failed with NT_STATUS_LOGON_FAILURE. Write/delete now go through
the kwalletd6 D-Bus API via qdbus6 (open/createFolder/writePassword). Reads
stay on kwallet-query (they work). Also drop smbclient -N (was forcing an
anonymous session) and silence KWallet read stderr. Adds qt6-tools dep.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-17 19:00:27 +02:00

71 lines
2.3 KiB
Bash
Executable File

#!/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 qdbus6 "qt6-tools"
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