#!/bin/bash
|
#!/bin/bash
|
# Xanthopoulos Constantinos
|
# Xanthopoulos Constantinos
|
# Installing OR GNU Toolchain.
|
# Installing OR GNU Toolchain.
|
# Only tested in Debian Squeeze.
|
# Only tested in Debian Squeeze.
|
|
|
|
|
# ===== CONFIGURATIONS =====
|
# ===== CONFIGURATIONS =====
|
# ==========================
|
# ==========================
|
|
|
# Where will I put the binaries?
|
# Where will I put the binaries?
|
# ex. /opt/openrisc/bin
|
# ex. /opt/openrisc/bin
|
DIR_TO_INSTALL="";
|
DIR_TO_INSTALL="";
|
|
|
# Debian's kernel architecture {32,64}
|
# Debian's kernel architecture {32,64}
|
# ex. KERNEL_ARCH="32"
|
# ex. KERNEL_ARCH="32"
|
KERNEL_ARCH=""
|
KERNEL_ARCH=""
|
|
|
# ===== SCRIPT ======
|
# ===== SCRIPT ======
|
# ===================
|
# ===================
|
export DEBUG=0;
|
export DEBUG=0;
|
. conxshlib.sh
|
. conxshlib.sh
|
|
|
if [ `whoami` == "root" ];
|
if [ `whoami` == "root" ];
|
then
|
then
|
errormsg "You shouldn't be root for this script to run.";
|
errormsg "You shouldn't be root for this script to run.";
|
fi;
|
fi;
|
|
|
if [ ! -d $DIR_TO_INSTALL ]
|
if [ ! -d $DIR_TO_INSTALL ]
|
then
|
then
|
errormsg "Directory doesn't exist. Please create it";
|
errormsg "Directory doesn't exist. Please create it";
|
fi;
|
fi;
|
|
|
execcmd "Change permissions" "chmod 777 $DIR_TO_INSTALL";
|
execcmd "Change permissions" "chmod 777 $DIR_TO_INSTALL";
|
|
|
cd $DIR_TO_INSTALL;
|
cd $DIR_TO_INSTALL;
|
|
|
if [ $KERNEL_ARCH == "32" ];
|
if [ $KERNEL_ARCH == "32" ];
|
then
|
then
|
execcmd "Download toolchain (it may take a while)" "wget ftp://ocuser:oc@opencores.org/toolchain/or32-elf-linux-x86.tar.bz2";
|
execcmd "Download toolchain (it may take a while)" "wget ftp://ocuser:oc@opencores.org/toolchain/or32-elf-linux-x86.tar.bz2";
|
elif [ $KERNEL_ARCH == "64"];
|
elif [ $KERNEL_ARCH == "64"];
|
then
|
then
|
execcmd "Download toolchain (it may take a while)" "wget ftp://ocuser:oc@opencores.org/toolchain/or32-elf-linux-x86_64.tar.bz2";
|
execcmd "Download toolchain (it may take a while)" "wget ftp://ocuser:oc@opencores.org/toolchain/or32-elf-linux-x86_64.tar.bz2";
|
else
|
else
|
errormsg "Not a correct architecture. Check Configurations";
|
errormsg "Not a correct architecture. Check Configurations";
|
fi
|
fi
|
|
|
execcmd "Un-tar" "tar xf *bz2";
|
execcmd "Un-tar" "tar xf *bz2";
|
|
|
execcmd "Adding toolchain to PATH" "echo \"PATH=\\\$PATH:$DIR_TO_INSTALL/or32-elf/bin/\" >> /home/$(whoami)/.bashrc;";
|
execcmd "Adding toolchain to PATH" "echo \"PATH=\\\$PATH:$DIR_TO_INSTALL/or32-elf/bin/\" >> /home/$(whoami)/.bashrc;";
|
|
|
cecho "Install completed"
|
cecho "Install completed"
|
|
|