Author Topic: bash-me-up (Bash Startup Files Setup Made Easy)  (Read 2660 times)

hakerdefo

  • Posts: 484
    • View Profile
    • Looking at Linux through the Windows of Life
bash-me-up (Bash Startup Files Setup Made Easy)
« on: January 07, 2017, 07:15:15 PM »
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

  • Posts: 462
    • View Profile
Re: bash-me-up (Bash Startup Files Setup Made Easy)
« Reply #1 on: January 08, 2017, 05:53:34 AM »
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

  • Posts: 484
    • View Profile
    • Looking at Linux through the Windows of Life
Re: bash-me-up (Bash Startup Files Setup Made Easy)
« Reply #2 on: January 08, 2017, 11:02:04 PM »

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,

Code: [Select]
chmod 755 install-bashmeup

And run it with sudo,

Code: [Select]
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

  • Posts: 462
    • View Profile
Re: bash-me-up (Bash Startup Files Setup Made Easy)
« Reply #3 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.

Will report back. Thanks hackerdefo.

hakerdefo

  • Posts: 484
    • View Profile
    • Looking at Linux through the Windows of Life
Re: bash-me-up (Bash Startup Files Setup Made Easy)
« Reply #4 on: January 09, 2017, 08:21:54 AM »
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

  • Posts: 1795
    • View Profile
Re: bash-me-up (Bash Startup Files Setup Made Easy)
« Reply #5 on: January 09, 2017, 01:01:58 PM »
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

  • Posts: 484
    • View Profile
    • Looking at Linux through the Windows of Life
Re: bash-me-up (Bash Startup Files Setup Made Easy)
« Reply #6 on: January 09, 2017, 03:44:09 PM »
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

  • Posts: 1795
    • View Profile
Re: bash-me-up (Bash Startup Files Setup Made Easy)
« Reply #7 on: January 09, 2017, 04:07:22 PM »
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

  • Posts: 1795
    • View Profile
Re: bash-me-up (Bash Startup Files Setup Made Easy)
« Reply #8 on: January 10, 2017, 03:30:56 AM »
@hakerdefo -

the included xsessionrc has two lines:

Code: [Select]
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 -

Code: [Select]
/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

  • Posts: 484
    • View Profile
    • Looking at Linux through the Windows of Life
Re: bash-me-up (Bash Startup Files Setup Made Easy)
« Reply #9 on: January 10, 2017, 06:16:04 AM »
Hi PackRat,
Can you try a little experiment please?
Place following in your Void xsession file,

Code: [Select]
bin/bash -login /etc/X11/Xsession %session
And comment out the following,

Code: [Select]
/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

  • Posts: 484
    • View Profile
    • Looking at Linux through the Windows of Life
Re: bash-me-up (Bash Startup Files Setup Made Easy)
« Reply #10 on: January 10, 2017, 09:15:13 AM »
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

  • Posts: 1795
    • View Profile
Re: bash-me-up (Bash Startup Files Setup Made Easy)
« Reply #11 on: January 10, 2017, 01:29:13 PM »
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

  • Posts: 1795
    • View Profile
Re: bash-me-up (Bash Startup Files Setup Made Easy)
« Reply #12 on: January 10, 2017, 01:30:18 PM »
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

  • Posts: 484
    • View Profile
    • Looking at Linux through the Windows of Life
Re: bash-me-up (Bash Startup Files Setup Made Easy)
« Reply #13 on: January 11, 2017, 11:34:47 AM »
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.

Code: [Select]
-f ~/.LESS_TERMCAP ]] && . ~/.LESS_TERMCAP
And you'll also need,

Code: [Select]
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

  • Posts: 1795
    • View Profile
Re: bash-me-up (Bash Startup Files Setup Made Easy)
« Reply #14 on: January 11, 2017, 02:05:10 PM »
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

Code: [Select]
/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