[Solved] Nemo Action To Install .deb File

About writing shell scripts and making the most of your shell
Forum rules
Topics in this forum are automatically closed 6 months after creation.
Locked
ismail783
Level 2
Level 2
Posts: 99
Joined: Tue Jul 10, 2018 10:34 am

[Solved] Nemo Action To Install .deb File

Post by ismail783 »

My Nemo Action Looks like:

Code: Select all

[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;
My `zenity_askpass.sh` file looks like:

Code: Select all

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

My `install_deb_file.sh` file looks like:

Code: Select all

#!/bin/dash

export SUDO_ASKPASS="$HOME/.local/share/nemo/actions/scripts/zenity_askpass.sh"
sudo dpkg -i "$1"
How can I modify `install_deb_file.sh` so that it install the .deb package and show the stdout / stderr of `sudo dpkg -i "$1"` in zenity.
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 2 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
bgaabab
Level 1
Level 1
Posts: 3
Joined: Mon Jun 20, 2022 5:11 am

Re: Nemo Action To Install .deb File

Post by bgaabab »

Hello Ismail, Why not putting both stderr and stdout to the same file and display the result using the $( ) substitution.

In 'install_deb_file.sh', use

Code: Select all

export SUDO_ASKPASS="$HOME/.local/share/nemo/actions/scripts/zenity_askpass.sh"
sudo dpkg -i "$1" 2>&1 1>/tmp/dpkg.result
zenity --text="$(cat /tmp/dpkg.result)"
rm /tmp/dpkg.result
You may check whether this can be done with stream redirection (instead of creating the 'dpkg.result' file). This link https://stackoverflow.com/questions/234 ... not-stdout may help you on this.

Brahim
User avatar
smurphos
Level 18
Level 18
Posts: 8501
Joined: Fri Sep 05, 2014 12:18 am
Location: Irish Brit in Portugal
Contact:

Re: Nemo Action To Install .deb File

Post by smurphos »

This may suit ...

Code: Select all

#!/bin/bash
export SUDO_ASKPASS="$HOME/.local/share/nemo/actions/scripts/zenity_askpass.sh"
sudo -A dpkg -i "$1" 2>/dev/null | tee >(xargs -I % echo "#%") | zenity --progress --width=800 --pulsate --title="Installing $1" --no-cancel 2>/dev/null
Image
For custom Nemo actions, useful scripts for the Cinnamon desktop, and Cinnamox themes visit my Github pages.
ismail783
Level 2
Level 2
Posts: 99
Joined: Tue Jul 10, 2018 10:34 am

Re: [Solved] Nemo Action To Install .deb File

Post by ismail783 »

Thank you very much. This solves my problem.
Locked

Return to “Scripts & Bash”