forked from obel1x/fedora-OEMDRV
KWallet-Service Setup introduced
This commit is contained in:
+43
@@ -0,0 +1,43 @@
|
||||
#!/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 $?
|
||||
|
||||
#Check if kwalletd is enabled
|
||||
${QB_CMD} "$QB_SERVICE" "$QB_PATH" reconfigure
|
||||
QB_RESULT=$( ${QB_CMD} "$QB_SERVICE" "$QB_PATH" isEnabled 2>/dev/null || true)
|
||||
if [[ "$QB_RESULT" != "true" ]]; then
|
||||
echo "Error checking if kWallet service is activated. Cannot continue. Return of Check was:"
|
||||
echo "$QB_RESULT"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user