+# Make sure we have sudo powers when we need it
+if ! sudo -k; then
+ printerror "This script requires sudo to function"
+ exit 1
+fi
+
+# But don't run as super user, otherwise we can't access the keyring
+if [ ${UID} -eq 0 ]; then
+ if [ "${Plaintext}" != "YES" ]; then
+ printerror "Please run this script as your normal user, we will prompt you for your sudo password when needed. Or you can use the --plaintext option"
+ exit 1
+ fi
+else
+ echo "Please provide sudo password, as some parts of this script requires it"
+ if ! sudo true; then
+ printerror "Sorry, this script requires working sudo privileges to function"
+ exit 1
+ fi
+fi
+