colorgcc – Color your compiler output on Fedora

Lets start with installing colorgcc :

sudo yum install colorgcc

Now once that is done, you will need to ensure that the call to g++, gcc and others that you want to use, you will need to create a link in the “~/bin” directory, like so:

for i in g++ gcc c++ cc 
    ln -s $(which colorgcc) ~/bin/$i

The one liner above will create the links for colorgcc as your favourite compiler in your homedir. Don’t forget to add the bin diretory to your PATH variable:

export PATH=~/bin:$PATH

And now finally the ~/.colorgccrc file taken from Ubuntu for your reference:

# colorgcc configuration file
# $Id: colorgccrc,v 1999/04/25 15:24:03 jamoyers Exp $
# This file should be named $HOME/.colorgccrc
# The following groups of attributes may be combined for a given color:
# clear         black      on_black
# reset            red        on_red
# bold            green      on_green
# underline     yellow     on_yellow
# underscore    blue       on_blue
# blink            magenta    on_magenta
# reverse       cyan       on_cyan
# concealed     white      on_white
# For example, srcColor: bold cyan on_yellow

# gccVersion: if defined, append "-" to the compiler paths
# defined hereunder. Otherwise, those paths remains as is set
# gccVersion: 4.1.1

# Define the paths to the actual location of the various compilers.
# (Currently, colorgcc only understands these: g++ gcc c++ cc g77 f77 gcj)
g++: /usr/bin/g++
gcc: /usr/bin/gcc
c++: /usr/bin/g++
cc:  /usr/bin/gcc
#g77: /usr/bin/g77
#f77: /usr/bin/g77
#gcj: /usr/bin/gcj

# Don't do color if our terminal type ($TERM) is one of these.
# (List all terminal types on one line, seperated by whitespace.)
nocolor: dumb emacs

# Text between ` and ' is usually source code.
srcColor: bold cyan

# Text other than a warning or error.
introColor: reset

# Warnings and errors both have similar formats:
#    filename:999:Message
# Each field may be assigned a different color.

# Warnings
warningFileNameColor: reset
warningNumberColor:   blue
warningMessageColor:  yellow

# Errors
errorFileNameColor: reset
errorNumberColor:   blue
errorMessageColor:  bold red

# Possible translations, if you use localized compiler.
# (List all translations on one line, seperated by whitespace.)
Enhanced by Zemanta

Creating a chroot environment – the script.

Table of contents for chroot

  1. Creating a chroot environment in Fedora with bash and other utils.
  2. Creating a chroot environment – the script.

Here is the script, very simple and effective 🙂

#!/bin/bash -
#          FILE:
#         USAGE:  ./
#   DESCRIPTION:  Make a  chroot environ and cd to it
#       OPTIONS:  ---
#          BUGS:  ---
#         NOTES:  ---
#        AUTHOR: Amit Agarwal (aka), 
#       CREATED: 09/03/2011 02:53:37 PM IST
# Last modified: Sat Sep 03, 2011  03:11PM
#      REVISION:  ---

 binaries=( bash2 ls cat vi vim sudo)
#===  FUNCTION  ================================================================
#          NAME:  copy_binary
#   DESCRIPTION:  copy binary to chroot
#       RETURNS:

copy_binary ()
   cmd=`which $1`
   echo $cmd
   cp $cmd bin/
   ldd $cmd
   while read line
      while read ld
         if [[ -f $ld ]]
            echo copy $ld
            cp $ld lib/
            if [[ -L $ld ]]
               ld1=$( ls -l $ld |sed 's/.*> //')
               echo "  copy $ld1"
               cp  /lib/$ld1 lib/
      done < <(echo $line|sed 's/.*> //'|sed 's/ .*//')
   done < <(ldd $cmd)
}	# ----------  end of function copy_binary  ----------

#===  FUNCTION  ================================================================
#          NAME:  init
#   DESCRIPTION:  Do the required initialization
#       RETURNS:
   mkdir -p {root,home,dev,etc,lib,usr,bin}
   mkdir -p usr/bin
   mkdir -p libexec/openssh

   mknod -m 666 dev/null c 1 3

   cd etc
   cp /etc/ .
   cp -avr /etc/ .
   cp -avr /etc/ .
   cp /etc/ .
   cp /etc/nsswitch.conf .
   cp /etc/passwd .
   cp /etc/group .
   cp /etc/hosts .
   cp /etc/resolv.conf .
   cd -
cd $1
if [[ -f .status ]]
   cat .status
   echo "Not running now"
   for i in ${binaries[*]}
       copy_binary $i
       cp -avr /etc/${i}* etc/
   ln bin/bash2 bin/bash
   echo "complete" > .status
cp -avr ~/bin/automation root/automation
sudo chroot .


Enhanced by Zemanta

Installing Full Blin g theme on N900

I was going through the post :
and found the theme quite intruging but not complete to the point where I can download the deb file and install it in /usr/share/theme/ dir with simple commands “apt-get” or at max just use mkdir command to create the dir and dump everything in that dir. So, I wrote this couple of bash one liners to copy the required files to my N900.

for i in place*; do mv "$i" ${i//place these files in /}; done
for i in Place*; do mv "$i" ${i//Place these files in /}; done
for i in usr*; do j=${i//\./\/}; echo $i $j; done
for i in usr*; do j=${i//\./\/}; echo $i $j; mkdir Bkup_$i; scp -r [email protected]:/$j/* Bkup_$i/ ;done
for i in usr*; do j=${i//\./\/};scp -r $i/* [email protected]:/$j/  ;echo "Done with $i"; done
Enhanced by Zemanta