You are not logged in.

#1 2013-11-19 16:50:57

artoo
Member
Registered: 2012-09-04
Posts: 175
Website

[solved]Question concerning 'inline' bash in .desktop file

Hi,

I have done a little kde-service menu for repo-add and repo-remove.
So far so good, adding a package to a repo works from .desktop file without using a script.

However, removing a package is bit more tricky, since repo-remove requires just the pkgname, without version, rel and arch.

I can do it with a helper script, like this snippet:

_path=$1
_param=$2
_type=$3
_workdir=$(dirname $_path)
_fn=$(basename $_path .pkg.tar.xz)
_reponame=$(basename $_workdir)
_rn=${_fn%%-[0-9]*}
_cmd="repo-remove $_param $_reponame.$_type.tar.xz ${_rn}"

_run(){
  konsole --noclose --workdir "${_workdir}" -e $SHELL -c "${_cmd}"
}

_run

Is it possible to put the trimming of the string into a single Exec line in the desktop file?

Exec=konsole --noclose --workdir "$(dirname "%u")" -e $SHELL -c "repo-remove $(basename $(dirname "%u")).db.tar.xz "$(basename "%u" .pkg.tar.xz)""

If so, how? What is the syntax to use here to add

%%-[0-9]*

to the exec line?

Last edited by artoo (2013-11-20 15:21:21)

Offline

#2 2013-11-20 13:13:42

artoo
Member
Registered: 2012-09-04
Posts: 175
Website

Re: [solved]Question concerning 'inline' bash in .desktop file

Never mind, I ended up using a script to make multi selection possible.

https://aur.archlinux.org/packages/kde- … ement-git/

Last edited by artoo (2013-11-20 13:14:09)

Offline

#3 2013-11-20 15:15:09

2ManyDogs
Forum Fellow
Registered: 2012-01-15
Posts: 4,646

Re: [solved]Question concerning 'inline' bash in .desktop file

Please either mark this [solved] or report it to a moderator if you'd like it deleted.

Offline

Board footer

Powered by FluxBB