Tuesday, March 31, 2015

Installing django on fresh ubuntu


I have just installed a ubuntu (latest 64 bit avialable on ubuntu web site) over a freshly installed 'vmware palyer' (again downloaded latest from vmware website)... all comes in FREE as of now.

Installed Ubuntu ...
Now, next steps was to install django server, so I open the terminal and this is how I installed it...

I was following this link for it : https://www.howtoforge.com/tutorial/django-install-ubuntu-14.04/

===============

tapesh@ubuntu:~$
tapesh@ubuntu:~$
tapesh@ubuntu:~$ sqllite
No command 'sqllite' found, did you mean:
 Command 'sqlline' from package 'sqlline' (universe)
 Command 'sqlite' from package 'sqlite' (universe)
sqllite: command not found
tapesh@ubuntu:~$
tapesh@ubuntu:~$
tapesh@ubuntu:~$
tapesh@ubuntu:~$ sudo apt-get install sqlite
[sudo] password for tapesh:
Reading package lists... Done
Building dependency tree      
Reading state information... Done
The following extra packages will be installed:
  libsqlite0 sqlite3
Suggested packages:
  sqlite-doc sqlite3-doc
The following NEW packages will be installed:
  libsqlite0 sqlite sqlite3
0 upgraded, 3 newly installed, 0 to remove and 102 not upgraded.
Need to get 182 kB of archives.
After this operation, 754 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://us.archive.ubuntu.com/ubuntu/ trusty/universe libsqlite0 amd64 2.8.17-10ubuntu2 [139 kB]
Get:2 http://us.archive.ubuntu.com/ubuntu/ trusty/universe sqlite amd64 2.8.17-10ubuntu2 [14.4 kB]
Get:3 http://us.archive.ubuntu.com/ubuntu/ trusty/main sqlite3 amd64 3.8.2-1ubuntu2 [28.9 kB]
Fetched 182 kB in 2s (67.8 kB/s)
Selecting previously unselected package libsqlite0.
(Reading database ... 163905 files and directories currently installed.)
Preparing to unpack .../libsqlite0_2.8.17-10ubuntu2_amd64.deb ...
Unpacking libsqlite0 (2.8.17-10ubuntu2) ...
Selecting previously unselected package sqlite.
Preparing to unpack .../sqlite_2.8.17-10ubuntu2_amd64.deb ...
Unpacking sqlite (2.8.17-10ubuntu2) ...
Selecting previously unselected package sqlite3.
Preparing to unpack .../sqlite3_3.8.2-1ubuntu2_amd64.deb ...
Unpacking sqlite3 (3.8.2-1ubuntu2) ...
Processing triggers for man-db (2.6.7.1-1ubuntu1) ...
Setting up libsqlite0 (2.8.17-10ubuntu2) ...
Setting up sqlite (2.8.17-10ubuntu2) ...
Setting up sqlite3 (3.8.2-1ubuntu2) ...
Processing triggers for libc-bin (2.19-0ubuntu6.5) ...
tapesh@ubuntu:~$
tapesh@ubuntu:~$
tapesh@ubuntu:~$
tapesh@ubuntu:~$
tapesh@ubuntu:~$ sudo apt-get install python-setuptools
Reading package lists... Done
Building dependency tree      
Reading state information... Done
The following NEW packages will be installed:
  python-setuptools
0 upgraded, 1 newly installed, 0 to remove and 102 not upgraded.
Need to get 230 kB of archives.
After this operation, 830 kB of additional disk space will be used.
Get:1 http://us.archive.ubuntu.com/ubuntu/ trusty/main python-setuptools all 3.3-1ubuntu1 [230 kB]
Fetched 230 kB in 2s (79.3 kB/s)                      
Selecting previously unselected package python-setuptools.
(Reading database ... 163922 files and directories currently installed.)
Preparing to unpack .../python-setuptools_3.3-1ubuntu1_all.deb ...
Unpacking python-setuptools (3.3-1ubuntu1) ...
Setting up python-setuptools (3.3-1ubuntu1) ...
tapesh@ubuntu:~$
tapesh@ubuntu:~$
tapesh@ubuntu:~$
tapesh@ubuntu:~$ sqllite --version
No command 'sqllite' found, did you mean:
 Command 'sqlite' from package 'sqlite' (universe)
 Command 'sqlline' from package 'sqlline' (universe)
sqllite: command not found
tapesh@ubuntu:~$
tapesh@ubuntu:~$
tapesh@ubuntu:~$ sqllite -version
No command 'sqllite' found, did you mean:
 Command 'sqlline' from package 'sqlline' (universe)
 Command 'sqlite' from package 'sqlite' (universe)
sqllite: command not found
tapesh@ubuntu:~$ sqlite --version
sqlite: unknown option: --version
Use -help for a list of options.
tapesh@ubuntu:~$ sqlite -version
2.8.17
tapesh@ubuntu:~$
tapesh@ubuntu:~$
tapesh@ubuntu:~$ pip --version
The program 'pip' is currently not installed. You can install it by typing:
sudo apt-get install python-pip
tapesh@ubuntu:~$ pip
The program 'pip' is currently not installed. You can install it by typing:
sudo apt-get install python-pip
tapesh@ubuntu:~$
tapesh@ubuntu:~$
tapesh@ubuntu:~$
tapesh@ubuntu:~$
tapesh@ubuntu:~$ ls
Desktop  Documents  Downloads  examples.desktop  Music  Pictures  Public  Templates  Videos
tapesh@ubuntu:~$ cd Downloads/
tapesh@ubuntu:~/Downloads$ ls
tapesh@ubuntu:~/Downloads$ wget https://bootstrap.pypa.io/get-pip.py
--2015-03-31 06:21:10--  https://bootstrap.pypa.io/get-pip.py
Resolving bootstrap.pypa.io (bootstrap.pypa.io)... 103.245.222.175
Connecting to bootstrap.pypa.io (bootstrap.pypa.io)|103.245.222.175|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1608741 (1.5M) [text/x-python]
Saving to: ‘get-pip.py’

100%[=================================================================================>] 1,608,741    325KB/s   in 5.3s  

2015-03-31 06:21:21 (296 KB/s) - ‘get-pip.py’ saved [1608741/1608741]

tapesh@ubuntu:~/Downloads$
tapesh@ubuntu:~/Downloads$
tapesh@ubuntu:~/Downloads$ ls
get-pip.py
tapesh@ubuntu:~/Downloads$ python get-pip.py
Collecting pip
  Downloading pip-6.0.8-py2.py3-none-any.whl (1.3MB)
    100% |################################| 1.3MB 83kB/s
Installing collected packages: pip

  Exception:
  Traceback (most recent call last):
    File "/tmp/tmpfgWRwc/pip.zip/pip/basecommand.py", line 232, in main
      status = self.run(options, args)
    File "/tmp/tmpfgWRwc/pip.zip/pip/commands/install.py", line 347, in run
      root=options.root_path,
    File "/tmp/tmpfgWRwc/pip.zip/pip/req/req_set.py", line 549, in install
      **kwargs
    File "/tmp/tmpfgWRwc/pip.zip/pip/req/req_install.py", line 754, in install
      self.move_wheel_files(self.source_dir, root=root)
    File "/tmp/tmpfgWRwc/pip.zip/pip/req/req_install.py", line 963, in move_wheel_files
      isolated=self.isolated,
    File "/tmp/tmpfgWRwc/pip.zip/pip/wheel.py", line 234, in move_wheel_files
      clobber(source, lib_dir, True)
    File "/tmp/tmpfgWRwc/pip.zip/pip/wheel.py", line 205, in clobber
      os.makedirs(destdir)
    File "/usr/lib/python2.7/os.py", line 157, in makedirs
      mkdir(name, mode)
  OSError: [Errno 13] Permission denied: '/usr/local/lib/python2.7/dist-packages/pip-6.0.8.dist-info'

tapesh@ubuntu:~/Downloads$ sudo python get-pip.py
The directory '/home/tapesh/.cache/pip/log' or its parent directory is not owned by the current user and the debug log has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want the -H flag.
The directory '/home/tapesh/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want the -H flag.
The directory '/home/tapesh/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want the -H flag.
Collecting pip
  Downloading pip-6.0.8-py2.py3-none-any.whl (1.3MB)
    100% |################################| 1.3MB 97kB/s
Installing collected packages: pip

Successfully installed pip-6.0.8
tapesh@ubuntu:~/Downloads$
tapesh@ubuntu:~/Downloads$
tapesh@ubuntu:~/Downloads$
tapesh@ubuntu:~/Downloads$
tapesh@ubuntu:~/Downloads$
tapesh@ubuntu:~/Downloads$ cd
tapesh@ubuntu:~$
tapesh@ubuntu:~$
tapesh@ubuntu:~$
tapesh@ubuntu:~$
tapesh@ubuntu:~$
tapesh@ubuntu:~$ pip --version
pip 6.0.8 from /usr/local/lib/python2.7/dist-packages (python 2.7)
tapesh@ubuntu:~$
tapesh@ubuntu:~$
tapesh@ubuntu:~$
tapesh@ubuntu:~$
tapesh@ubuntu:~$
tapesh@ubuntu:~$
tapesh@ubuntu:~$ sudo easy_install virtualenv
Searching for virtualenv
Reading https://pypi.python.org/simple/virtualenv/
Download error on https://pypi.python.org/simple/virtualenv/: [Errno -2] Name or service not known -- Some packages may not be found!
Couldn't find index page for 'virtualenv' (maybe misspelled?)
Scanning index of all packages (this may take a while)
Reading https://pypi.python.org/simple/
No local packages or download links found for virtualenv
error: Could not find suitable distribution for Requirement.parse('virtualenv')
tapesh@ubuntu:~$
tapesh@ubuntu:~$
tapesh@ubuntu:~$
tapesh@ubuntu:~$ sudo easy_install virtualenv
Searching for virtualenv
Reading https://pypi.python.org/simple/virtualenv/
Best match: virtualenv 12.0.7
Downloading https://pypi.python.org/packages/source/v/virtualenv/virtualenv-12.0.7.tar.gz#md5=e08796f79d112f3bfa6653cc10840114
Processing virtualenv-12.0.7.tar.gz
Writing /tmp/easy_install-GXDQBd/virtualenv-12.0.7/setup.cfg
Running virtualenv-12.0.7/setup.py -q bdist_egg --dist-dir /tmp/easy_install-GXDQBd/virtualenv-12.0.7/egg-dist-tmp-TJOjti
warning: no previously-included files matching '*' found under directory 'docs/_templates'
warning: no previously-included files matching '*' found under directory 'docs/_build'
Adding virtualenv 12.0.7 to easy-install.pth file
Installing virtualenv script to /usr/local/bin
Installing virtualenv-2.7 script to /usr/local/bin

Installed /usr/local/lib/python2.7/dist-packages/virtualenv-12.0.7-py2.7.egg
Processing dependencies for virtualenv
Finished processing dependencies for virtualenv
tapesh@ubuntu:~$
tapesh@ubuntu:~$
tapesh@ubuntu:~$
tapesh@ubuntu:~$
tapesh@ubuntu:~$
tapesh@ubuntu:~$
tapesh@ubuntu:~$
tapesh@ubuntu:~$
tapesh@ubuntu:~$ virtualenv --no-site-packages django-user
New python executable in django-user/bin/python
Installing setuptools, pip...done.
tapesh@ubuntu:~$
tapesh@ubuntu:~$
tapesh@ubuntu:~$ ls
Desktop  django-user  Documents  Downloads  examples.desktop  Music  Pictures  Public  Templates  Videos
tapesh@ubuntu:~$ cd django-user/
tapesh@ubuntu:~/django-user$ ls
bin  include  lib  local
tapesh@ubuntu:~/django-user$ cd..




cd..: command not found
tapesh@ubuntu:~/django-user$
tapesh@ubuntu:~/django-user$
tapesh@ubuntu:~/django-user$
tapesh@ubuntu:~/django-user$
tapesh@ubuntu:~/django-user$ cd ..
tapesh@ubuntu:~$
tapesh@ubuntu:~$
tapesh@ubuntu:~$
tapesh@ubuntu:~$
tapesh@ubuntu:~$ source django-user/bin/activate
(django-user)tapesh@ubuntu:~$
(django-user)tapesh@ubuntu:~$
(django-user)tapesh@ubuntu:~$
(django-user)tapesh@ubuntu:~$
(django-user)tapesh@ubuntu:~$ ls
Desktop  django-user  Documents  Downloads  examples.desktop  Music  Pictures  Public  Templates  Videos
(django-user)tapesh@ubuntu:~$ cd django-user/
(django-user)tapesh@ubuntu:~/django-user$ ls
bin  include  lib  local
(django-user)tapesh@ubuntu:~/django-user$ \
>
(django-user)tapesh@ubuntu:~/django-user$
(django-user)tapesh@ubuntu:~/django-user$
(django-user)tapesh@ubuntu:~/django-user$
(django-user)tapesh@ubuntu:~/django-user$ easy_install django
Searching for django
Reading https://pypi.python.org/simple/django/
Best match: Django 1.7.7
Downloading https://pypi.python.org/packages/source/D/Django/Django-1.7.7.tar.gz#md5=a62d6598966947d150525ad2ab20fb0c
Processing Django-1.7.7.tar.gz
Writing /tmp/easy_install-L1hzoy/Django-1.7.7/setup.cfg
Running Django-1.7.7/setup.py -q bdist_egg --dist-dir /tmp/easy_install-L1hzoy/Django-1.7.7/egg-dist-tmp-CNW019
warning: no previously-included files matching '__pycache__' found under directory '*'
warning: no previously-included files matching '*.py[co]' found under directory '*'
creating /home/tapesh/django-user/lib/python2.7/site-packages/Django-1.7.7-py2.7.egg
Extracting Django-1.7.7-py2.7.egg to /home/tapesh/django-user/lib/python2.7/site-packages
Adding Django 1.7.7 to easy-install.pth file
Installing django-admin.py script to /home/tapesh/django-user/bin
Installing django-admin script to /home/tapesh/django-user/bin

Installed /home/tapesh/django-user/lib/python2.7/site-packages/Django-1.7.7-py2.7.egg
Processing dependencies for django
Finished processing dependencies for django
(django-user)tapesh@ubuntu:~/django-user$
(django-user)tapesh@ubuntu:~/django-user$
(django-user)tapesh@ubuntu:~/django-user$
(django-user)tapesh@ubuntu:~/django-user$
(django-user)tapesh@ubuntu:~/django-user$
(django-user)tapesh@ubuntu:~/django-user$
(django-user)tapesh@ubuntu:~/django-user$ ls
bin  include  lib  local
(django-user)tapesh@ubuntu:~/django-user$ python
Python 2.7.6 (default, Mar 22 2014, 22:59:56)
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import django
>>> django.get_version()
'1.7.7'
>>>
(django-user)tapesh@ubuntu:~/django-user$


CISCO tips and tricks


/*************************************************
CISCO : copy to linux server TCL script
***************************************************/

[bgl-ads-146]@~$cat /nobackup/tapmahes/script/cpl.tcl
#!/bin/env expect

set timeout 60
spawn scp i86bi_linux-adventerprisek9-ms root@10.78.106.52:/root/tapesh/IOU/
expect "password:"
send "cryptolab\r"
expect "100%"
sleep 1

[bgl-ads-146]@~$



/***********************************
CISOC .bashrc alias list
************************************/

[bgl-ads-146]@~$cat ~/.bashrc | grep alias
alias cpl=/nobackup/tapmahes/script/cpl.tcl
alias emacs='/router/bin/emacs-22.3 &'
alias sun='ssh blr-stgios-view1'
alias junk='cd /nobackup/tapmahes/junk'
alias people='cd /nfs/wwwPeople/tapmahes'
alias ssh88='ssh mcp-bld-lnx-88'
alias ssh85='ssh mcp-bld-lnx-85'
alias ssh86='ssh mcp-bld-lnx-86'
alias ssh1='ssh blr-stgios-view1'
alias sshl='ssh root@10.78.106.52'
alias ssht='ssh -t tapmahes-vlnx ". .bashrc; bash -l"'
alias cs='cd /vob/cisco.comp/crypto && cscope-64 -R'
alias cs1='find . -name "*.[ch]" > cscope.files && cscope -d'
alias ver='cat /vob/ios/.publication_manifest | grep crypto'
alias crashinfo='mcp_gdb -p linkfarm/x86_64/usr/binos/bin/x86_64bi_linux_iosd-adventerprisek9-ms.sun'
alias corefile='mcp_gdb_core -p linkfarm/x86_64/usr/binos/bin/x86_64bi_linux_iosd-adventerprisek9-ms.sun -c '
alias tc='tcsh' #if ($?prompt) source ~/.cshrc.keychain
alias gdb64='/router/bin/gdb-bleeding-64'
alias uco='cc_unco -force_unco'
alias cco='cc_co -nc -f'
alias unix_image='unix-jo3s-ms'
alias mosy='/router/bin/mosy-14.2.0.0 -s'
alias buidmib='make dir/*.code '
alias osup='cd /vob/ios.sys6/sys/obj-7k-sup3-rp-earl7'
alias rpk9='make s72033_rp-adventerprisek9-m.ucode'
alias prep='prep-commit tapmahes@cisco.com'
alias ptall='make -k PRECOMMIT_CRYPTO=1 precommit.testall > & make.out &'
alias snaps='cd /auto/ios-snaps'
alias ht='cd  /auto/ios-snaps/haw_t.snap/ios/sys'
#alias ps='/usr/bin/ps'
alias sa='/auto/ses/bin/static_iosbranch'
alias myp='ps -ef | grep tapmahes'
alias mymake='ps -ef | grep tapmahes | grep make'
#alias gcc='/auto/router/bin/gcc.c2.95.3-p11a.solaris'
alias unix='cd /vob/ios/sys/obj-sp-unix'
alias linux='cd /vob/ios/sys/obj-x86_64bi-linux'
alias crypto='cd /vob/cisco.comp/crypto'
alias ikev2='cd /vob/cisco.comp/crypto/ikev2/src/ikev2'
alias objs='cd /vob/cisco.comp/crypto/objects/ios.sparc.v7/'
alias 2800='cd /vob/ios/sys/obj-7k-c2800'
alias update='cc_update -m LATEST'
alias gvim='gvim -bg lightblue -fg black'
alias gw='gvim -bg white -fg black'
alias gp='gvim -bg peachpuff -fg black'
alias gb='gvim -bg brown -fg white'
alias er='stty erase ^H'
alias eq='stty erase ^?'
alias ct='cleartool'
alias pwv='ct pwv'
alias rcscope='/router/bin/cscope'
alias myviews='ls /ws/tapmahes-bgl'
#alias flex "/auto/ses/bin/tools/iosclassic_fl"
alias sys='cd /vob/ios/sys'
#alias cscope='/sw/packages/cscope/12.9/solaris2bin/cscope.kani'
alias cscope='cscope-15.5-p7'
alias tb3='cd /auto/ios-snaps/t_base_3.snap/ios && cscope -d && cd -'
alias tb4='cd /auto/ios-snaps/t_base_4.snap/ios && cscope-64 -d && cd -'
alias googlem='cd /auto/ios-snaps/mcp_dev.snap/ios && cscope-64 -d && cd -'
alias xe37='cd /auto/ios-snaps/v152_4_s_xe37_throttle.snap/ios && cscope -d && cd -'
alias xe38='cd /auto/ios-snaps/v153_1_s_xe38_throttle.snap/ios && cscope -d && cd -'
alias xe39='cd /auto/ios-snaps/v153_2_s_xe39_throttle.snap/ios && cscope -d && cd -'
alias xe314='cd /auto/ios-snaps/v155_1_s_xe314_throttle.snap/ios && cscope-64 -d && cd -'
alias xe313='cd /auto/ios-snaps/v154_3_s_xe313_throttle.snap/ios && cscope-64 -d && cd -'
#alias tftp='cd /auto/tftp-blr-users1/tapmahes'
alias rss='cd /auto/ios-snaps/t_pi12_rss.snap/ios'
#alias s1='ssh blr-stgios-view1'
#alias s2='ssh blr-stgios-view2'
#alias mdi='make -j16 dependencies && cd obj-sp-unix && make -j16 unix-adventerprisek9-ms 2>&1 | tee c.txt'
#alias mdl='make -j16 dependencies && cd obj-x86_64bi-linux && make -j16 TOOLS_VER=c3.4.5-p1 x86_64bi_linux-jk9o3s-ms 2>&1 | tee c.txt'
alias mdl='cd /vob/ios/sys && make -j32 dependencies && cd /vob/ios/sys/obj-i86bi-linux && export GDB_FLAG=-g && make -j32 GDB_FLAG=-g i86bi_linux-adventerprisek9-ms 2>&1 | tee c.txt'
alias mdu='cd /vob/ios/sys && make -j32 dependencies && cd /vob/ios/sys/obj-sp-unix && export GDB_FLAG=-g && make -j32 GDB_FLAG=-g unix-adventerprisek9-ms 2>&1 | tee c.txt'
alias md='cd /vob/ios/sys && make -j32 dependencies'
alias ml='cd /vob/ios/sys/obj-i86bi-linux && export GDB_FLAG=-g && make -j32 GDB_FLAG=-g i86bi_linux-adventerprisek9-ms'
alias ml64='cd /vob/ios/sys/obj-x86_64bi-linux && export GDB_FLAG=-g && make -j32 GDB_FLAG=-g x86_64bi_linux-jk9o3s-ms 2>&1 | tee c.txt'
alias mi='make -j8 unix-adventerprisek9-ms 2>&1 | tee c.txt'
alias mil='make -j8 LEGOFILTER=shr_crypto_ipsec_common.o unix-adventerprisek9-ms 2>&1 | tee c.txt'
alias miln='make -j8 LEGOFILTER=shr_crypto_ikev2.o unix-adventerprisek9-ms 2>&1 | tee c.txt'
alias c7200p='cd /vob/ios/sys && make -j16 dependencies && cd obj-g4-c7100 && make -j16 c7200p-adventerprisek9-mz 2>&1 | tee c.txt'
alias c3900='cd /vob/ios/sys && cd obj-m8500-c3900 && make -j16 c3900-universalk9-mz 2>&1 | tee c.txt'
alias c3900e='cd /vob/ios/sys && cd obj-i86bi-ifr && make -j16 c3900e-universalk9-mz 2>&1 | tee c.txt'
alias c880data='cd /vob/ios/sys && cd obj-m8300-c880 && make -j16 c880data-universalk9-mz 2>&1 | tee c.txt'
alias c2951='cd /vob/ios/sys && cd obj-m8500-c2951 && make -j16 c2951-universalk9-mz 2>&1 | tee c.txt'
alias c2900='cd /vob/ios/sys && cd obj-cn-c2900 && make -j16 c2900-universalk9-mz 2>&1 | tee c.txt'
alias c1900='cd /vob/ios/sys && cd obj-cn-c1900 && make -j16 c1900-universalk9-mz 2>&1 | tee c.txt'
alias c3750e='cd /vob/ios/sys/obj-ppc-c3750e && make -j32 c3750e-universalk9-mz 2>&1 | tee c.txt'
alias c3845='cd /vob/ios/sys && make -j8 dependencies && cd obj-sb-c3845 && make -j8 c3845-adventerprisek9-mz 2>&1 | tee c.txt'
alias c1841='cd /vob/ios/sys && make -j8 dependencies && cd obj-5k-c1840 && make -j8 c1841-adventerprisek9-mz  2>&1 | tee c.txt'
alias c2800nm='cd /vob/ios/sys && make -j8 dependencies && cd obj-7k-c2800 && make -j8 c2800nm-adventerprisek9-mz 2>&1 | tee c.txt'
alias c7200pl='cd /vob/ios/sys/obj-g4-c7100 && make -j8 LEGOFILTER=shr_crypto_ipsec_common.o c7200p-adventerprisek9-mz 2>&1 | tee c.txt'
alias c3845l='cd /vob/ios/sys/obj-sb-c3845 && make -j8 LEGOFILTER=shr_crypto_ipsec_common.o c3845-adventerprisek9-mz 2>&1 | tee c.txt'
alias c1841l='cd /vob/ios/sys/obj-5k-c1840 && make -j8 LEGOFILTER=shr_crypto_ipsec_common.o c1841-adventerprisek9-mz  2>&1 | tee c.txt'
alias c2800nml='cd /vob/ios/sys/obj-7k-c2800 && make -j8 LEGOFILTER=shr_crypto_ipsec_common.o c2800nm-adventerprisek9-mz 2>&1 | tee c.txt'
alias ll='ls -al'
alias     ctl='ct lsview | grep tapmahes'
alias     ctlo='ct lsview | grep $1'
alias     ctv='ct setview'
alias rs='/usr/bin/runsparc.real'
alias tc='tcsh'
alias vi='vim'
#alias ls='ls --color=always'



/***************************************
CISCO short cut command file
****************************************/

Command to bind F12 to a bash file:
bind '"\e[24~":"source ~/.keyshort\n"'

[bgl-ads-146]@~$ cat .keyshort
assert()
{
if [ "$ans" == "" ]
then
exit
fi
}

ShowVariousDirectories()
{
echo "1) /vob/ios/sys"
echo "2) /vob/ios/sys/obj-x86_64bi-linux"
echo "3) /vob/ios/sys/obj-i86bi-linux"
echo "4) /vob/ios/sys/obj-sp-unix"
read -s -n 1 ans
echo --------------
case $ans in
1) cd /vob/ios/sys;;
2) cd /vob/ios/sys/obj-x86_64bi-linux ;;
3) cd /vob/ios/sys/obj-i86bi-linux ;;
4) cd /vob/ios/sys/obj-sp-unix ;;
esac
}

SetView()
{
select ans in `ls /view`;
do
assert
echo -ne "\033]0;${ans:9}\007"
cleartool setview $ans
echo -ne "\033]0;Terminal\007"
break
done
}

CreateView()
{
        echo "Please enter the branch: (if you want to pull view from label, press enter)"
        read branch
        if [ "$branch" == "" ]
        then
                echo "Please enter the label:"
                read label
                echo "Please enter a tag (anything which you can remember):"
                read tag
                start_task -l $label -v /vob/ios -t $tag -d /ws/tapmahes-bgl
        else
                echo "Please enter a tag (anything which you can remember):"
                read tag
                start_task -b $branch -v /vob/ios -t $tag -d /ws/tapmahes-bgl
        fi
}

BINOS()
{
        echo "Please select build type:"
        echo "1) 1RU            2) RP2                  3) RP3"
        read -n 1 type
        case $type in
        1) type=1ru;;
        2) type=rp2;;
        3) type=rp3;;
        esac
        echo "Please enter the label:"
        read label
        echo "Please enter BINOS dir name (anything which you can remember):"
        read binosdir
        mkdir /nobackup/tapmahes/$binosdir
        cd /nobackup/tapmahes/$binosdir
#       acme nw -sb binos -proj main%$label
        echo On Success, set the matching view in IOS and please run the following command from /vob/ios/sys: mcp_ios_precommit -r /nobackup/tapmahes/$binosdir/ "GDB_FLAG=-g" "$type""_super"
}

ShowDiff()
{
        tempifs=$IFS
        IFS=$'\n'
        array=(`ct lsco -avobs -cview | awk '{print $5"@@"$7, $5}' | sed s/\"//g`)
        IFS=$tempifs
        i=0
        while [ $i -lt ${#array[*]} ];
        do
        echo "$i: ${array[$i]}" | cut -d " " -f 1,3
        let i++
        done
        while [ true ];
        do
        echo "Choose file num (Press Enter to Exit):"
        read ans
        if [ "$ans" == "" ]
        then
        break
        fi
        vimdiff  ${array[$ans]}
        done
}

ShowLablesList()
{
        echo "Branch : (default : t_base_2)"
        read branch
        if [ "$branch" == "" ]
        then
                branch=t_base_2
        fi
        echo "Search String (Just Enter for None) : "
        read searchstr
        if [ "$searchstr" == "" ]
        then
                cc_branch_labels -b $branch -v /vob/ios | more
        else
                cc_branch_labels -b $branch -v /vob/ios | grep $searchstr | more
        fi
}

ShowCleartoolOptions()
{
echo "1) Show View"
echo "2) Set View"
echo "3) Create View"
echo "4) Create BINOS Tree"
echo "5) Show Diff"
echo "6) Show Lables list"
echo "7) Show current Lable"
read -s -n 1 ans
echo --------------
case $ans in
1) cleartool lsview | grep tapmahes
echo --------------
cleartool pwv;;
2) SetView;;
3) CreateView;;
4) BINOS;;
5) ShowDiff;;
6) ShowLablesList;;
7) ct edcs;;
esac
}

LaunchRouter()
{
echo "1) IOU"
echo "2) IOU with GDB"
echo "3) IOL"
echo "4) IOL with GDB"
echo "5) IOL 32 bit"
echo "6) IOL 32 bit with GDB"
read -s -n 1 ans
echo --------------
case $ans in
1)      echo "NVRAM Number:"
        read nvramid
        cd /vob/ios/sys/obj-sp-unix
        runsparc ./unix-adventerprisek9-ms -m1000 -n1000 $nvramid ;;
2)  cd /vob/ios/sys/obj-sp-unix
        runsparc /router/bin/gdb unix-adventerprisek9-ms.sun ;;
3)      echo "NVRAM Number:"
        read nvramid
        cd /vob/ios/sys/obj-x86_64bi-linux
        ./x86_64bi_linux-jk9o3s-ms -m1000 -n1000 $nvramid ;;
4)  cd /vob/ios/sys/obj-x86_64bi-linux
    gdb-bleeding-64 x86_64bi_linux-jk9o3s-ms.sun;;
5)      echo "NVRAM Number:"
        read nvramid
        cd /vob/ios/sys/obj-i86bi-linux
        ./i86bi_linux-adventerprisek9-ms -m1000 -n1000 $nvramid ;;
6)  cd /vob/ios/sys/obj-i86bi-linux
    gdb-bleeding i86bi_linux-adventerprisek9-ms.sun;;
esac
}

Compile_IOU_Minimal()
{
echo "1) Build common"
echo "2) Build IKEv2"
read -s -n 1 ans
echo --------------
cd /vob/ios/sys/obj-sp-unix
export GDB_FLAG=-g
case $ans in
1)  make -j32 GDB_FLAG=-g LEGOFILTER=shr_crypto_ipsec_common.o  unix-adventerprisek9-ms 2>&1 | tee c.txt;;
2) make -j32 GDB_FLAG=-g LEGOFILTER=shr_crypto_ikev2.o  unix-adventerprisek9-ms 2>&1 | tee c.txt;;
esac
}

Compile_IOL_X64_Minimul()
{
echo "1) Build common"
echo "2) Build IKEv2"
read -s -n 1 ans
echo --------------
cd /vob/ios/sys/obj-x86_64bi-linux
export GDB_FLAG=-g
case $ans in
1)  make -j64 GDB_FLAG=-g LEGOFILTER=shr_crypto_ipsec_common.o  x86_64bi_linux-jk9o3s-ms 2>&1 | tee c.txt;;
2)  make -j64 GDB_FLAG=-g LEGOFILTER=shr_crypto_ikev2.o  x86_64bi_linux-jk9o3s-ms 2>&1 | tee c.txt;;
esac
}

Compile_IOL_x32_Minimal()
{
echo "1) Build common"
echo "2) Build IKEv2"
read -s -n 1 ans
echo --------------
cd /vob/ios/sys/obj-i86bi-linux
export GDB_FLAG=-g
case $ans in
1)  make -j64 GDB_FLAG=-g LEGOFILTER=shr_crypto_ipsec_common.o  i86bi_linux-adventerprisek9-ms 2>&1 | tee c.txt;;
2)  make -j64 GDB_FLAG=-g LEGOFILTER=shr_crypto_ikev2.o  i86bi_linux-adventerprisek9-ms 2>&1 | tee c.txt;;
esac
}

CompileCode()
{
echo "1) Make Dependencies"
echo "2) IOU Minimal"
echo "3) IOU Full"
echo "4) IOU Fast"
echo "5) Router Build (Make sure to be in Correct OBJ dir)"
echo "6) IOL x64 Full"
echo "7) IOL x64 Minimal"
echo "8) IOL x32 Full"
echo "9) IOL x32 Minimal"
read -s -n 1 ans
echo --------------
case $ans in
1)      cd /vob/ios/sys
        make -j32 dependencies;;
2)      Compile_IOU_Minimal;;
3)  cd /vob/ios/sys/obj-sp-unix
        export GDB_FLAG=-g
        make -j32 GDB_FLAG=-g unix-adventerprisek9-ms 2>&1 | tee c.txt;;
4)  cd /vob/ios/sys/obj-sp-unix
        export GDB_FLAG=-g
        emake-aurora --env=ios unix-adventerprisek9-ms;;
5)      export GDB_FLAG=-g
        echo "Write the target name (Make sure you are in correct OBJ Dir) :"
        read target_router
        make -j32 GDB_FLAG=-g $target_router;;
6)      cd /vob/ios/sys/obj-x86_64bi-linux
        export GDB_FLAG=-g
        make -j32 GDB_FLAG=-g x86_64bi_linux-jk9o3s-ms 2>&1 | tee c.txt;;
7)  Compile_IOL_X64_Minimul;;
8)      cd /vob/ios/sys/obj-i86bi-linux
        export GDB_FLAG=-g
        make -j32 GDB_FLAG=-g i86bi_linux-adventerprisek9-ms 2>&1 | tee c.txt;;
9) Compile_IOL_x32_Minimal;;
esac
}

ShowMainMenu()
{
echo "1) Cleartools command"
echo "2) Moving into Directories"
echo "3) Launch Routers"
echo "4) Compile code"
read -s -n 1 ans
echo --------------
case $ans in
1) ShowCleartoolOptions;;
2) ShowVariousDirectories;;
3) LaunchRouter;;
4) CompileCode;;
esac
}


ShowMainMenu;


#select ans in "Cleartool commands" "Moving into Directories";
#do
#assert
#echo $ans
#case $ans in
#"Cleartool commands") ShowCleartoolOptions;;
#"Moving into Directories") echo second menu;;
#esac
#done