From 210c1d7dcfce9f202ca6d0ec0eb0e2fba09f717e Mon Sep 17 00:00:00 2001 From: 4ntsy <228124712+4ntsy@users.noreply.github.com> Date: Wed, 24 Sep 2025 12:57:45 -0300 Subject: [PATCH] feat: SUDO_ASKPASS via zenity Signed-off-by: 4ntsy <228124712+4ntsy@users.noreply.github.com> --- p3/libs/linuxtoys.lib | 15 +++------------ p3/libs/zpass.sh | 2 ++ 2 files changed, 5 insertions(+), 12 deletions(-) create mode 100755 p3/libs/zpass.sh diff --git a/p3/libs/linuxtoys.lib b/p3/libs/linuxtoys.lib index 71c91d92..1fe056a8 100644 --- a/p3/libs/linuxtoys.lib +++ b/p3/libs/linuxtoys.lib @@ -1,18 +1,9 @@ ## linuxtoys function library source /etc/os-release +shopt -s expand_aliases +export SUDO_ASKPASS="${SCRIPT_DIR}/libs/zpass.sh" +alias sudo="sudo -A " -# set askpass for sudo requests -if [[ "$ID_LIKE" == *debian* ]] || [[ "$ID_LIKE" == *ubuntu* ]] || [ "$ID" == "debian" ] || [ "$ID" == "ubuntu" ]; then - export SUDO_ASKPASS="/usr/bin/ssh-askpass" -elif [[ "$ID" =~ ^(arch|cachyos)$ ]] || [[ "$ID_LIKE" == *arch* ]] || [[ "$ID_LIKE" == *archlinux* ]]; then - export SUDO_ASKPASS="/usr/lib/ssh/ssh-askpass" -elif [[ "$ID_LIKE" =~ (rhel|fedora) ]] || [[ "$ID" =~ (fedora) ]] || [[ "$ID_LIKE" == *suse* ]] || [[ "$ID" == *suse* ]]; then - if [[ "$ID_LIKE" == *suse* ]] || [[ "$ID" == *suse* ]]; then - export SUDO_ASKPASS="/usr/libexec/ssh/gnome-ssh-askpass" - else - export SUDO_ASKPASS="/usr/libexec/openssh/gnome-ssh-askpass" - fi -fi # sudo request sudo_rq () { sudo -Av diff --git a/p3/libs/zpass.sh b/p3/libs/zpass.sh new file mode 100755 index 00000000..0d098d37 --- /dev/null +++ b/p3/libs/zpass.sh @@ -0,0 +1,2 @@ +#!/bin/bash +zenity --password --title="LinuxToys" \ No newline at end of file