SEARCH

Enter your search query in the box above ^, or use the forum search tool.

You are not logged in.

#1 2012-05-07 19:51:40

rhowaldt
#!*$%:)
Registered: 2011-03-09
Posts: 4,396

how to: give fancy colors to your boot

giving fancy colors to your boot is real easy. you just buy a bucket of paint in a color you like, could be multiple, and splash them onto your boots. you could be wearing them too, but you'd risk getting your socks and pantlegs colored too. it is okay, if you're into that sorta thing.

so, what i really mean is giving colors to the bootup of your machine. you know that boring white-on-black text scrolling by? you can prettify it! here's how.

open up a terminal, and type this:

sudo touch /etc/lsb-base-logging.sh

now, edit that file, using sudo, with your favorite editor (mine is Gedit, so here we go):

sudo gedit /etc/lsb-base-logging.sh

paste in the following code:

# Colour our init scripts output

# int log_end_message (int exitstatus)
log_end_msg () {
    # If no arguments were passed, return
    if [ -z "${1:-}" ]; then
        return 1
    fi

    retval=$1

    log_end_msg_pre "$@"

    # Only do the fancy stuff if we have an appropriate terminal
    # and if /usr is already mounted
    if log_use_fancy_output; then
        RED=`$TPUT setaf 1`
        GREEN=`$TPUT setaf 2`
        YELLOW=`$TPUT setaf 3`
        NORMAL=`$TPUT sgr0`
        $TPUT hpa $((`$TPUT cols` - 12))
    else
        RED=''
        GREEN=''
        YELLOW=''
        NORMAL=''
    fi

    if [ $1 -eq 0 ]; then
        /bin/echo -e " [   ${GREEN}OK${NORMAL}   ]"
    elif [ $1 -eq 255 ]; then
        /bin/echo -e " [${YELLOW}WARNING!${NORMAL}]"
    else
        /bin/echo -e " [ ${RED}FAILED${NORMAL} ]"
    fi
    log_end_msg_post "$@"
    return $retval
}

log_action_end_msg () {
    log_action_end_msg_pre "$@"
    if [ -z "${2:-}" ]; then
        end=""
    else
        end=" ($2)"
    fi

    /bin/echo -n "${end}"

    # Only do the fancy stuff if we have an appropriate terminal
    # and if /usr is already mounted
    if log_use_fancy_output; then
        RED=`$TPUT setaf 1`
        BLUE=`$TPUT setaf 4`
        NORMAL=`$TPUT sgr0`
        $TPUT hpa $((`$TPUT cols` - 12))
    else
        RED=''
        BLUE=''
        NORMAL=''
    fi


    if [ $1 -eq 0 ]; then
        /bin/echo -e " [  ${BLUE}DONE${NORMAL}  ]"
    else
        /bin/echo -e " [ ${RED}FAILED${NORMAL} ]"
    fi
    log_action_end_msg_post "$@"
}

(i got this code from over here: http://www.earth.li/~noodles/blog/2010/ … utput.html)
save & close.
now, make it executable:

sudo chmod +x /etc/lsb-base-logging.sh

reboot, and be blown away by fancy colors!

of course, you want to customize the colors. the script uses tput setaf-stuff, which you might not understand. i know i didn't. that's why we have Google.
first of all, check out this list of possibilities:

Black="$(tput setaf 0)"
BlackBG="$(tput setab 0)"
DarkGrey="$(tput bold ; tput setaf 0)"
LightGrey="$(tput setaf 7)"
LightGreyBG="$(tput setab 7)"
White="$(tput bold ; tput setaf 7)"
Red="$(tput setaf 1)"
RedBG="$(tput setab 1)"
LightRed="$(tput bold ; tput setaf 1)"
Green="$(tput setaf 2)"
GreenBG="$(tput setab 2)"
LightGreen="$(tput bold ; tput setaf 2)"
Brown="$(tput setaf 3)"
BrownBG="$(tput setab 3)"
Yellow="$(tput bold ; tput setaf 3)"
Blue="$(tput setaf 4)"
BlueBG="$(tput setab 4)"
LightBlue="$(tput bold ; tput setaf 4)"
Purple="$(tput setaf 5)"
PurpleBG="$(tput setab 5)"
Pink="$(tput bold ; tput setaf 5)"
Cyan="$(tput setaf 6)"
CyanBG="$(tput setab 6)"
LightCyan="$(tput bold ; tput setaf 6)"
NC="$(tput sgr0)" # No Color

now you want to try out what they do, and you do that like so:

echo $(tput bold ; tput setaf 2)bla$(tput sgr 0)

(which will give you a green 'bla')

i haven't tried editing the colors inside the script yet. so don't kick my ass if something doesn't work or whatever. also, use all of this at your own responsibility. i don't know if you can mess things up, but this is your boot you're dealing with so i'd be a bit careful (however, i wasn't, just plumped that stuff in and rebooted... no worries).

EDIT: just tried customizing the colors. here's what to do. add a BOLD variable to the script.
note there are 2 functions inside the script:

log_end_msg () {
[..]
log_action_end_msg () {

both have their own color-variables declared. so add BOLD to both like so:

BOLD=`$TPUT bold`

(i added it before the NORMAL in both functions, because that seemed to make sense to me... however, that doesn't mean anything, really)

ok, then, you want to just add ${BOLD} somewhere. i especially hated the bright blue and bright green, so here's what i made:

log_end_msg () {
[..]
/bin/echo -e " [   ${BOLD}${GREEN}OK${NORMAL}   ]"
[..]
log_action_end_msg () {
[..]
/bin/echo -e " [  ${BOLD}${BLUE}DONE${NORMAL}  ]"

now reboot... et voila! much, much better!

Offline

Be excellent to each other!

#2 2012-05-07 19:57:20

ivanovnegro
Ivan #000000
From: unstable madness
Registered: 2011-06-02
Posts: 5,423

Re: how to: give fancy colors to your boot

Man, you are just totally crazy!!! big_smile

Now let us make some shots.

Offline

#3 2012-05-07 20:10:05

SabreWolfy
#! Die Hard
Registered: 2009-03-09
Posts: 1,285

Re: how to: give fancy colors to your boot

This is Waldorf+ only?


Support #!Waldorf • Debian sid • Xubuntu • siduction • Peppermint • OpenBox • Xfce • LXDE •

Offline

#4 2012-05-07 20:12:24

ivanovnegro
Ivan #000000
From: unstable madness
Registered: 2011-06-02
Posts: 5,423

Re: how to: give fancy colors to your boot

^ No it is not, therefore the how-to but it is default function under Wheezy.

Offline

#5 2012-05-07 20:12:33

rhowaldt
#!*$%:)
Registered: 2011-03-09
Posts: 4,396

Re: how to: give fancy colors to your boot

^ nope, i am still using the February 2011 release. however, i do not know about the kernel version. i'm running 3.2.9-rt14 right now. and this is not really my turf, so hopefully somebody will chime in...

btw, added stuff about customizing the colors to the first post.

@ivanov: thanks man big_smile

Offline

#6 2012-05-07 20:30:00

SabreWolfy
#! Die Hard
Registered: 2009-03-09
Posts: 1,285

Re: how to: give fancy colors to your boot

sRdxLl.jpg

TfFXt.jpg

(Don't know why images are so large; last time I used it I got smaller thumbnails)


Support #!Waldorf • Debian sid • Xubuntu • siduction • Peppermint • OpenBox • Xfce • LXDE •

Offline

#7 2012-05-07 20:46:12

rhowaldt
#!*$%:)
Registered: 2011-03-09
Posts: 4,396

Re: how to: give fancy colors to your boot

^ nice! thanks Sabrewolfy!

i'm still considering changing the text too. i think it is a bit wide all-in-all. might replace 'WARNING!' with something else, like simply '!' or '!!' or maybe '!!!' although that sounds more like something is pretty wrong. dunno. it is just that that single word is making the whole list of boot-messages wide, so that's why i want to trim it. maybe just make it 'BOO!'. yeah, that's actually a great idea. doing that now.

Offline

#8 2012-05-07 21:08:22

rhowaldt
#!*$%:)
Registered: 2011-03-09
Posts: 4,396

Re: how to: give fancy colors to your boot

here's some different texts/etc:

# 'American' smileys:
OK: :D
DONE: :)
WARNING: :O
FAILED: D:

# Japanese smileys:
OK: (^_^)
DONE: (^_^)
WARNING: (O_O)
FAILED: (+_+)

# rhowaldt's texts:
OK: [ OK ]
DONE: [DONE]
WARNING: [BOO!]
FAILED: [FAIL]

so, as you can see, you can get pretty creative here! and still haven't broken my boot! woohoo!

Offline

#9 2012-05-07 21:25:10

ivanovnegro
Ivan #000000
From: unstable madness
Registered: 2011-06-02
Posts: 5,423

Re: how to: give fancy colors to your boot

rhowaldt wrote:

so, as you can see, you can get pretty creative here! and still haven't broken my boot! woohoo!

OMG! lol

Offline

#10 2012-05-07 21:27:23

machinebacon
#! unstable
From: China
Registered: 2009-07-02
Posts: 6,620
Website

Re: how to: give fancy colors to your boot

One of the most important howto's ever big_smile Anyway thanks for your work smile

Offline

#11 2012-05-07 22:56:53

saneks
#! Die Hard
Registered: 2009-10-01
Posts: 999

Re: how to: give fancy colors to your boot

(O_O) wow, this is the best thing ever on computers.


eee701 user & other lap/desktops

Offline

#12 2012-05-08 07:19:10

Milozzy
#! Die Hard
Registered: 2011-02-22
Posts: 622
Website

Re: how to: give fancy colors to your boot

Crazy!!! Great how-to rhowaldt!!

Offline

#13 2012-05-08 07:40:17

rhowaldt
#!*$%:)
Registered: 2011-03-09
Posts: 4,396

Re: how to: give fancy colors to your boot

thanks guys, you're making me feel even more proud than i already am. this is really an accomplishment for me. the results are great, bordering on revolutionary. and it isn't even my own idea! i'm just the (strange) messenger smile

Offline

#14 2012-05-08 14:25:51

thevdude
#! Junkie
From: Pittsburgh, PA
Registered: 2011-09-01
Posts: 469

Re: how to: give fancy colors to your boot

I don't boot my computer often enough to worry about this, LOL.

Offline

#15 2012-05-08 14:35:07

SabreWolfy
#! Die Hard
Registered: 2009-03-09
Posts: 1,285

Re: how to: give fancy colors to your boot

^ Which means it will be all the sweeter when you do though!


Support #!Waldorf • Debian sid • Xubuntu • siduction • Peppermint • OpenBox • Xfce • LXDE •

Offline

#16 2012-05-08 14:38:11

rhowaldt
#!*$%:)
Registered: 2011-03-09
Posts: 4,396

Re: how to: give fancy colors to your boot

^ indeed! you'll be in for a surprise!

Offline

#17 2012-05-25 09:45:19

barkbombardier
#! Member
Registered: 2011-09-07
Posts: 77

Re: how to: give fancy colors to your boot

Hello all, I followed the how-to and when I rebooted I got the colors but it told me that HAL and something else that I can't remember failed. No keyboard or mouse had to hit the power button to reboot into recovery and delete "lsb-base-logging.sh" from command line. Any reason or remedy? For a little info, I don't use a DM. thanks!

Offline

#18 2012-05-25 09:59:16

rhowaldt
#!*$%:)
Registered: 2011-03-09
Posts: 4,396

Re: how to: give fancy colors to your boot

hi barkbombardier. i don't have a clue myself. like i said before, i did this, then crossed me fingers and figured 'who cares' and went for it, and nothing strange happened. sorry!

Offline

#19 2012-05-25 10:03:57

machinebacon
#! unstable
From: China
Registered: 2009-07-02
Posts: 6,620
Website

Re: how to: give fancy colors to your boot

barkbombardier, you can check you /var/log/boot and the dmesg for info about what happened during boot.

Offline

#20 2012-05-25 19:40:53

barkbombardier
#! Member
Registered: 2011-09-07
Posts: 77

Re: how to: give fancy colors to your boot

Ok ok now I don't know what I did or did not do the first time,but all is well this time!:rolleyes:
"GNU...you feel like a genius on minute and a idiot the next." And I love every minute of it!:lol:
Thanks guys.

Offline

#21 2012-05-26 09:08:39

rhowaldt
#!*$%:)
Registered: 2011-03-09
Posts: 4,396

Re: how to: give fancy colors to your boot

^ glad it worked out! you went to trouble and fear, and you now have a very fancy boot. it was so worth it! big_smile

Offline

#22 2012-05-26 13:31:54

ForkTong
#! Member
Registered: 2012-04-19
Posts: 63

Re: how to: give fancy colors to your boot

I showed this off to my only Linux-minded colleague at work and he fainted. The other stuff that's actually useful and boosts productivity and usability, he didn't care for... big_smile

Offline

#23 2012-05-26 14:03:09

orionthehunter
#! Constellation
From: Japan
Registered: 2011-04-09
Posts: 900
Website

Re: how to: give fancy colors to your boot

I think I could convert people to Linux with this.

The Japanese smileys that is.

Last edited by orionthehunter (2012-05-26 14:03:42)

Offline

#24 2012-05-26 14:21:58

machinebacon
#! unstable
From: China
Registered: 2009-07-02
Posts: 6,620
Website

Re: how to: give fancy colors to your boot

=^~..~^=// As long as it is colourful and it blinks, Asians are crazy for it big_smile

Offline

Help fund CrunchBang, donate to the project!

#25 2012-05-26 16:00:13

rhowaldt
#!*$%:)
Registered: 2011-03-09
Posts: 4,396

Re: how to: give fancy colors to your boot

yeah, you can use whatever icons or smileys you like. all you have to look at for aesthetics is that the square brackets are evenly spaced. also, dunno if you can influence the font used at boot, because i find the font my boot has is not the most beautiful for showing any type of smiley...

Offline

Board footer

Powered by FluxBB

Copyright © 2012 CrunchBang Linux.
Proudly powered by Debian. Hosted by Linode.
Debian is a registered trademark of Software in the Public Interest, Inc.

Debian Logo