LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
LinkBack Search this Thread
Old 02-23-2009, 12:32 AM   #1
manwithaplan
Member
 
Registered: Nov 2008
Location: ~/
Distribution: Arch || Sidux
Posts: 393

Rep: Reputation: 45
Funtoo bash install script...


Hi all ... just wanna say that I'm somewhat a novice with bash and just need some pointers. This script isnt complete... but, its at a point where I can run it to certain point to test. I'm writing this to use with friends and myself for semi-automated install. I'm having a problem with line 67 - 79 (ITS IN BOLD). I want it to begin downloading by pressing the (1) key, and if there is any break in the script or problem I want it to exit. The output suggests a syntax error... Just cant find it...
Code:
#!/bin/bash
#Funtoo stage3 chroot Installation Script(x64 Core2 build)(2009-Beta)
#Installs from existing x64 distro
#Made by Manwithaplan
#Contact: manwithaplan@comcast.net

# You must have GPARTED installed & an active internet connection
# WARNING!!! Make sure you use the correct drive paths for SWAP, HOME, ROOT Or you'll overwrite your partitions

#Checks if user is root
if [ `id -u` != "0" ]; then
echo "Funtoo Installation Script 2009-beta-test script"
echo "Sorry, you are not root."
echo "Please restart script as root."
fi

#When user is , it gives information about the script
echo
echo "This script installs Funtoo 64bit core2 distro"
echo "Created by Manwithaplan"
echo "This is for Core2 (x64) machines only."
echo
echp
echo "Working internet connection is a must"
echo "And you must have gparted and wget installed"
echo
echo
echo "To continue press Enter..."
read key

#Gives user opportunity to check its partitions
echo "The script will launch gparted, for you to set up your partitions..."
echo "If set, just close gparted"
echo "Press Enter to continue"
read key
echo "Launching gparted..."
gparted

echo "It seems you've set your partitions, and you are ready to continue"
echo "Press Enter to continue"
read key

#Asks for boot, swap and home partition
echo "What is the boot partition of your Funtoo installation?"
echo "Example : /dev/sdb1"
read BOOTPART
echo "What is the Swap partition?"
read SWAP
echo "What is your Funtoo (home) partition?"
read FUNTOOHOME

#Activates Swap partition, mounts boot & home partition
mkswap $SWAP
swapon $SWAP

mkdir /mnt/funtoo
mount $FUNTOOHOME /mnt/funtoo
mkdir /mnt/funtoo/boot
mount $BOOTPART /mnt/funtoo/boot

#Downloading stage file
cd /mnt/funtoo
clear
echo "Now where going to download the stage3 file..."
echo "Downloading from http://www.funtoo.org/"
echo
echo
echo
echo "Press the (1) key to continue:"
read INSTALL

if [ $INSTALL -eq 1]
then
echo "Downloading Stage3 file..."
wget http://funtoo.org/linux/funtoo/~core2/stage3-~core2-current.tar.bz2
else
echo "You must not have a working internet connection, or wget isn't installed"
echo "Press any key to quit"
read key
exit
fi

#Unpacks Stage3 tar file
clear
echo
echo "Stage 3 file Downloaded"
echo "Press the Enter key to continue unpacking"
read key
echo "Unpacking Stage 3 file..."

tar xvjpf stage3-*.tar.bz2     

echo "Unpacked..."
echo "Now Mounting Filesytem"

#Copies DNS information
echo "Copying DNS information"
cp -L /etc/resolv.conf /mnt/funtoo/etc/resolv.conf

#Mounts Proc filesystem
echo "Mounting proc filesystem"
mount -t proc none /mnt/funtoo/proc

#Binds Dev directory
echo "Binding dev directory"
mount -o bind /dev /mnt/funtoo/dev

#Chroots into new Enviroment"
echo "Chrooting into Enviroment"
chroot /mnt/funtoo /bin/bash
env-update
source /etc/profile
export PS1="(chroot) $PS1"


#You are now chrooted, and partitons mounted on system... 

#Time to Edit /etc/make.conf to and any CFLAGS etc...
echo "Press Enter to edit make.conf"
read key
nano /etc/make.conf
clear

# Downloading Funtoo portage 
cd /
cd /etc/portage
echo "Now we need to download the latest Funtoo snapshot"
echo "Located @ http://www.funtoo.org/linux/funtoo/snapshots/"
echo "Please download the funtoo snapshot file to....  /usr/portage/"
echo 
echo "For this we need to use your web client"
echo "Please choose which Browser want to use to download with"
echo
echo "Remember to save it in /etc/portage/"
echo
echo "Press (1) for firefox"
echo "Press (2) for epiphany"
echo "Press (3) for konqueror"
echo "Press (4) for opera"
echo "Press (5) for seamonkey"
echo 
echo "Please enter (1-5) to continue:"
read DL

if [ $DL -eq 1 ]
then
echo "Launching firefox, Please close to continue"
firefox http://funtoo.org/linux/funtoo/snapshots/

elif [ $DL -eq 2 ]
then
echo "Launching epiphany, Please close to continue"
epiphany http://funtoo.org/linux/funtoo/snapshots/

elif [ $DL -eq 3 ]
then
echo "Launching konqueror, Please close to continue"
konqueror http://funtoo.org/linux/funtoo/snapshots/

elif [ $DL -eq 4 ]
then
echo "Launching opera, Please close to continue"
opera http://funtoo.org/linux/funtoo/snapshots/

elif [ $DL -eq 5 ]
then 
echo "Launching seamonkey, Please close to continue"
seamonkey http://funtoo.org/linux/funtoo/snapshots/
else
echo "There must be a problem with your connection or browser"
echo 
echo "Press any key to exit...."
exit

#Updates Portage Tree
#echo "Updating Portage tree"
#echo "Press any key to continue"
#read key
#echo
#cd /usr/portage
#script finished until here still working on finishing up with adding #some code to add meta packages for an X Desktop

Here's the output:
Quote:
./Auto_gentoo_build.sh: line 71: [: missing `]'
Any help would be great Thanks to anyone in advance



DISREGARD.... I WAS MISSING A SPACE IN THE BRACKETS ...........

Last edited by manwithaplan; 02-23-2009 at 12:50 AM.
 
Old 02-23-2009, 01:41 AM   #2
TITiAN
Member
 
Registered: Mar 2008
Location: NRW, Germany
Distribution: Debian GNU/Linux with XFCE and packages from "testing"
Posts: 377

Rep: Reputation: 46
ok then your problem is solved.
i'm posting in order to remove this from the "zero reply" list
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
passing variable from bash to perl in a bash script quadmore Programming 6 02-21-2011 04:11 AM
LXer: How To Create A Bash Install Script LXer Syndicated Linux News 0 08-14-2008 06:40 PM
Strange if statement behaviour when using bash/bash script freeindy Programming 7 08-04-2008 06:00 AM
Bash script to create bash script jag7720 Programming 10 09-10-2007 07:01 PM
building a bash script from an install script paranoid times Programming 6 07-29-2006 03:24 AM


All times are GMT -5. The time now is 10:30 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration