在 Zenith 中显示 stdout 和 stderr

在 Zenith 中显示 stdout 和 stderr

我正在尝试.deb通过在 Nemo 中右键单击该文件来安装该文件。

我的尼莫动作看起来像:

[Nemo Action]
Name=Install Deb File
Comment=Install %F
Exec=<scripts/install_deb_file.sh %F>
Icon-Name=package-x-generic-symbolic
Selection=s
Extensions=deb;
EscapeSpaces=true
Dependencies=zenity;dpkg;

我的zenity_askpass.sh文件如下所示:

#!/bin/bash
zenity --password --title="Authenticate"

我的install_deb_file.sh文件如下所示:

#!/bin/dash

export SUDO_ASKPASS="$HOME/.local/share/nemo/actions/scripts/zenity_askpass.sh"
sudo dpkg -i "$1"

我怎样才能修改install_deb_file.sh,以便它安装包并显示zenity 中.deb的 stdout / stderr 。sudo dpkg -i "$1"

答案1

文件install_deb_file.sh

#!/bin/dash

export SUDO_ASKPASS="$HOME/.local/share/nemo/actions/scripts/zenity_askpass.sh"

# zenity --notification --text="$(sudo dpkg -i "$1" 2>&1)"

# zenity --width=250 --height=250 --info --text="$(sudo dpkg -i "$1" 2>&1)"

COMMAND_OUTPUT=$(sudo dpkg -i "$1" 2>&1)

if [ $? = 1 ]; then
    zenity --info --width=250 --text="$COMMAND_OUTPUT"
    exit 1
else
    notify-send --expire-time=200000 "Successfully Installed $1"
    exit 0
fi

相关内容