bash-me-up (Bash Startup Files Setup Made Easy)

hakerdefo

The Bash shell uses a collection of startup files to create an environment. The already difficult task of setting up these files correctly is made painful by lack of clear documentation and different behavior of display managers and/or desktop environments. I'm planning on creating a script that should make this task easy. Something to kill time on Sunday  ;)
Stay Tuned  ;)

Cheers!!!
You Can't Always Git What You Want

Snap

A bash shell configuration tool? I'm really curious about this one. I guess you'll cover the essentials, otherwise it might end up as a very complex script.

hakerdefo

#2


Updated V2 of bash-me-up can be found here,

http://vsido.org/index.php?topic=1252.msg14262#msg14262

Use V2 instead of the following version please.



As promised. Here is bash-me-up at your service  8)

Download the attached bashmeup.tar.gz and install-bashmeup files. Put them in a same directory. Open terminal in that directory and give the 'install-bashmeup' file the execute permissions,


chmod 755 install-bashmeup


And run it with sudo,


sudo ./install-bashmeup


Once the installation completes, log-out and then log-back-in.

Absolutely RAW!!! Use it at your own risk!!! You have been warned  ;)

Cheers!!!
You Can't Always Git What You Want

Snap

That's something to test in a clean virtual machine or a cloned one, I don't wanna mess my systems, LOL.

Will report back. Thanks hackerdefo.

hakerdefo

bash-me-up will backup your files with a '.bup' extension. But yeah, you are right, best thing to do is try this in a non-production environment, observe what it does and if you find it good enough, use it elsewhere.
It should make the task of setting-up bash shell with sensible defaults easy, in theory that is ;)
Looking forward to the feedback :)

Cheers!!!
You Can't Always Git What You Want

PackRat

Quote from: Snap on January 09, 2017, 05:45:31 AM
That's something to test in a clean virtual machine or a cloned one, I don't wanna mess my systems, LOL.

This was my first thought too. User will definitely want to research how their particular distro sets up the bash environment. I'm sure this works with Debian; there are some Void specifics that these scripts may break.

I looked through the individual files and used a couple line items. Definitely some sane defaults.

Timely too. I have to sit and wait in the car line to pick up my youngest after school. Been reading up on bash the last week or so. Seeing how these scripts are constructed has been an interesting exercise to say the least.

Another job well done hakerdefo.
I am tired of talk that comes to nothing.
-- Chief Joseph

...the sun, the darkness, the winds are all listening to what we have to say.
-- Geronimo

hakerdefo

#6
Hi there PackRat,
I've tried to make bash-me-up distro-agnostic. It only depends on bash and sudo. The install script is designed to use sudo, so it won't work if you run it directly as root. It will be great if you can test this in Void and/or some other non debian/ubuntu distro. Would love to get your feedback.

Cheers!!!
You Can't Always Git What You Want

PackRat

I may give it a shot later (tomorrow?).

On Void, the system bashrc is in /etc/bash/ and user files in /etc/bash/bashrc.d/ , I also have an /etc/profile.d/ with some system scripts.

After a quick read of your scripts, I should get a bash environment no problem, but lose some of the under the hood Void setup.

I like that bash_logout script. That immediately became ~/.bash_logout and works just fine  ;D
I am tired of talk that comes to nothing.
-- Chief Joseph

...the sun, the darkness, the winds are all listening to what we have to say.
-- Geronimo

PackRat

#8
@hakerdefo -

the included xsessionrc has two lines:

test -f /etc/profile && . /etc/profile
test -f $HOME/.profile && . $HOME/.profile


It doesn't start a window manager. I'm pretty sure that the "Default" option in the lightdm and lxdm menu reads this file, so if no Wm/DE is specified, the login will fail.

For example, the default xsession file for Void is one line -

/bin/bash --login -i ~/.xinitrc

so it reverts back to the user's .xinitrc which starts a WM/DE.
I am tired of talk that comes to nothing.
-- Chief Joseph

...the sun, the darkness, the winds are all listening to what we have to say.
-- Geronimo

hakerdefo

Hi PackRat,
Can you try a little experiment please?
Place following in your Void xsession file,

bin/bash -login /etc/X11/Xsession %session

And comment out the following,

/bin/bash --login -i ~/.xinitrc

Log-out of session and try log-in again.

Does the WM start?

Cheers!!!
You Can't Always Git What You Want

hakerdefo

Ignore my previous post  ;)
I tested my theory and it won't work!
Thanks for sharing this! This will be added to V2 of bash-me-up for sure
Please provide any other suggestion-feedback on making this thing distro-agnostic PackRat.

Cheers!!!
You Can't Always Git What You Want

PackRat

That's the only (obvious) thing I spotted going through the scripts to determine what's actually getting installed and where. It's more of a login agnostic feature. The way I understand it, if a user boots to a command line and uses "startx" when they want to start an X-session, the $HOME/.xinitrc is read and the window manager of choice is started. If a newer login manager like lightdm or lxdm (gdm, kdm?) is used, the $HOME/.xsessionrc is read and the window manager started along with the other features of the login manager. By calling the $HOME/.xinitrc in $HOME/.xsessionrc a user only needs the one file and is consistent when starting an X-session. Use to be a distro would create a symlink to accomplish that, but that appears to have fallen by the wayside.
I am tired of talk that comes to nothing.
-- Chief Joseph

...the sun, the darkness, the winds are all listening to what we have to say.
-- Geronimo

PackRat

That LESS_TERMCAP file is interesting. What's that provide for the user? Never seen it before.
I am tired of talk that comes to nothing.
-- Chief Joseph

...the sun, the darkness, the winds are all listening to what we have to say.
-- Geronimo

hakerdefo

That file adds a dash of color to the pager less and that in turns make 'man' pages colorful. You'll have to source the file from one of the bash start-up files.

-f ~/.LESS_TERMCAP ]] && . ~/.LESS_TERMCAP

And you'll also need,

export LESS="-RM"

In one of the bash settings file.

It for sure makes reading man pages much easy.

Cheers!!!
You Can't Always Git What You Want

PackRat

#14
Two errors if I su to root in a terminal -  <--- My bad, I fogot that I changed the root shell to zsh. No errors after switching to back to bash

/etc/profile:export:28: invalid option(s)
pathremove:5: bad substitution


Need to set up some user specific stuff but other than that it appears to be working fine.

The install goes a bit too quick - maybe it's in the opening message, but some verbage about what files are getting installed would be nice.
I am tired of talk that comes to nothing.
-- Chief Joseph

...the sun, the darkness, the winds are all listening to what we have to say.
-- Geronimo