You are not logged in.

#1 2021-01-06 17:38:59

ozooha
Member
Registered: 2009-09-29
Posts: 184

run kodi using a shell script instead of /usr/bin/kodi

I have this shell script from where I want to run kodi from instead of /usr/bin/kodi

#!/bin/bash
systemctl --user stop pulseaudio.socket

systemctl --user stop pulseaudio.service
KODI_AE_SINK=ALSA kodi
systemctl --user start pulseaudio.socket

systemctl --user start pulseaudio.service

So can I use symbolic link to change it?

sudo ln -s /usr/bin/kodi  /usr/local/kodi.sh


Also will it interfere with my lircrc command which runs kodi using this command

begin
    remote = mceusb
    button = KEY_HOME
    prog = irexec
    config = [[ ! $(pidof kodi-x11) ]] && /usr/bin/kodi &
end

Let me know your thoughts/feedbacks/suggestions etc.
Thanks for your time and patience.
OZooHA

Last edited by ozooha (2021-01-06 17:44:14)

Offline

#2 2021-01-06 17:48:12

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 25,352

Re: run kodi using a shell script instead of /usr/bin/kodi

With the script as posted you'd break the existing script and run an infinite loop of yourself.  I'd say make a /home/user/bin that you prepend in the path for "replacements" or copy/link the script into /usr/local/bin (/usr/local/bin usually prepends and takes priority over /usr/bin paths if the PATH variable is setup as such)  and use the full /usr/bin/kodi path inside your script

You can also keep general pulse state alive  while still getting the direct ALSA guarantees if you just use pasuspender,

KODI_AE_SINK=ALSA  pasuspender /usr/bin/kodi

(...and I personally would just use pulse anyway but I assume you have your reasons)

Last edited by V1del (2021-01-06 17:55:59)

Offline

#3 2021-01-06 19:54:51

ozooha
Member
Registered: 2009-09-29
Posts: 184

Re: run kodi using a shell script instead of /usr/bin/kodi

V1del wrote:

With the script as posted you'd break the existing script and run an infinite loop of yourself.  I'd say make a /home/user/bin that you prepend in the path for "replacements" or copy/link the script into /usr/local/bin (/usr/local/bin usually prepends and takes priority over /usr/bin paths if the PATH variable is setup as such)  and use the full /usr/bin/kodi path inside your script

You can also keep general pulse state alive  while still getting the direct ALSA guarantees if you just use pasuspender,

KODI_AE_SINK=ALSA  pasuspender /usr/bin/kodi

(...and I personally would just use pulse anyway but I assume you have your reasons)

I don't quite get what you meant here
copy/link the script into /usr/local/bin (/usr/local/bin usually prepends and takes priority over /usr/bin paths if the PATH variable is setup as such)  and use the full /usr/bin/kodi path inside your script

I have modified the script to use

KODI_AE_SINK=ALSA  pasuspender /usr/bin/kodi

but how do I change the lircrc part of the code to reflect that as in config?

Did you mean I need to do a symbolic link to ?

sudo ln -s /usr/bin/kodi  /usr/local/bin/kodi.sh

Thanks.
OZooHA

Offline

#4 2021-01-06 20:06:08

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 25,352

Re: run kodi using a shell script instead of /usr/bin/kodi

No stop with the idea of a symbolic link, /usr/bin/kodi is kodi's own setup script if you replace/change that to a symlink you will have broken the kodi startup (... in kodi's case not that big of an issue as the actual binaries are in /usr/lib/kodi-x11 etc)

Just place your script into /usr/local/bin/kodi and you can call kodi from your shell, but the original /usr/bin/kodi remains intact (... check your PATH with

echo $PATH

on default setups /usr/local/bin should preceed /usr/bin and thus have priority for PATH lookups.

Place it there, run

type -a kodi

you should see your own script come before the package provided /usr/bin/kodi without completely replacing it.

Offline

#5 2021-01-06 20:16:28

ozooha
Member
Registered: 2009-09-29
Posts: 184

Re: run kodi using a shell script instead of /usr/bin/kodi

V1del wrote:

No stop with the idea of a symbolic link, /usr/bin/kodi is kodi's own setup script if you replace/change that to a symlink you will have broken the kodi startup (... in kodi's case not that big of an issue as the actual binaries are in /usr/lib/kodi-x11 etc)

Just place your script into /usr/local/bin/kodi and you can call kodi from your shell, but the original /usr/bin/kodi remains intact (... check your PATH with

echo $PATH

on default setups /usr/local/bin should preceed /usr/bin and thus have priority for PATH lookups.

Place it there, run

type -a kodi

you should see your own script come before the package provided /usr/bin/kodi without completely replacing it.

/usr/local/bin should preceed /usr/bin and thus have priority for PATH lookups.
has precedence over /usr/bin/ from the PATH.

/usr/lib/ccache/bin/:/opt/miniconda3/condabin:/usr/local/bin:/usr/local/sbin:/usr/bin:

I have placed the script in /usr/local/bin/ as /usr/local/bin/kodi

however when I run type -a kodi
I get this and nothing happens

⚡ type -a kodi
kodi is /usr/local/bin/kodi
kodi is /usr/bin/kodi

What requires to be correct since i misunderstood you.
Thanks
OZooHA

Offline

#6 2021-01-06 20:29:43

ozooha
Member
Registered: 2009-09-29
Posts: 184

Re: run kodi using a shell script instead of /usr/bin/kodi

ok if i type kodi at the prompt it does evoke the /usr/local/bin/kodi
So yeah this works.
Thanks
OZooHA

Offline

Board footer

Powered by FluxBB