Run a "gettexted" program from udev *.rules file?

For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
Post Reply
Message
Author
User avatar
Argolance
Posts: 3767
Joined: Sun 06 Jan 2008, 22:57
Location: PORT-BRILLET (Mayenne - France)
Contact:

Run a "gettexted" program from udev *.rules file?

#1 Post by Argolance »

Bonjour,
This is the content of the /etc/udev/80-hds.rules file:

Code: Select all

SUBSYSTEM=="usb", ACTION=="add", ENV{DEVTYPE}=="usb_device", RUN+="/usr/bin/add.sh" 
This is the content of the /usr/bin/add.sh file:

Code: Select all

#!/bin/sh
set -x
export DISPLAY=:0.0
su root -c "/usr/bin/my-program" &
"my-program" is executed as soon as an usb device is plugged in, but, unfortunately, the language (gettext) and configuration variables (from config file) are not taken into account.
When executed from the terminal or while clicking on, add.sh works normally.
Please, what is lacking?
Thanks.

Cordialement.
Last edited by Argolance on Fri 29 Mar 2019, 10:19, edited 1 time in total.

User avatar
rufwoof
Posts: 3690
Joined: Mon 24 Feb 2014, 17:47

#2 Post by rufwoof »

Maybe

Code: Select all

su - root -c "/usr/bin/my-program" &
???
[size=75]( ͡° ͜ʖ ͡°) :wq[/size]
[url=http://murga-linux.com/puppy/viewtopic.php?p=1028256#1028256][size=75]Fatdog multi-session usb[/url][/size]
[size=75][url=https://hashbang.sh]echo url|sed -e 's/^/(c/' -e 's/$/ hashbang.sh)/'|sh[/url][/size]

User avatar
Argolance
Posts: 3767
Joined: Sun 06 Jan 2008, 22:57
Location: PORT-BRILLET (Mayenne - France)
Contact:

#3 Post by Argolance »

Bonsoir,
@rufwoof
Thank you for trying to help.

The problem is half solved. By replacing $HOME with /root in the path of the configuration file, the variables are taken into account.
Now, only the strings of text internationalized using Gettext are not translated.

Cordialement.

Post Reply