You are not logged in.
Hey guys. So I'm wondering about the ability to add executable commands or executable scripts to things like .conf files. For example, I'd like to edit my lightdm.conf file to play a small .wav file when the lightdm process is run or when I successfully log in. Or perhaps the /etc/motd conf file, when the motd is read, it could reference an executable shell script. Now I know for security purposes this is definitely a big No No. I run this all in a VM and have little on the system that I consider information that needs protecting. So security issues aside... Is there a what to add commands to scripts like .confs that are generally just read for parameters.
"I have not failed, I have found 10,000 ways that will not work" -Edison
Offline
Moved to Basic Help & Support. ( "Scripts Tutorials & Tips" is for sharing, not asking. )
...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), now on Bluesky, there's also some GitStuff )
Online
For lightdm, be sure to check out these options in lightdm.conf
#display-setup-script=
#display-stopped-script=
#greeter-setup-script=
session-setup-script=/usr/lib/bunsen/bunsen-configs/bl-user-setup
As you can see BL is using session-setup-script to copy its configs up into a $HOME directory when a new user is setup. If you needed that particular option, then it should be possible to build a wrapper script that included your own custom script PLUS the bl-user-setup script. Also consider the fact that ~/.config/openbox/autostart is actually a shell script. Simlarly with /etc/xdg/autostart, though in that case you would likely need to build desktop entries to execute your scripts in. Also, keep in mind that anything you can run from the command line can be considered an extension of your shell in a way. (This is truly one of the things that makes Linux so cool.) Meaning if you wanted to modify /etc/motd and display it, you could create a script that does it.
Offline
For an Openbox session login startup sound then just add the command to autostart
Be Excellent to Each Other...
The Bunsenlabs Lithium Desktop » Here
FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt «» BunsenLabs on DeviantArt
Offline
~/.config/openbox/autostart is actually a shell script.
To be pedantic, it's a code fragment which is sourced by another shell script. That's why it doesn't need a #!/bin/sh at the top. Also, it's being run by sh not bash so you can't use bash-specific code.
anything you can run from the command line can be considered an extension of your shell in a way. (This is truly one of the things that makes Linux so cool.)
Yes!
EDIT: removed incorrect statement.
Last edited by johnraff (2015-12-25 06:46:34)
...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), now on Bluesky, there's also some GitStuff )
Online
^ Good to know. Thanks for the clarification, especially about it running sh instead of bash. That could have ended up frustrating some day
Offline
Thanks to all who responded! Yea editing the autostart script I suppose is the most obvious choice then for specifically doing what I need. and Twoion's explanation is a great more deeper level reasoning.
So I suppose my next question in my never ending list, is why do we need a Window Manager for an autostart script? What i mean is, the .config/openbox/autostart script isn't run if openbox isn't installed. Why is there no 'autostart' like script if you're not running X or a windows manager? I mean there is the .bashrc and or .profile scripts. But I don't think you can add actual commands to them as you can in the autostart script.
So why does having the functions of autostart only seem to come with using a WindowManager like xdg or openbox?
"I have not failed, I have found 10,000 ways that will not work" -Edison
Offline
Why is there no 'autostart' like script if you're not running X or a windows manager?
Read startx(1)
In Debian jessie, ~/.xsession is used.
EDIT: Openbox uses the autostart file as a convenience for people running a so-called default xsession without a file at ~/.xsession
Last edited by Head_on_a_Stick (2015-12-24 17:55:12)
Offline
ps:
autostart only gets executed if you use "openbox-session".
i have "exec openbox" at the end of my ~/.xinitrc, and have to put everything i want autostarted into ~/.xinitrc.
i like it that way (openbox-session also does a few more "useless" things, like executing xdg/autostart stuff and setting the background to a uniform grey).
Offline
heh, from the startx man page...and from Johnraff's post here:
the startx utility seems pretty useless, as either xsession is called by the xinitrc or if you specify another script like autostart...
"I have not failed, I have found 10,000 ways that will not work" -Edison
Offline
the startx utility seems pretty useless, as either xsession is called by the xinitrc
In Debian jessie systems, the `startx` command will either start whichever window manager or desktop environment is symlinked to /etc/alternatives/x-session-manager or it will run whichever programs are specified in ~/.xsession (or ~/.xinitrc if this is sourced from ~/.xsession) if such a file is present.
If a display manager is not used then either the `startx` or `xinit` commands must be used to initialise the X server.
Note that if the `xinit` command is used, further arguments must be passed, for example:
xinit -- :1 -nolisten tcp vt$XDG_VTNR
Offline
startx does a lot more than just start the x server and a window manager. It adds any environment variables, services, daemons etc from script fragments that installed packages might have put in /etc/X11/Xsession.d ( dbus, ssh, ... even BunsenLabs puts something there! ) That stuff is also run when starting via LightDm.
Try this for an idea of it:
for i in /etc/X11/Xsession.d/*;do echo "$i":;cat "$i";echo ------;done | less
PS Horizon_Brave has already found my dissertation on startx from 3 years ago. A longish read.
Last edited by johnraff (2015-12-25 06:07:57)
...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), now on Bluesky, there's also some GitStuff )
Online
About openbox/autostart, I was wrong:
it's a code fragment which is sourced by another shell script.
It may have been true in the past, but now it's run by 'sh /path/to/autostart'. See /usr/lib/[i386|amd64]-linux-gnu/openbox-autostart
...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), now on Bluesky, there's also some GitStuff )
Online