Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
GLIS: Gentoo Linux Install Script (v0.1 Final, PLZ Test)
View unanswered posts
View posts from last 24 hours

Goto page 1, 2, 3 ... 22, 23, 24  Next  
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
npmccallum
Retired Dev
Retired Dev


Joined: 09 May 2003
Posts: 306
Location: Lexington, KY

PostPosted: Wed May 21, 2003 5:11 am    Post subject: GLIS: Gentoo Linux Install Script (v0.1 Final, PLZ Test) Reply with quote

Here is GLIS. GLIS stands for Gentoo Linux Install Script. It is now working VERY well. If you have any questions/problems, just leave a message on this forum. The forum can't take my comments and the code in one post, so the code will no longer be posted here. Please check http://glis.sourceforge.net/ (thanks ianneub!!!) or http://www.sourceforge.net/projects/glis.

***Please post your success/failures in this forum rather than PMing me with them. Its not that I mind, I really don't, I just would like to see everyone benefit from your experiences. Thanks!***

If you are interested in helping, please email npmccallum@users.sourceforge.net. Thanks for everyone's help so far!!!

To install, check out http://glis.sourceforge.net/(Instructions at the bottom. New web page forthcoming.


Last edited by npmccallum on Mon Nov 03, 2003 7:59 pm; edited 27 times in total
Back to top
View user's profile Send private message
dol-sen
Developer
Developer


Joined: 30 Jun 2002
Posts: 2520
Location: Richmond, BC, Canada

PostPosted: Wed May 21, 2003 5:51 am    Post subject: Reply with quote

Emergeing the sources just downloads and installs sources, it does not configure and compile. As for whether anything else may be affected, I do not know. I beleive the stage1 tarball contains kernel header sources that are needed for building and linking to glibc, so unpack the tarball then emerge your kernel sources so they don't get overwrtten.
_________________
Brian
Porthole, the Portage GUI frontend irc@freenode: #gentoo-guis, #porthole, Blog
layman, gentoolkit, CoreBuilder, esearch...
Back to top
View user's profile Send private message
grudge
Tux's lil' helper
Tux's lil' helper


Joined: 26 Oct 2002
Posts: 77
Location: South Africa

PostPosted: Wed May 21, 2003 8:24 am    Post subject: ?? Reply with quote

Why would you want to emerge the kernel sources before doing the bootstrap ?? Just curious ... :?
Back to top
View user's profile Send private message
npmccallum
Retired Dev
Retired Dev


Joined: 09 May 2003
Posts: 306
Location: Lexington, KY

PostPosted: Thu May 22, 2003 12:43 am    Post subject: Reply with quote

The code will no longer be posted in this forum as it is approaching 2000 lines. Check above for a download link.

Last edited by npmccallum on Sat Jun 28, 2003 2:02 am; edited 11 times in total
Back to top
View user's profile Send private message
steveb
Advocate
Advocate


Joined: 18 Sep 2002
Posts: 4564

PostPosted: Thu May 22, 2003 1:05 am    Post subject: Reply with quote

post the code of install.sh you have so far and let us all work on it.

cheers

SteveB
Back to top
View user's profile Send private message
npmccallum
Retired Dev
Retired Dev


Joined: 09 May 2003
Posts: 306
Location: Lexington, KY

PostPosted: Thu May 22, 2003 9:06 am    Post subject: Reply with quote

[EDIT] This post is now irrelivant.

Last edited by npmccallum on Mon Jun 09, 2003 6:41 pm; edited 9 times in total
Back to top
View user's profile Send private message
steveb
Advocate
Advocate


Joined: 18 Sep 2002
Posts: 4564

PostPosted: Thu May 22, 2003 7:42 pm    Post subject: Reply with quote

ho about this for the time zone selection?
Code:
#Choose time zone
rm -f /tmp/menuitem.$$
dialog --title "Gentoo Linux : Time Zone Selection" --backtitle "Gentoo Linux Installation" --menu "Choose your time zone. Move using [UP] [DOWN],[ENTER] to Select" 17 80 11 $(sed -n "s/^\([A-Z][A-Z]\)\t.*\t\(.*\)\t.*/\2 \"\1\"/gIp" /usr/share/zoneinfo/zone.tab) 2>/tmp/menuitem.$$
if [ "$?" -eq 0 ]; then
   ln -sf /usr/share/zoneinfo/$(cat /tmp/menuitem.$$) /etc/localtime
else
   # set default to US/Eastern
   ln -sf /usr/share/zoneinfo/US/Eastern /etc/localtime
fi


i did not tested it, but i think it should work.

cheers

SteveB
Back to top
View user's profile Send private message
npmccallum
Retired Dev
Retired Dev


Joined: 09 May 2003
Posts: 306
Location: Lexington, KY

PostPosted: Thu May 22, 2003 7:49 pm    Post subject: Reply with quote

see above...

Last edited by npmccallum on Tue May 27, 2003 4:37 pm; edited 2 times in total
Back to top
View user's profile Send private message
steveb
Advocate
Advocate


Joined: 18 Sep 2002
Posts: 4564

PostPosted: Thu May 22, 2003 7:57 pm    Post subject: Reply with quote

npmccallum wrote:
That looks good... I'll merge it and test it.

On another note, in the "Emerge Kernel" section, it also attempts to merge 31 other dependencies. All we need to do at this step it run 'make menuconfig'. Any way to avoid merging 31 deps and ruining the bootstrap!?


i don't see the point of emerging the kernel that early. why do you want it to be the first thing to be emerged?

anyway... if you want just the kernel, then try emerging it with -O. but i think it will fail, because you probably need at least sys-apps/sed sys-devel/make app-admin/addpatches for the kernel to be extracted (and maybe you need other tools as well).

cheers

SteveB
Back to top
View user's profile Send private message
steveb
Advocate
Advocate


Joined: 18 Sep 2002
Posts: 4564

PostPosted: Thu May 22, 2003 8:22 pm    Post subject: Reply with quote

how about this for the root partition stuff?
Code:
#Root Partition
check_mount_point="/mnt/gentoo"
rootpart=$(mount | grep -i " on ${check_mount_point} " | sed -n "s/^\(.*\) on .* type .*/\1/gIp")
dialog --title "Gentoo Linux : Partition Configuration" --backtitle "Gentoo Linux Installation" --yesno "\n${rootpart} is mounted to ${check_mount_point}. Should ${rootpart} be used as your root partition for Gentoo Linux ?" 7 80
sel=$?
case $sel in
   0) echo "rootpart=${rootpart}" >> /mnt/gentoo/root/variables.sh;;
   1) rootpart="";;
   255) echo "Canceled by user by pressing [ESC] key";exit 0;;
esac


#Let the user select his root partition for Gentoo Linux
if [[ ! -z "${rootpart} || "${rootpart} == "" ]] ; then
   rm -f /tmp/input.$$
   dialog --title "Gentoo Linux : Partition Configuration" --backtitle "Gentoo Linux Installation" --inputbox "Enter the full path of your root partition (ie. '/dev/hda3')" 8 80 2>/tmp/input.$$
   sel=$?
   na=`cat /tmp/input.$$`
   case $sel in
      0) echo "rootpart=$na" >> /mnt/gentoo/root/variables.sh ;;
      1) echo "Cancel is Pressed" ; exit 1;;
      255) echo "[ESCAPE] key pressed" ; exit 1;;
   esac
fi


once again: i did not tested it, but i think it should work.

cheers

SteveB
Back to top
View user's profile Send private message
steveb
Advocate
Advocate


Joined: 18 Sep 2002
Posts: 4564

PostPosted: Thu May 22, 2003 8:48 pm    Post subject: Reply with quote

how about this for your beta-kernel problem?
Code:
kernel_dir_check() {
   if [ -d /usr/src/linux-beta ] ; then
      cd /usr/src/linux-beta
      return 0
   elsif [ -d /usr/src/linux ] ; then
      cd /usr/src/linux
      return 0
   else
      echo "No kernel sources found!!!"
      return 1
   fi
}

boot_dir_check() {
   if [ ! -d /boot ] ; then
      echo "No /boot directory found!!!"
      return 1
   else
      return 0
   fi
}

init_default_kernel() {
   kernel_dir_check || exit 1
   make mrproper
   cp /boot/config ./.config
   make oldconfig
   return 0
}

config_kernel() {
   kernel_dir_check || exit 1
   if [ ! -f ./.config ] && init_default_kernel
   boot_dir_check || exit 1
   make menuconfig
   make dep && make clean bzImage modules modules_install
   if [ $? -ne 0 ] ; then
      dialog --title "Gentoo Linux : Failed while compiling kernel" --backtitle "Gentoo Linux Installation" --yesno "\nDo you want to reconfigure the kernel and try again?" 7 80
      sel=$?
      case $sel in
         0) kernel_dir_check || exit 1;mv ./.config ../.config;make mrproper;mv ../.config ./.config;config_kernel;;
         1) echo "Quitting..."; exit 1;;
         255) echo "Canceled by user by pressing [ESC] key"; exit 1;;
      esac
   fi
   boot_dir_check && cp ./arch/i386/boot/bzImage /boot/vmlinuz || exit 1
   return 0
}

config_kernel


once again: i did not tested it, but i think it should work.

cheers

SteveB


Last edited by steveb on Thu May 22, 2003 9:11 pm; edited 2 times in total
Back to top
View user's profile Send private message
JoeW71
n00b
n00b


Joined: 07 May 2003
Posts: 27
Location: Umea, Sweden

PostPosted: Thu May 22, 2003 8:57 pm    Post subject: Reply with quote

Nice effort, keep up the good spirit.

I have been dabbling with a graphical installer (only the visual concept so far but the more I learn about scripting in linux.....), is it okey if I borrow some of this code??
_________________
I once met the guys in Anthrax, backstage after a gig in Stockholm. I didn't ask for autographs though.....
Back to top
View user's profile Send private message
steveb
Advocate
Advocate


Joined: 18 Sep 2002
Posts: 4564

PostPosted: Thu May 22, 2003 9:06 pm    Post subject: Reply with quote

JoeW71 wrote:
is it okey if I borrow some of this code??


i think this is oss and you can take what ever you like from it. if you want to help us, then post your changes / enhancements back so we can learn as well.

cheers

SteveB
Back to top
View user's profile Send private message
npmccallum
Retired Dev
Retired Dev


Joined: 09 May 2003
Posts: 306
Location: Lexington, KY

PostPosted: Thu May 22, 2003 10:21 pm    Post subject: Reply with quote

Borrow whatever you want... just footnote us so we can feel good about ourselves :)
Back to top
View user's profile Send private message
steveb
Advocate
Advocate


Joined: 18 Sep 2002
Posts: 4564

PostPosted: Thu May 22, 2003 10:28 pm    Post subject: Reply with quote

npmccallum wrote:
Borrow whatever you want... just footnote us so we can feel good about ourselves :)

you can leave me out of the footnote :) and add instead a link to the gentoo forum. since i was mentioned on that weekly news letter of gentoo, i get allmost daily serval mails asking about ibm/lotus domino and linux. i think up to today i convinced about 6 admins/users/companies to run domino on gentoo and all of that only because of the news letter.
i feel great about that! linux is a great platform!

cheers

SteveB
Back to top
View user's profile Send private message
JoeW71
n00b
n00b


Joined: 07 May 2003
Posts: 27
Location: Umea, Sweden

PostPosted: Thu May 22, 2003 10:41 pm    Post subject: Reply with quote

thanks, but don't expect anything soon, it's a learn-as-i-go sort of thing...
But I am serious about it, I believe that Gentoo should have an easier installer to complement the current alternative.
_________________
I once met the guys in Anthrax, backstage after a gig in Stockholm. I didn't ask for autographs though.....
Back to top
View user's profile Send private message
npmccallum
Retired Dev
Retired Dev


Joined: 09 May 2003
Posts: 306
Location: Lexington, KY

PostPosted: Thu May 22, 2003 11:34 pm    Post subject: Reply with quote

The reason I am trying to emerge the kernel so early is because I want to make the config file BEFORE the bootstrap. The goal is to have all the config work done before the major compiles (preferably before the chroot) and then let the system finish the install itself. My method has been to try and put all the configuration in install.sh and let chroot.sh handle all the gruntwork.

There are three problems with this approach:
1. The 'passwd' command doesn't exist on the system until AFTER 'emerge system'. Thus, unless there is a way around this (and I'm sure there is), the user will have to input data after 'emerge system'. ANNOYING...
2. It is not easily feasable to make a config file for the kernel before 'emerge system'. (unless we can figure out a way) ALSO ANNOYING...
3. while the etc-update command does exist before 'emerge system', it is pointless to execute until after 'emerge sytem' because there are no etc-files to update.

Option #1:
If we made a generic kernel (or generic .config file) and used it to reboot the system the first time (a la redhat approach), then we could have a first-time runscript to build a new custom kernel and run etc-update.

One added bonus of this approach is that if the n00b botches up his/her kernel the first time, they still have a working kernel to boot with rather than having to re-run the whole install script or try and fix it from a cd. Another bonus is that, with a first-run script we could automate the re-emerge of pcmcia-cs and possibly offer some other common options (we could prompt to emerge sudo, ntpd, sshd, etc.; this could however lead to bloat and annoyance).

The downside, is that you can't have a custom kernel for the first boot if you use the install script. This is unfortunate for special hardware situations. Another downside is that we are now increasing the size of the install files (install.sh, chroot.sh, AND kernel-image; this problem is solved if we just use a generic .config file). The last problem is it still doesn't fix the 'passwd' issue.

Option #2:
Do kernel config after 'emerge system'. Then we could run kernel config, passwd, and etc-update all at the same time.

The downside of this method is:
1. we loose the "configure and walk away" install
2. when n00bs screw up their kernel, they have to either fix their system by hand (hard for them, but they learn) or reinstall the WHOLE system (compile times and all)

What do you think? I am personally voting for option #1. But there may be other ideas.

The number one thing for me right now is figuring out a way to pipe a password to 'passwd'. Does anyone know how to do this!?!?
Back to top
View user's profile Send private message
npmccallum
Retired Dev
Retired Dev


Joined: 09 May 2003
Posts: 306
Location: Lexington, KY

PostPosted: Thu May 22, 2003 11:39 pm    Post subject: Reply with quote

SteveB,
Once we are in the chroot.sh script the 'dialog' command is no longer available to us (in the new chroot system). This applies to all three pieces of code you posted.

As a whole, once we are in the chroot.sh script there is very little available too us. Thats why all the user prompts should be in install.sh. This seems to me to argue in favor of option #1 in my previous post.
Back to top
View user's profile Send private message
steveb
Advocate
Advocate


Joined: 18 Sep 2002
Posts: 4564

PostPosted: Fri May 23, 2003 12:31 am    Post subject: Reply with quote

npmccallum wrote:
SteveB,
Once we are in the chroot.sh script the 'dialog' command is no longer available to us (in the new chroot system). This applies to all three pieces of code you posted.

As a whole, once we are in the chroot.sh script there is very little available too us. Thats why all the user prompts should be in install.sh. This seems to me to argue in favor of option #1 in my previous post.


okay... then how about this:
Code:
#*****--install.sh--*********************************************************
#
#     Install Script for Gentoo Linux - version 0.2
#
#        Copyright 2003 Nathaniel McCallum.
#
#    For all queries about this code, please contact the current author,
#    Nathaniel McCallum <nathaniel_mccallum@asburyseminary.edu> and not
#    Gentoo Linux.
#
#    This program is free software; you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation; either version 2 of the License, or
#    (at your option) any later version.
#
#    This software is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#*****************************************************************************

#Intro
dialog --title "Gentoo Linux : Begin?" --backtitle "Gentoo Linux Installation" --yesno "\nDo you want to install Gentoo Linux?" 7 80
sel=$?
case $sel in
   0) echo "Starting Installation..."; clear;;
   1) echo "Quitting..."; exit 0;;
   255) echo "Canceled by user by pressing [ESC] key"; exit 0;;
esac

#Unpack Stage1 Tarball
echo "Unpacking stage 1 tarball..."
cd /mnt/gentoo
tar -xjpf /mnt/cdrom/gentoo/stage1-*.tar.bz2

#************************************
#********** System  Config **********
#************************************

#remove previous config file
rm -f /mnt/gentoo/root/variables.sh

#Hostname
dialog --title "Gentoo Linux : Network Configuration" --backtitle "Gentoo Linux Installation" --inputbox "Enter your hostname please (ie. 'host', NOT 'host.gentoo.org')" 8 80 2>/tmp/input.$$

sel=$?

na=`cat /tmp/input.$$`
case $sel in
   0) echo "hostname=$na" >> /mnt/gentoo/root/variables.sh ;;
   1) echo "Cancel is Pressed" ; exit 1;;
   255) echo "[ESCAPE] key pressed" ; exit 1;;
esac

rm -f /tmp/input.$$

#Domain
dialog --title "Gentoo Linux : Network Configuration" --backtitle "Gentoo Linux Installation" --inputbox "Enter your domain please (ie. 'gentoo.org')" 8 80 2>/tmp/input.$$

sel=$?

na=`cat /tmp/input.$$`
case $sel in
   0) echo "domain=$na" >> /mnt/gentoo/root/variables.sh ;;
   1) echo "Cancel is Pressed" ; exit 1;;
   255) echo "[ESCAPE] key pressed" ; exit 1;;
esac

rm -f /tmp/input.$$

#IP Address
dialog --title "Gentoo Linux : Network Configuration" --backtitle "Gentoo Linux Installation" --inputbox "Please enter your IP address (if you will use DHCP, enter '127.0.0.1')" 8 80 2>/tmp/input.$$

sel=$?

na=`cat /tmp/input.$$`
case $sel in
   0) echo "ip=$na" >> /mnt/gentoo/root/variables.sh ;;
   1) echo "Cancel is Pressed" ; exit 1;;
   255) echo "[ESCAPE] key pressed" ; exit 1;;
esac


#*****************************************************************************
# Root Partition
#*****************************************************************************
check_mount_point="/mnt/gentoo"
rootpart=$(mount | grep -i " on ${check_mount_point} " | sed -n "s/^\(.*\) on .* type .*/\1/gIp")
dialog --title "Gentoo Linux : Partition Configuration" --backtitle "Gentoo Linux Installation" --yesno "\n${rootpart} is mounted to ${check_mount_point}. Should ${rootpart} be used as your root partition for Gentoo Linux ?" 7 80
sel=$?
case $sel in
   0) echo "rootpart=${rootpart}" >> /mnt/gentoo/root/variables.sh;;
   1) rootpart="";;
   255) echo "Canceled by user by pressing [ESC] key";exit 0;;
esac
#*****************************************************************************


#*****************************************************************************
# The user was not happy with our root partition guess. Let him choose the
# Gentoo Linux root partition.
#*****************************************************************************
if [[ ! -z "${rootpart} || "${rootpart} == "" ]] ; then
   rm -f /tmp/input.$$
   dialog --title "Gentoo Linux : Partition Configuration" --backtitle "Gentoo Linux Installation" --inputbox "Enter the full path of your root partition (ie. '/dev/hda3')" 8 80 2>/tmp/input.$$
   sel=$?
   na=`cat /tmp/input.$$`
   case $sel in
      0) echo "rootpart=$na" >> /mnt/gentoo/root/variables.sh ;;
      1) echo "Cancel is Pressed" ; exit 1;;
      255) echo "[ESCAPE] key pressed" ; exit 1;;
   esac
fi
#*****************************************************************************


rm -f /tmp/input.$$

#Emerge RP-PPPOE?
dialog --title "Gentoo Linux : Package Selection" --backtitle "Gentoo Linux Installation" --yesno "\nDo you want to emerge rp-pppoe?" 7 80
sel=$?
case $sel in
   0) echo "pppoe=true" >> /mnt/gentoo/root/variables.sh;;
   1) echo "pppoe=false" >> /mnt/gentoo/root/variables.sh;;
   255) echo "Canceled by user by pressing [ESC] key"; exit 1;;
esac

#Emerge XFSPROGS?
dialog --title "Gentoo Linux : Package Selection" --backtitle "Gentoo Linux Installation" --yesno "\nDo you want to emerge xfsprogs?" 7 80
sel=$?
case $sel in
   0) echo "xfsprogs=true" >> /mnt/gentoo/root/variables.sh;;
   1) echo "xfsprogs=false" >> /mnt/gentoo/root/variables.sh;;
   255) echo "Canceled by user by pressing [ESC] key"; exit 1;;
esac

#Emerge REISERFSPROGS?
dialog --title "Gentoo Linux : Package Selection" --backtitle "Gentoo Linux Installation" --yesno "\nDo you want to emerge reiserfsprogs?" 7 80
sel=$?
case $sel in
   0) echo "reiserfsprogs=true" >> /mnt/gentoo/root/variables.sh;;
   1) echo "reiserfsprogs=false" >> /mnt/gentoo/root/variables.sh;;
   255) echo "Canceled by user by pressing [ESC] key"; exit 1;;
esac

#Emerge JFSUTILS?
dialog --title "Gentoo Linux : Package Selection" --backtitle "Gentoo Linux Installation" --yesno "\nDo you want to emerge jfsutils?" 7 80
sel=$?
case $sel in
   0) echo "jfsutils=true" >> /mnt/gentoo/root/variables.sh;;
   1) echo "jfsutils=false" >> /mnt/gentoo/root/variables.sh;;
   255) echo "Canceled by user by pressing [ESC] key"; exit 1;;
esac

#Emerge LVM-USER?
dialog --title "Gentoo Linux : Package Selection" --backtitle "Gentoo Linux Installation" --yesno "\nDo you want to emerge lvm-user?" 7 80
sel=$?
case $sel in
   0) echo "lvm=true" >> /mnt/gentoo/root/variables.sh;;
   1) echo "lvm=false" >> /mnt/gentoo/root/variables.sh;;
   255) echo "Canceled by user by pressing [ESC] key"; exit 1;;
esac

#Emerge PCMCIA-CS?
dialog --title "Gentoo Linux : Package Selection" --backtitle "Gentoo Linux Installation" --yesno "\nDo you want to emerge pcmcia-cs? (You will have to re-emerge after reboot)" 7 80
sel=$?
case $sel in
   0) echo "pcmcia=true" >> /mnt/gentoo/root/variables.sh;;
   1) echo "pcmcia=false" >> /mnt/gentoo/root/variables.sh;;
   255) echo "Canceled by user by pressing [ESC] key"; exit 1;;
esac

#Choose system logger
dialog --title "Gentoo Linux : Package Selection" --backtitle "Gentoo Linux Installation" --menu "Choose system logger. Move using [UP] [DOWN],[Enter] to Select" 15 80 4 metalog "(recommended)" sysklogd "" syslog-ng "" msyslog "" 2>/tmp/menuitem.$$

menuitem=`cat /tmp/menuitem.$$`

opt=$?

case $menuitem in
metalog) echo "logger=metalog" >> /mnt/gentoo/root/variables.sh;;
sysklogd) echo "logger=sysklogd" >> /mnt/gentoo/root/variables.sh;;
syslog-ng) echo "logger=syslog-ng" >> /mnt/gentoo/root/variables.sh;;
msyslog) echo "logger=msyslog" >> /mnt/gentoo/root/variables.sh;;
*) echo "Quitting..."; exit 1 ;;
esac

rm -f /tmp/menuitem.$$

#Choose cron daemon
dialog --title "Gentoo Linux : Package Selection" --backtitle "Gentoo Linux Installation" --menu "Choose cron daemon. Move using [UP] [DOWN],[Enter] to Select" 15 80 3 vcron "(recommended)" dcron "" fcron "" 2>/tmp/menuitem.$$

menuitem=`cat /tmp/menuitem.$$`

opt=$?

case $menuitem in
vcron) echo "cron=vcron" >> /mnt/gentoo/root/variables.sh;;
dcron) echo "cron=dcron" >> /mnt/gentoo/root/variables.sh;;
fcron) echo "cron=fcron" >> /mnt/gentoo/root/variables.sh;;
*) echo "Quitting..."; exit 1 ;;
esac

rm -f /tmp/menuitem.$$

#Choose kernel source
#Need to add more sources to the menu
dialog --title "Gentoo Linux : Package Selection" --backtitle "Gentoo Linux Installation" --menu "Choose kernel source. Move using [UP] [DOWN],[Enter] to Select" 15 80 4 gentoo-sources "(recommended)" vanilla-sources "" ck-sources "" development-sources "" 2>/tmp/menuitem.$$

menuitem=`cat /tmp/menuitem.$$`

opt=$?

case $menuitem in
gentoo-sources) echo "kernelsource=gentoo-sources" >> /mnt/gentoo/root/variables.sh;;
vanilla-sources) echo "kernelsource=vanilla-sources" >> /mnt/gentoo/root/variables.sh;;
ck-sources) echo "kernelsource=ck-sources" >> /mnt/gentoo/root/variables.sh;;
development-sources) echo "kernelsource=development-sources" >> /mnt/gentoo/root/variables.sh;;
*) echo "Quitting..."; exit 1 ;;
esac

#*****************************************************************************
# Choose time zone
#*****************************************************************************
rm -f /tmp/menuitem.$$
dialog --title "Gentoo Linux : Time Zone Selection" --backtitle "Gentoo Linux Installation" --menu "Choose your time zone. Move using [UP] [DOWN],[ENTER] to Select" 17 80 11 $(sed -n "s/^\([A-Z][A-Z]\)\t.*\t\(.*\)\t.*/\2 \"\1\"/gIp" /usr/share/zoneinfo/zone.tab) 2>/tmp/menuitem.$$
if [ "$?" -eq 0 ]; then
   echo "usertimezone=/usr/share/zoneinfo/$(cat /tmp/menuitem.$$)" >> /mnt/gentoo/root/variables.sh
else
   # set default to US/Eastern
   echo "usertimezone=/usr/share/zoneinfo/US/Eastern" >> /mnt/gentoo/root/variables.sh
fi
#*****************************************************************************

#*****************************************************************************
# Clean up
#*****************************************************************************
if [ -f /tmp/menuitem.$$ ] ; then
   rm -f /tmp/menuitem.$$
fi
#*****************************************************************************

#************************************
#**********   END CONFIG   **********
#************************************

#Chroot into new system
clear
echo "Entering new system..."
mount -t proc proc /mnt/gentoo/proc
cp /etc/resolv.conf /mnt/gentoo/etc/resolv.conf
cp /root/chroot.sh /mnt/gentoo/root/.bashrc
chroot /mnt/gentoo /bin/bash

#Error Check
if [ $? -ne 0 ]
then
echo "Install Error!!! Quiting..."
rm -f /mnt/gentoo/root/.bashrc
rm -f /mnt/gentoo/root/variables.sh
exit 1
else
rm -f /mnt/gentoo/root/.bashrc
rm -f /mnt/gentoo/root/variables.sh
fi

#Done!
echo "Rebooting the system..."
cd /
umount /mnt/gentoo/boot
umount /mnt/gentoo/proc
umount /mnt/gentoo
reboot


Code:
#*****--chroot.sh--***********************************************************
#
#     Install Script for Gentoo Linux - version 0.2
#
#        Copyright 2003 Nathaniel McCallum.
#
#    For all queries about this code, please contact the current author,
#    Nathaniel McCallum <nathaniel_mccallum@asburyseminary.edu> and not
#    Gentoo Linux.
#
#    This program is free software; you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation; either version 2 of the License, or
#    (at your option) any later version.
#
#    This software is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#*****************************************************************************

env-update
source /etc/profile
source /root/variables.sh

#Getting the Current Portage Tree
emerge sync

   #Settings in make.conf
   nano -w /etc/make.conf

   #Edit /etc/fstab
   nano -w /etc/fstab

   #Config basic settings
   nano -w /etc/rc.conf

   #Edit /etc/modules.autoload
   nano -w /etc/modules.autoload

   #Edit /etc/conf.d/net
   nano -w /etc/conf.d/net


   #*****************************************************************************
   # Setting time zone
   #*****************************************************************************
   ln -sf ${usertimezone} /etc/localtime
   #*****************************************************************************

#Emerging Kernel Source
emerge $kernelsource
   if [ $? -ne 0 ]
   then
     echo "Error getting kernel sources!!!"
     exit 1
   fi
cd /usr/src/linux
make menuconfig
cp /usr/src/linux/.config /boot/config

#Stage 1
cd /usr/portage
scripts/bootstrap.sh
if [ $? -ne 0 ]
then
  echo "Compile Error!!!"
  exit 1
fi

#Stage 2
emerge system
if [ $? -ne 0 ]
then
  echo "Compile Error!!!"
  exit 1
fi

#*****************************************************************************
# Build kernel
#*****************************************************************************
kernel_dir_check() {
   if [ -d /usr/src/linux-beta ] ; then
      cd /usr/src/linux-beta
      return 0
   elsif [ -d /usr/src/linux ] ; then
      cd /usr/src/linux
      return 0
   else
      echo "No kernel sources found!!!"
      return 1
   fi
}

boot_dir_check() {
   if [ ! -d /boot ] ; then
      echo "No /boot directory found!!!"
      return 1
   else
      return 0
   fi
}

init_default_kernel() {
   kernel_dir_check || exit 1
   make mrproper
   cp /boot/config ./.config
   make oldconfig
   return 0
}

config_kernel() {
   kernel_dir_check || exit 1
   if [ ! -f ./.config ] && init_default_kernel
   boot_dir_check || exit 1
   make menuconfig
   make dep && make clean bzImage modules modules_install
   if [ $? -ne 0 ] ; then
      PS3="Do you want to reconfigure the kernel and try again?: "
      OPTIONS="Yes No"
      echo "Kernel failed to compile."
      select opt in ${OPTIONS}; do
         if [ "${opt}" = "Yes" ]; then
            kernel_dir_check || exit 1
            mv ./.config ../.config
            make mrproper
            mv ../.config ./.config
            config_kernel
            break
         elif [ "${opt}" = "No" ]; then
            echo "Quitting..."
            exit 1
         else
            echo -ne "\033[1A"
         fi
      done
      fi
      boot_dir_check && cp ./arch/i386/boot/bzImage /boot/vmlinuz || exit 1
      return 0
}

config_kernel
#*****************************************************************************

#Emerge system logger
emerge $logger
   if [ $? -ne 0 ]
   then
     echo "Compile Error!!!"
     exit 1
   fi
rc-update add $logger default

#Emerge cron daemon
emerge $cron
   if [ $? -ne 0 ]
   then
     echo "Compile Error!!!"
     exit 1
   fi
rc-update add $cron default
if [ $cron != vcron ]
then
   crontab /etc/crontab
fi

#Emerge rp-pppoe?
if [ $pppoe = true ]
then
   USE="-X" emerge rp-pppoe
   if [ $? -ne 0 ]
   then
     echo "Compile Error!!!"
     exit 1
   fi
fi

#Emerge xfsprogs?
if [ $xfsprogs = true ]
then
   emerge xfsprogs
   if [ $? -ne 0 ]
   then
     echo "Compile Error!!!"
     exit 1
   fi
fi

#Emerge reiserfsprogs?
if [ $reiserfsprogs = true ]
then
   emerge reiserfsprogs
   if [ $? -ne 0 ]
   then
     echo "Compile Error!!!"
     exit 1
   fi
fi

#Emerge jfsutils?
if [ $jfsutils = true ]
then
   emerge jfsutils
   if [ $? -ne 0 ]
   then
     echo "Compile Error!!!"
     exit 1
   fi
fi

#Emerge lvm-user?
if [ $lvm = true ]
then
   emerge lvm-user
   if [ $? -ne 0 ]
   then
     echo "Compile Error!!!"
     exit 1
   fi
fi

#Emerge pcmcia-cs?
if [ $pcmcia = true ]
then
   emerge pcmcia-cs
   if [ $? -ne 0 ]
   then
     echo "Compile Error!!!"
     exit 1
   fi
fi

#Setting root password
passwd

#Setting the Hostname
echo $hostname > /etc/hostname
echo $domain > /etc/dnsdomainname
echo -e "$ip \t $hostname.$domain \t $hostname" >> /etc/hosts

#Load network on boot
rc-update add net.eth0 default

#config bootloader
#Grub needs lots of work
echo -e "default 0 \r timeout 30 \r splashimage=(hd0,0)/boot/grub/splash.xpm.gz \r \r title=Gentoo Linux \r root (hd0,0) \r kernel (hd0,0)/boot/vmlinuz root=$rootpart" > /boot/grub/grub.conf
ln -s /boot/grub/grub.conf /boot/grub/menu.lst

#Install grub to MBR using first hard drive partition as /boot partition
echo -e "root (hd0,0)\r setup (hd0)\r quit\r" | grub --batch
if [ $? -ne 0 ]
then
  echo "Error!!! Grub NOT installed"
  exit 1
fi

#done!
exit 0


and again: i did not tested it! and i only used your code and added my to it (see the lines inbetween #****).

cheers

SteveB
Back to top
View user's profile Send private message
npmccallum
Retired Dev
Retired Dev


Joined: 09 May 2003
Posts: 306
Location: Lexington, KY

PostPosted: Fri May 23, 2003 6:04 am    Post subject: Reply with quote

Is this right? If I understand correctly (and I probably don't), wouldn't this be the logical equivilant of saying "If either p or ~p, then..."?

Code:

if [[ ! -z "${rootpart} || "${rootpart} == "" ]] ; then


If that is the case, then shouldn't it be:

Code:

if [[ -z "${rootpart} || "${rootpart} == "" ]] ; then


Is this redundant? (I'm new at this...)
Back to top
View user's profile Send private message
steveb
Advocate
Advocate


Joined: 18 Sep 2002
Posts: 4564

PostPosted: Fri May 23, 2003 5:43 pm    Post subject: Reply with quote

npmccallum wrote:
Is this right? If I understand correctly (and I probably don't), wouldn't this be the logical equivilant of saying "If either p or ~p, then..."?

Code:

if [[ ! -z "${rootpart} || "${rootpart} == "" ]] ; then


If that is the case, then shouldn't it be:

Code:

if [[ -z "${rootpart} || "${rootpart} == "" ]] ; then


Is this redundant? (I'm new at this...)


the "-z" is for equal null or nothing
the "!" is for a logical not

so the expression "! -z" means: NOT NULL

and i think there i made a error!

because i wanted to say: if ${rootpart} is NULL or ${rootpart is equal to "" then....

so please take the "!" out of the expression.

cheers

SteveB
Back to top
View user's profile Send private message
npmccallum
Retired Dev
Retired Dev


Joined: 09 May 2003
Posts: 306
Location: Lexington, KY

PostPosted: Fri May 23, 2003 6:20 pm    Post subject: Reply with quote

Also for my own understanding... what is the difference between ${rootpart} and $rootpart? any? (what do the "{ and }" do?)
Back to top
View user's profile Send private message
steveb
Advocate
Advocate


Joined: 18 Sep 2002
Posts: 4564

PostPosted: Fri May 23, 2003 8:32 pm    Post subject: Reply with quote

npmccallum wrote:
Also for my own understanding... what is the difference between ${rootpart} and $rootpart? any? (what do the "{ and }" do?)


normaly ${rootpart} is equal to $rootpart. but ${rootpart} is better for reading and avoids errors, by clearly marking a variable.

cheers

SteveB


ps: does the code now work for you? is it okay that way?
Back to top
View user's profile Send private message
npmccallum
Retired Dev
Retired Dev


Joined: 09 May 2003
Posts: 306
Location: Lexington, KY

PostPosted: Fri May 23, 2003 8:40 pm    Post subject: Reply with quote

I am currently bugtesting v0.3. I won't put it up until I can get all the way through an install with it. Unfortunately, installing gentoo takes a LONG TIME... Only to find an error near the end :) Oh well.

What do you think of my 2 options in my previous post (ie precompiled kernel or preset .config file)? Which would you vote for?

I also had another idea... If we extract a stage3 tarball into a mock system (ie. /mnt/kernelconfig/), then emerge the kernel in that environment, run make menuconfig, copy out the .config file, then kill (ie. 'rm -rf /mnt/kernelconfig') the system and proceed with a stage1 tarball, we could successfully custom preconfigure the kernel per installation (also we can do this with 'dialog' cause stage3 is merged). The downside? This is clearly a hack and will take more time. Steve? Your thoughts?
Back to top
View user's profile Send private message
npmccallum
Retired Dev
Retired Dev


Joined: 09 May 2003
Posts: 306
Location: Lexington, KY

PostPosted: Fri May 23, 2003 8:53 pm    Post subject: Reply with quote

ok, I can't figure out this error...

Code:
.bashrc: line 122: syntax error near unexpected token `}'
.bashrc: line 122: `} '


It refers to this the end of this section:
Code:
config_kernel() {
   kernel_dir_check || exit 1
   if [ ! -f ./.config ] && init_default_kernel
   boot_dir_check || exit 1
   make menuconfig
   make dep && make clean bzImage modules modules_install
   if [ $? -ne 0 ] ; then
      PS3="Do you want to reconfigure the kernel and try again?: "
      OPTIONS="Yes No"
      echo "Kernel failed to compile."
      select opt in ${OPTIONS}; do
         if [ "${opt}" = "Yes" ]; then
            kernel_dir_check || exit 1
            mv ./.config ../.config
            make mrproper
            mv ../.config ./.config
            config_kernel
            break
            elif [ "${opt}" = "No" ]; then
            echo "Quitting..."
            exit 1
         else
            echo -ne "\033[1A"
         fi
       done
   fi
   boot_dir_check && cp ./arch/i386/boot/bzImage /boot/vmlinuz || exit 1
   return 0
}
 
config_kernel


Why is this crapping out?[/code]
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Goto page 1, 2, 3 ... 22, 23, 24  Next
Page 1 of 24

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum