1

Running sudo dpkg -i *.deb in a terminal opened in '/folder', installs all debs in the location '/folder'.

What command to add in nautilus-actions (Nautilus-Actions Configuration Tool) so that only selected deb files are installed?


For example, I looked for a script to run a command in a terminal and according to this model I have created this script:

#!/usr/bin/expect -f

# Get a Bash shell
spawn -noecho bash

# Wait for a prompt
expect "$ "

# Type something
send "sudo dpkg -i"

# Hand over control to the user
interact

exit

To run that script I have created an action with Nautilus-Actions Configuration Tool and tried to make settings to make it open within a selected location and for the selected deb files. The first part works, based on a command like: gnome-terminal -e "/path/to/the/script" --working-directory=%f

But the terminal just contains that command to install all debs from that folder, without considering the selection o files (in the context menu of which I can make the command appear: but it will affect all files, not just those selected).

  • 1
    For example in caja, the alternative to Nautilus of mate-desktop you have a ~/.local/share/nautilus/scripts where you can put you scripts files, that can be used in context menus. Nautilus has feature alike. – sebelk Oct 10 '13 at 21:52
  • @sebelk - with nautilus-actions the scripts are created and added through a GUI. but the script needs to contain a command, and that is what i am asking for. (e.g. - to select flv files and extract audio from these selected files i have added the command `-e "parallel avconv -i '{}' -map 0:1 -c:a copy '{}.m4a' -- %F". how to do that for installing selected deb files?) – user32012 Oct 10 '13 at 22:44
2

You can try:

#!/bin/sh
dpkg -i "$@"

HTH

  • is this the exact script, or a generic form with variables? – user32012 Oct 10 '13 at 22:42
  • Yup, I've not tested on a debian distro but on caja (Fedora) I have that the following script: #!/bin/sh md5sum "$@" | xargs -0 matedialog --info --title "md5sum" --text matedialog it's like zenity, gdialog, etc, you have the same feature in Nautilus take a look at forums.gentoo.org/viewtopic-t-960962-start-0.html – sebelk Oct 11 '13 at 0:02
  • would you give me more details? if i were to add sudo dpkg -i *.deb to the scripts you presented, where should i put it? all this is rather obscure to me, although it seems too simple to you :) . also: on the link you provided: it is about gnome 2 vs gnome 3. i am in elementaryOS myself. what i want is to apply a given script (to install deb) just to the selected files, if possible – user32012 Oct 11 '13 at 11:15
0

The solution that works in PCManFM and therefore should work in Nautilus is something like this: create a folder ~/.local/share/file-manager/actions, then create a file there. In terminal:

gedit ~/.local/share/file-manager/actions/install_deb.desktop

With this content:

[Desktop Entry]
Type=Action
Name[en]=Install deb files
Profiles=profile-zero;
Icon=gdebi
TargetLocation=true
MimeTypes=application/vnd.debian.binary-package;
Exec=gnome-terminal -e 'sudo dpkg -i "%f"'

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy