From: Eric Edgar Date: Wed, 6 Apr 2005 23:23:57 +0000 (+0000) Subject: change the code to use more case statements. Fix gcc issue in stage1. X-Git-Tag: CATALYST_2_0_6_916~787 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=190928814a8ff86703017a9e542cdacac68981f7;p=catalyst.git change the code to use more case statements. Fix gcc issue in stage1. git-svn-id: svn+ssh://svn.gentoo.org/var/svnroot/catalyst/trunk@588 d1e1f19c-881f-0410-ab34-b69fee027534 --- diff --git a/ChangeLog b/ChangeLog index ce183c3f..cb9a3efc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,14 @@ # ChangeLog for gentoo/src/catalyst # Copyright 2002-2005 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo/src/catalyst/ChangeLog,v 1.208 2005/04/06 14:07:11 wolf31o2 Exp $ +# $Header: /var/cvsroot/gentoo/src/catalyst/ChangeLog,v 1.209 2005/04/06 23:23:57 rocket Exp $ + + 06 Apr 2005; Eric Edgar + targets/livecd-stage1/livecd-stage1-controller.sh, + targets/livecd-stage2/livecd-stage2-controller.sh, + targets/stage1/stage1-preclean-chroot.sh, targets/support/functions.sh, + targets/support/gamecdfs-update.sh, targets/support/livecdfs-update.sh, + targets/support/pre-kmerge.sh: + change the code to use more case statements. Fix gcc issue in stage1. 06 Apr 2005; Chris Gianelloni targets/livecd-stage1/livecd-stage1-controller.sh, diff --git a/targets/livecd-stage1/livecd-stage1-controller.sh b/targets/livecd-stage1/livecd-stage1-controller.sh index 0eed99a0..d5bc6530 100755 --- a/targets/livecd-stage1/livecd-stage1-controller.sh +++ b/targets/livecd-stage1/livecd-stage1-controller.sh @@ -1,6 +1,6 @@ # Copyright 1999-2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo/src/catalyst/targets/livecd-stage1/livecd-stage1-controller.sh,v 1.2 2005/04/06 14:07:11 wolf31o2 Exp $ +# $Header: /var/cvsroot/gentoo/src/catalyst/targets/livecd-stage1/livecd-stage1-controller.sh,v 1.3 2005/04/06 23:23:57 rocket Exp $ . ${clst_sharedir}/targets/support/functions.sh @@ -39,16 +39,6 @@ case $1 in cp ${clst_sharedir}/livecd/files/gentoo.png \ ${clst_chroot_path}/usr/share/faces - # touch /etc/startx if our livecd/type requires it - if [ "${clst_livecd_type}" = "gentoo-release-environmental" ] \ - || [ "${clst_livecd_type}" = "gentoo-gamecd" ] - then - touch ${clst_chroot_path}/etc/startx - fi - - # now, finalize and tweak the livecd fs (inside of the chroot) - exec_in_chroot ${clst_sharedir}/targets/support/livecdfs-update.sh - # execute gamecdfs-update.sh if we're a gamecd if [ "${clst_livecd_type}" = "gentoo-gamecd" ] then @@ -59,10 +49,11 @@ case $1 in echo "gamecd/conf is required for a gamecd!" exit 1 fi - exec_in_chroot ${clst_sharedir}/targets/support/gamecdfs-update.sh - rm -f ${clst_chroot_path}/tmp/gamecd.conf fi + # now, finalize and tweak the livecd fs (inside of the chroot) + exec_in_chroot ${clst_sharedir}/targets/support/livecdfs-update.sh + # if the user has their own fs update script, execute it if [ -n "${clst_livecd_fsscript}" ] then diff --git a/targets/livecd-stage2/livecd-stage2-controller.sh b/targets/livecd-stage2/livecd-stage2-controller.sh index 1bdf9eb1..fa6bedfb 100755 --- a/targets/livecd-stage2/livecd-stage2-controller.sh +++ b/targets/livecd-stage2/livecd-stage2-controller.sh @@ -1,6 +1,6 @@ # Copyright 1999-2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo/src/catalyst/targets/livecd-stage2/livecd-stage2-controller.sh,v 1.2 2005/04/05 21:42:20 rocket Exp $ +# $Header: /var/cvsroot/gentoo/src/catalyst/targets/livecd-stage2/livecd-stage2-controller.sh,v 1.3 2005/04/06 23:23:57 rocket Exp $ . ${clst_sharedir}/targets/support/functions.sh . ${clst_sharedir}/targets/support/filesystem-functions.sh @@ -51,23 +51,22 @@ case $1 in mkdir -p /usr/share/faces cp ${clst_sharedir}/livecd/files/gentoo.png \ ${clst_chroot_path}/usr/share/faces - - # touch /etc/startx if our livecd/type requires it - if [ "${clst_livecd_type}" = "gentoo-release-environmental" ] \ - || [ "${clst_livecd_type}" = "gentoo-gamecd" ] + + # execute copy gamecd.conf if we're a gamecd + if [ "${clst_livecd_type}" = "gentoo-gamecd" ] then - touch ${clst_chroot_path}/etc/startx + if [ -n "${clst_gamecd_conf}" ] + then + cp ${clst_gamecd_conf} ${clst_chroot_path}/tmp/gamecd.conf + else + echo "gamecd/conf is required for a gamecd!" + exit 1 + fi fi - + # now, finalize and tweak the livecd fs (inside of the chroot) exec_in_chroot ${clst_sharedir}/targets/support/livecdfs-update.sh - # execute gamecdfs-update.sh if we're a gamecd - if [ "${clst_livecd_type}" = "gentoo-gamecd" ] - then - exec_in_chroot ${clst_sharedir}/targets/support/gamecdfs-update.sh - fi - # if the user has their own fs update script, execute it if [ -n "${clst_livecd_fsscript}" ] then diff --git a/targets/stage1/stage1-preclean-chroot.sh b/targets/stage1/stage1-preclean-chroot.sh index 87a068b8..b1fdc6ec 100755 --- a/targets/stage1/stage1-preclean-chroot.sh +++ b/targets/stage1/stage1-preclean-chroot.sh @@ -1,19 +1,19 @@ #!/bin/bash # Copyright 1999-2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo/src/catalyst/targets/stage1/stage1-preclean-chroot.sh,v 1.2 2005/04/06 03:02:06 rocket Exp $ +# $Header: /var/cvsroot/gentoo/src/catalyst/targets/stage1/stage1-preclean-chroot.sh,v 1.3 2005/04/06 23:23:57 rocket Exp $ . /tmp/chroot-functions.sh # now, some finishing touches to initialize gcc-config.... unset ROOT -#if [ -x /usr/bin/gcc-config ] -#then -# mythang=$( cd /etc/env.d/gcc; ls ${clst_CHOST}-* | head -n 1 ) -# gcc-config ${mythang}; update_env_settings -#fi - +if [ -x /usr/bin/gcc-config ] +then + mythang=$( cd /etc/env.d/gcc; ls ${clst_CHOST}-* | head -n 1 ) + gcc-config ${mythang}; update_env_settings +fi + # stage1 is not going to have anything in zoneinfo, so save our Factory timezone if [ -d /usr/share/zoneinfo ] ; then rm -f /etc/localtime diff --git a/targets/support/functions.sh b/targets/support/functions.sh index 6a3201ae..bf83a2c6 100755 --- a/targets/support/functions.sh +++ b/targets/support/functions.sh @@ -6,10 +6,13 @@ copy_to_chroot(){ then echo "copying ${file_name} to ${clst_chroot_path}/${2}" cp -a ${1} ${clst_chroot_path}/${2} + chmod 755 ${clst_chroot_path}/${2}/${file_name} else echo "copying ${file_name} to ${clst_chroot_path}/tmp" cp -a ${1} ${clst_chroot_path}/tmp + chmod 755 ${clst_chroot_path}/tmp/${file_name} fi + } delete_from_chroot(){ @@ -23,8 +26,7 @@ exec_in_chroot(){ # and executes it. local file_name=$(basename ${1}) - cp -a ${1} ${clst_chroot_path}/tmp - chmod 755 ${clst_chroot_path}/tmp/${file_name} + copy_to_chroot ${1} ${2}/tmp if [ "${2}" != "" ] then @@ -38,7 +40,7 @@ exec_in_chroot(){ chmod 755 ${chroot_path}/tmp/${file_name} copy_to_chroot ${clst_sharedir}/targets/support/chroot-functions.sh /${2}/tmp echo "Running ${file_name} in chroot ${chroot_path}" - ${clst_CHROOT} ${chroot_path} /tmp/${file_name} || exit 1 + ${clst_CHROOT} ${chroot_path}/ /tmp/${file_name} || exit 1 rm -f ${chroot_path}/tmp/${file_name} delete_from_chroot /${2}/tmp/chroot-functions.sh diff --git a/targets/support/gamecdfs-update.sh b/targets/support/gamecdfs-update.sh index df96cabf..e69de29b 100755 --- a/targets/support/gamecdfs-update.sh +++ b/targets/support/gamecdfs-update.sh @@ -1,17 +0,0 @@ -#!/bin/bash -# Copyright 1999-2004 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 - -# we grab our configuration -source /tmp/gamecd.conf || exit 1 - -# here we replace out game information into several files -sed -i -e "s:livecd:gamecd:" /etc/hosts -sed -i -e "s:##GAME_NAME:${GAME_NAME}:" /etc/motd - -# here we setup our xinitrc -echo "exec ${GAME_EXECUTABLE}" > /etc/X11/xinit/xinitrc - -# we add spind to default here since we don't want the CD to spin down -rc-update add spind default -rc-update add x-setup default diff --git a/targets/support/livecdfs-update.sh b/targets/support/livecdfs-update.sh index b8c98e88..3f067825 100755 --- a/targets/support/livecdfs-update.sh +++ b/targets/support/livecdfs-update.sh @@ -1,7 +1,7 @@ #!/bin/bash # Copyright 1999-2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo/src/catalyst/targets/support/livecdfs-update.sh,v 1.3 2005/04/06 14:07:11 wolf31o2 Exp $ +# $Header: /var/cvsroot/gentoo/src/catalyst/targets/support/livecdfs-update.sh,v 1.4 2005/04/06 23:23:57 rocket Exp $ /usr/sbin/env-update source /etc/profile @@ -15,6 +15,7 @@ fi # turn off udev tarball sed -i 's:RC_DEVICE_TARBALL="yes":RC_DEVICE_TARBALL="no":' /etc/conf.d/rc + # default programs that we always want to start rc-update del iptables default rc-update del netmount default @@ -32,14 +33,16 @@ rc-update add pwgen default [ -e /etc/init.d/alsasound ] && rc-update add alsasound default [ -e /etc/init.d/hdparm ] && rc-update add hdparm default -# Comment out current getty settings -sed -i -e '/^c[0-9]/ s/^/#/' /etc/inittab - -# Add our own getty settings -for x in 1 2 3 4 5 6 -do - echo "c${x}:12345:respawn:/sbin/agetty -nl /bin/bashlogin 38400 tty${x} linux" >> /etc/inittab -done +# Do some livecd_type specific rc-update changes +case ${clst_livecd_type} in + gentoo-gamecd ) + # we add spind to default here since we don't want the CD to spin down + rc-update add spind default + rc-update add x-setup default + ;; + *) + ;; +esac # perform any rcadd then any rcdel if [ -n "${clst_livecd_rcadd}" ] || [ -n "${clst_livecd_rcdel}" ] @@ -61,15 +64,39 @@ then fi fi +# Comment out current getty settings +sed -i -e '/^c[0-9]/ s/^/#/' /etc/inittab + +# Add our own getty settings +for x in 1 2 3 4 5 6 +do + echo "c${x}:12345:respawn:/sbin/agetty -nl /bin/bashlogin 38400 tty${x} linux" >> /etc/inittab +done + +# Do some livecd_type specific inittab changes +case ${clst_livecd_type} in + gnap) + sed -i "s/^#c1:/c1:/" /etc/inittab + sed -i "/^.*bashlogin.*$/ d" /etc/inittab + ;; +esac + # clean up the time and set to UTC rm -rf /etc/localtime cp /usr/share/zoneinfo/UTC /etc/localtime # setup the hostname -echo "livecd" > /etc/hostname -echo "gentoo" > /etc/dnsdomainname -#sed -i 's:localhost:livecd.gentoo localhost:' /etc/hosts -echo "127.0.0.1 livecd.gentoo livecd localhost" > /etc/hosts +case ${clst_livecd_type} in + gnap) + echo "gentoo" > /etc/dnsdomainname + echo "127.0.0.1 livecd.gentoo livecd localhost" > /etc/hosts + ;; + *) + echo "livecd" > /etc/hostname + echo "gentoo" > /etc/dnsdomainname + echo "127.0.0.1 livecd.gentoo livecd localhost" > /etc/hosts + ;; +esac # setup sudoers sed -i '/NOPASSWD: ALL/ s/^# //' /etc/sudoers @@ -137,31 +164,29 @@ mkdir -p /etc/opengl touch /etc/asound.state # tweak the motd for gentoo releases -if [ "${clst_livecd_type}" = "gentoo-release-universal" ] -then - cat /etc/generic.motd.txt /etc/universal.motd.txt \ - /etc/minimal.motd.txt > /etc/motd - sed -i 's:^##GREETING:Welcome to the Gentoo Linux Universal Installation CD!:' /etc/motd -fi - -if [ "${clst_livecd_type}" = "gentoo-release-minimal" ] -then - cat /etc/generic.motd.txt /etc/minimal.motd.txt > /etc/motd - sed -i 's:^##GREETING:Welcome to the Gentoo Linux Minimal Installation CD!:' /etc/motd -fi - -if [ "${clst_livecd_type}" = "gentoo-release-environmental" ] -then - cat /etc/generic.motd.txt /etc/universal.motd.txt \ - /etc/minimal.motd.txt /etc/environmental.motd.txt > /etc/motd - sed -i 's:^##GREETING:Welcome to the Gentoo Linux LiveCD Environment!:' /etc/motd -fi - -if [ "${clst_livecd_type}" = "gentoo-gamecd" ] -then - cat /etc/generic.motd.txt /etc/gamecd.motd.txt > /etc/motd - sed -i 's:^##GREETING:Welcome to the Gentoo Linux ##GAME_NAME GameCD!:' /etc/motd -fi +case ${clst_livecd_type} in + gentoo-release-universal ) + cat /etc/generic.motd.txt /etc/universal.motd.txt \ + /etc/minimal.motd.txt > /etc/motd + sed -i 's:^##GREETING:Welcome to the Gentoo Linux Universal Installation CD!:' /etc/motd + ;; + gentoo-release-minimal ) + cat /etc/generic.motd.txt /etc/minimal.motd.txt > /etc/motd + sed -i 's:^##GREETING:Welcome to the Gentoo Linux Minimal Installation CD!:' /etc/motd + ;; + gentoo-release-environmental ) + cat /etc/generic.motd.txt /etc/universal.motd.txt \ + /etc/minimal.motd.txt /etc/environmental.motd.txt > /etc/motd + sed -i 's:^##GREETING:Welcome to the Gentoo Linux LiveCD Environment!:' /etc/motd + ;; + gentoo-gamecd ) + cat /etc/generic.motd.txt /etc/gamecd.motd.txt > /etc/motd + sed -i 's:^##GREETING:Welcome to the Gentoo Linux ##GAME_NAME GameCD!:' /etc/motd + ;; + * ) + cat /etc/generic.motd.txt /etc/minimal.motd.txt > /etc/motd + sed -i 's:^##GREETING:Welcome to the Gentoo Linux LiveCD!:' /etc/motd +case rm -f /etc/generic.motd.txt /etc/universal.motd.txt /etc/minimal.motd.txt /etc/environmental.motd.txt /etc/gamecd.motd.txt @@ -207,3 +232,28 @@ then mkdir -p /usr/lib/hotplug ln -sf /lib/firmware /usr/lib/hotplug/firmware fi + +# Post configuration +case ${clst_livecd_type} in + gentoo-gamecd ) + # we grab our configuration + if [ -e /tmp/gamecd.conf ] + then + + source /tmp/gamecd.conf || exit 1 + rm /tmp/gamecd.conf + + # here we replace out game information into several files + sed -i -e "s:##GAME_NAME:${GAME_NAME}:" /etc/motd + + # here we setup our xinitrc + echo "exec ${GAME_EXECUTABLE}" > /etc/X11/xinit/xinitrc + fi + + touch /etc/startx + ;; + gentoo-release-environmental ) + touch /etc/startx + ;; +esac + diff --git a/targets/support/pre-kmerge.sh b/targets/support/pre-kmerge.sh index 2a435332..06be88f6 100755 --- a/targets/support/pre-kmerge.sh +++ b/targets/support/pre-kmerge.sh @@ -5,23 +5,16 @@ /usr/sbin/env-update source /etc/profile - - -#if [ "${clst_AUTORESUME}" = "1" -a -e /tmp/.clst_genkernel -a -e "/usr/bin/genkernel" ] -#then -# echo "Autoresume point found not emerging genkernel" -#else -# emerge --oneshot --nodeps -b -k genkernel && touch /tmp/.clst_genkernel || exit 1 -#fi - CONFIG_PROTECT="-*" USE="livecd" emerge --oneshot --nodeps -u genkernel install -d /usr/portage/packages/gk_binaries sed -i 's/uchi-hcd/uhci-hcd/' /usr/share/genkernel/x86/modules_load -if [ "${clst_livecd_type}" = "gentoo-release-minimal" -o \ - "${clst_livecd_type}" = "gentoo-release-universal" ]; then - sed -i 's/initramfs_data.cpio.gz /initramfs_data.cpio.gz -r 1024x768 /'\ - /usr/share/genkernel/genkernel -fi +# Setup case structure for livecd_type +case ${clst_livecd_type} in + gentoo-release-minimal | gentoo-release-universal) + sed -i 's/initramfs_data.cpio.gz /initramfs_data.cpio.gz -r 1024x768 /' /usr/share/genkernel/genkernel + ;; +esac +