Files
fedora-OEMDRV/client_software/0010_kwallet/qbus_wallet_exec.sh
T
2026-04-07 16:59:07 +02:00

34 lines
1.0 KiB
Bash
Executable File

#!/usr/bin/env bash
# SPDX-FileCopyrightText: Daniel Pätzold
# SPDX-License-Identifier: AGPL-3.0-or-later
#
# Resets the KDE- Wallet
#
set -euo pipefail
#First, check if qdbus and kwallet is working via dbus
QB_CMD="qdbus-qt6"
if ! command -v ${QB_CMD} >/dev/null 2>&1; then
QB_CMD="qdbus"
if ! command -v ${QB_CMD} >/dev/null 2>&1; then
echo "qdbus-qt6 or qdbus not found; cannot create KWallet via DBus. Install Qt DBus tools."
exit 1
fi
fi
# Determine kwallet DBus service name (kwalletd6 on Plasma with KF6, else kwalletd5)
QB_SERVICE="org.kde.kwalletd"
if ( ${QB_CMD} "$QB_SERVICE" | grep -q "/modules/kwalletd6" ); then
QB_PATH="/modules/kwalletd6"
elif ( qdbus-qt6 "$QB_SERVICE" | grep -q "/modules/kwalletd5" ); then
QB_PATH="/modules/kwalletd5"
else
# Try calling directly — system may expose the service as org.kde.KWallet
QB_SERVICE="org.kde.KWallet"
QB_PATH=$( ${QB_CMD} "$QB_SERVICE" | grep -q "/modules/kwalletd" )
fi
#Now, run the command
${QB_CMD} "$QB_SERVICE" "$QB_PATH" $@
exit $?