From 5ecae4c1b95c47a86b5d913fe262cee47d307626 Mon Sep 17 00:00:00 2001 From: Chris Gianelloni Date: Mon, 19 Dec 2005 16:52:01 +0000 Subject: [PATCH] Fixed up spacing/coding style on support. git-svn-id: svn+ssh://svn.gentoo.org/var/svnroot/catalyst/trunk@980 d1e1f19c-881f-0410-ab34-b69fee027534 --- ChangeLog | 9 +++- targets/support/kill-chroot-pids.sh | 2 +- targets/support/kmerge.sh | 27 +++++------ targets/support/livecdfs-update.sh | 64 ++++++++++++++------------- targets/support/post-kmerge.sh | 13 ++---- targets/support/pre-kmerge.sh | 3 +- targets/support/rc-update.sh | 49 ++++++++++---------- targets/support/target_image_setup.sh | 2 + targets/support/unmerge.sh | 3 +- 9 files changed, 84 insertions(+), 88 deletions(-) diff --git a/ChangeLog b/ChangeLog index d143c5d6..21590949 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,12 @@ # Copyright 2002-2005 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo/src/catalyst/ChangeLog,v 1.467 2005/12/19 15:48:00 rocket Exp $ +# $Header: /var/cvsroot/gentoo/src/catalyst/ChangeLog,v 1.468 2005/12/19 16:52:01 wolf31o2 Exp $ + + 19 Dec 2005; Chris Gianelloni + targets/support/kill-chroot-pids.sh, targets/support/kmerge.sh, + targets/support/livecdfs-update.sh, targets/support/post-kmerge.sh, + targets/support/pre-kmerge.sh, targets/support/rc-update.sh, + targets/support/target_image_setup.sh, targets/support/unmerge.sh: + Fixed up spacing/coding style on support. 19 Dec 2005; Eric Edgar catalyst: Optimize catalyst bytecode and set a sane sys.exit for keyboard interrupts diff --git a/targets/support/kill-chroot-pids.sh b/targets/support/kill-chroot-pids.sh index 8af4fe9e..3418e080 100755 --- a/targets/support/kill-chroot-pids.sh +++ b/targets/support/kill-chroot-pids.sh @@ -17,7 +17,7 @@ fi j=0 declare -a pids -# get files and dirs in /proc +# Get files and dirs in /proc for i in `ls /proc` do # Test for directories diff --git a/targets/support/kmerge.sh b/targets/support/kmerge.sh index 48b5d7a0..afa3fe32 100755 --- a/targets/support/kmerge.sh +++ b/targets/support/kmerge.sh @@ -51,23 +51,22 @@ setup_gk_args() { } genkernel_compile(){ - eval "clst_initramfs_overlay=\$clst_boot_kernel_${clst_kname}_initramfs_overlay" eval "clst_kernel_merge=\$clst_boot_kernel_${clst_kname}_packages" - + setup_gk_args #echo "The GK_ARGS are" #echo ${GK_ARGS} export clst_kernel_merge export clst_initramfs_overlay - # build with genkernel using the set options + # Build with genkernel using the set options # callback is put here to avoid escaping issues if [ -n "${clst_KERNCACHE}" ] then if [ "$clst_kernel_merge" != "" ] then - genkernel --callback="PKGDIR=${PKGDIR} emerge -kb ${clst_kernel_merge}" \ - ${GK_ARGS} || exit 1 + genkernel --callback="PKGDIR=${PKGDIR} emerge -kb \ + ${clst_kernel_merge}" ${GK_ARGS} || exit 1 else genkernel ${GK_ARGS} || exit 1 fi @@ -92,8 +91,6 @@ build_kernel() { genkernel_compile } - - # Script to build each kernel, kernel-related packages /usr/sbin/env-update source /etc/profile @@ -104,7 +101,7 @@ setup_myemergeopts [ -n "${clst_ENVSCRIPT}" ] && source /tmp/envscript export CONFIG_PROTECT="-*" -#set the timezone for the kernel build +# Set the timezone for the kernel build rm /etc/localtime ln -s /usr/share/zoneinfo/UTC /etc/localtime @@ -114,16 +111,13 @@ export USE=$clst_kernel_use eval "clst_kernel_gk_kernargs=\$clst_boot_kernel_${clst_kname}_gk_kernargs" eval "clst_ksource=\$clst_boot_kernel_${clst_kname}_sources" - - -# Don't use pkgcache here, as the kernel source may get emerge with different USE variables -# (and thus different patches enabled/disabled.) Also, there's no real benefit in using the -# pkgcache for kernel source ebuilds. +# Don't use pkgcache here, as the kernel source may get emerged with different +# USE variables (and thus different patches enabled/disabled.) Also, there's no +# real benefit in using the pkgcache for kernel source ebuilds. USE_MATCH=0 if [ -e /usr/portage/packages/gk_binaries/${clst_kname}/${clst_kname}-${clst_version_stamp}.USE ] then - STR1=$(for i in `cat /usr/portage/packages/gk_binaries/${clst_kname}/${clst_kname}-${clst_version_stamp}.USE`; do echo $i; done|sort) STR2=$(for i in ${clst_kernel_use}; do echo $i; done|sort) if [ "${STR1}" = "${STR2}" ] @@ -168,7 +162,6 @@ then #echo "CONFIG match" CONFIG_MATCH=1 fi - fi fi @@ -204,7 +197,8 @@ else USE="${USE} symlink build" emerge "${clst_ksource}" || exit 1 fi -#if catalyst has set to a empty string, extraversion wasn't specified so we skip this part +# If catalyst has set to a empty string, extraversion wasn't specified so we +# skip this part if [ "${EXTRAVERSION_MATCH}" != "1" ] then if [ "${clst_kextraversion}" != "" ] @@ -216,7 +210,6 @@ then touch /usr/portage/packages/gk_binaries/${clst_kname}/${clst_kname}-${clst_version_stamp}.EXTRAVERSION fi fi - build_kernel # grep out the kernel version so that we can do our modules magic diff --git a/targets/support/livecdfs-update.sh b/targets/support/livecdfs-update.sh index aff6a525..9ba84beb 100755 --- a/targets/support/livecdfs-update.sh +++ b/targets/support/livecdfs-update.sh @@ -1,25 +1,27 @@ #!/bin/bash # Copyright 1999-2005 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.30 2005/12/09 19:03:07 wolf31o2 Exp $ +# $Header: /var/cvsroot/gentoo/src/catalyst/targets/support/livecdfs-update.sh,v 1.31 2005/12/19 16:52:01 wolf31o2 Exp $ . /tmp/chroot-functions.sh + update_env_settings -# allow root logins to the livecd by default +# Allow root logins to the livecd by default if [ -e /etc/sshd/sshd_config ] then - sed -i 's:^#PermitRootLogin\ yes:PermitRootLogin\ yes:' /etc/ssh/sshd_config + sed -i 's:^#PermitRootLogin\ yes:PermitRootLogin\ yes:' \ + /etc/ssh/sshd_config fi -# turn off udev tarball +# Turn off udev tarball sed -i 's:RC_DEVICE_TARBALL="yes":RC_DEVICE_TARBALL="no":' /etc/conf.d/rc -# clean up the time and set to UTC +# Clean up the time and set to UTC rm -rf /etc/localtime cp /usr/share/zoneinfo/UTC /etc/localtime -# setup the hostname +# Setup the hostname if [ "${clst_livecd_type}" == "gentoo-gamecd" ] then echo 'HOSTNAME="gamecd"' > /etc/conf.d/hostname @@ -36,7 +38,8 @@ if [ -n "${clst_livecd_users}" ] then for x in ${clst_livecd_users} do - useradd -G users,wheel,audio,games,cdrom,usb -c "Default LiveCD User" -m $x + useradd -G users,wheel,audio,games,cdrom,usb -c "Default LiveCD User" \ + -m $x if [ -n "${clst_livecd_xdm}" -a -n "${clst_livecd_xsession}" ] then echo "[Desktop]" > /home/$x/.dmrc @@ -46,50 +49,51 @@ then done fi -# setup sudoers +# Setup sudoers if [ -f /etc/sudoers ] then sed -i '/NOPASSWD: ALL/ s/^# //' /etc/sudoers fi -# we want the first user to be used when auto-starting X +# We want the first user to be used when auto-starting X if [ -n "${clst_livecd_users}" -a -e /etc/startx ] then first_user=$(echo ${clst_livecd_users} | cut -d' ' -f1) sed -i "s/##STARTX/su - $first_user -c startx/" /root/.bashrc fi -# setup dhcp on all detected ethernet devices +# Setup DHCP on all detected ethernet devices echo "iface_eth0=\"dhcp\""> /etc/conf.d/net echo "iface_eth1=\"dhcp\"" >> /etc/conf.d/net echo "iface_eth2=\"dhcp\"" >> /etc/conf.d/net echo "iface_eth3=\"dhcp\"" >> /etc/conf.d/net echo "iface_eth4=\"dhcp\"" >> /etc/conf.d/net -# setup links for ethernet devices +# Setup links for ethernet devices cd /etc/init.d ln -sf net.eth0 net.eth1 ln -sf net.eth0 net.eth2 ln -sf net.eth0 net.eth3 ln -sf net.eth0 net.eth4 -# add this for hwsetup/mkx86config +# Add this for hwsetup/mkx86config mkdir -p /etc/sysconfig # fstab tweaks echo "tmpfs / tmpfs defaults 0 0" > /etc/fstab echo "tmpfs /lib/firmware tmpfs defaults 0 0" >> /etc/fstab echo "tmpfs /usr/portage tmpfs defaults 0 0" >> /etc/fstab -# if /usr/lib/X11/xkb/compiled then make it tmpfs +# If /usr/lib/X11/xkb/compiled then make it tmpfs if [ -d /usr/lib/X11/xkb/compiled ] then - echo "tmpfs /usr/lib/X11/xkb/compiled tmpfs defaults 0 0" >> /etc/fstab + echo "tmpfs /usr/lib/X11/xkb/compiled tmpfs defaults 0 0" >> \ + /etc/fstab fi # devfs tweaks [ -e /etc/devfsd.conf ] && sed -i '/dev-state/ s:^:#:' /etc/devfsd.conf -# tweak the livecd fstab so that users know not to edit it +# Tweak the livecd fstab so that users know not to edit it # http://bugs.gentoo.org/show_bug.cgi?id=60887 mv /etc/fstab /etc/fstab.old echo "####################################################" >> /etc/fstab @@ -99,7 +103,7 @@ echo "####################################################" >> /etc/fstab cat /etc/fstab.old >> /etc/fstab rm /etc/fstab.old -# add some helpful aliases +# Add some helpful aliases echo "alias cp='cp -i'" >> /etc/profile echo "alias mv='mv -i'" >> /etc/profile echo "alias rm='rm -i'" >> /etc/profile @@ -107,7 +111,7 @@ echo "alias ls='ls --color=auto'" >> /etc/profile echo "alias ll='ls -l'" >> /etc/profile echo "alias grep='grep --color=auto'" >> /etc/profile -# make sure we have the latest pci,usb and hotplug ids +# Make sure we have the latest pci,usb and hotplug ids [ -x /sbin/update-pciids ] && /sbin/update-pciids [ -x /sbin/update-usbids ] && /sbin/update-usbids if [ -d /usr/share/hwdata ] @@ -118,7 +122,7 @@ then ln -s /usr/share/misc/usb.ids /usr/share/hwdata/usb.ids fi -# setup opengl in /etc (if configured) +# Setup opengl in /etc (if configured) [ -x /usr/sbin/openglify ] && /usr/sbin/openglify # Setup configured display manager @@ -139,7 +143,7 @@ fi # touch /etc/asound.state touch /etc/asound.state -# tweak the motd for gentoo releases +# Tweak the MOTD for Gentoo releases case ${clst_livecd_type} in gentoo-release-universal ) cat /etc/generic.motd.txt /etc/universal.motd.txt \ @@ -163,20 +167,22 @@ esac rm -f /etc/generic.motd.txt /etc/universal.motd.txt /etc/minimal.motd.txt /etc/livecd.motd.txt /etc/gamecd.motd.txt -# setup splash/bootsplash (if called for) -if [ "${clst_livecd_splash_type}" == "bootsplash" -a -n "${clst_livecd_splash_theme}" ] +# Setup splash/bootsplash (if called for) +if [ "${clst_livecd_splash_type}" == "bootsplash" -a -n \ + "${clst_livecd_splash_theme}" ] then if [ -d /etc/bootsplash/${clst_livecd_splash_theme} ] then sed -i 's:BOOTSPLASH_THEME=\"gentoo\":BOOTSPLASH_THEME=\"${clst_livecd_splash_theme}\":' /etc/conf.d/bootsplash rm -f /etc/bootsplash/default - ln -s "/etc/bootsplash/${clst_livecd_splash_theme}" /etc/bootsplash/default + ln -s "/etc/bootsplash/${clst_livecd_splash_theme}" \ + /etc/bootsplash/default else echo "Error, cannot setup bootsplash theme ${clst_livecd_splash_theme}" exit 1 fi - -elif [ "${clst_livecd_splash_type}" == "gensplash" -a -n "${clst_livecd_splash_theme}" ] +elif [ "${clst_livecd_splash_type}" == "gensplash" -a -n \ + "${clst_livecd_splash_theme}" ] then if [ -d /etc/splash/${clst_livecd_splash_theme} ] then @@ -207,7 +213,6 @@ then ln -sf /lib/firmware /usr/lib/hotplug/firmware fi - # Clear out locales case ${clst_livecd_type} in gentoo-release-minimal|gentoo-release-universal|gentoo-gamecd) @@ -218,17 +223,16 @@ esac # Post configuration case ${clst_livecd_type} in gentoo-gamecd ) - # we grab our configuration + # 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 + # Here we replace out game information into several files sed -i -e "s:##GAME_NAME:${GAME_NAME}:" /etc/motd - # here we setup our xinitrc + # Here we setup our xinitrc echo "exec ${GAME_EXECUTABLE}" > /etc/X11/xinit/xinitrc fi @@ -240,7 +244,7 @@ case ${clst_livecd_type} in touch /etc/startx ;; gentoo-release-livecd ) - # first we setup the livecd-kernel package + # First we setup the livecd-kernel package if [ -e /opt/installer/misc/mkvardb ] then chmod +x /opt/installer/misc/mkvardb diff --git a/targets/support/post-kmerge.sh b/targets/support/post-kmerge.sh index a21dd750..11ddcdea 100755 --- a/targets/support/post-kmerge.sh +++ b/targets/support/post-kmerge.sh @@ -2,8 +2,9 @@ # Copyright 1999-2005 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -/usr/sbin/env-update -source /etc/profile +. /tmp/chroot-functions.sh + +update_env_settings # Only run depscan.sh if modules exist if [ -n "$(ls /lib/modules)" ] @@ -11,11 +12,3 @@ then /sbin/depscan.sh find /lib/modules -name modules.dep -exec touch {} \; fi - -#case ${clst_mainarch} in -# mips) ;; -# *) -# /sbin/depscan.sh -# find /lib/modules -name modules.dep -exec touch {} \; -# ;; -#esac diff --git a/targets/support/pre-kmerge.sh b/targets/support/pre-kmerge.sh index e8ee8127..8a31343a 100755 --- a/targets/support/pre-kmerge.sh +++ b/targets/support/pre-kmerge.sh @@ -3,9 +3,8 @@ # Distributed under the terms of the GNU General Public License v2 . /tmp/chroot-functions.sh -/usr/sbin/env-update -. /etc/profile +update_env_settings export USE="livecd" run_emerge --oneshot genkernel diff --git a/targets/support/rc-update.sh b/targets/support/rc-update.sh index d4a7a619..f22ec754 100644 --- a/targets/support/rc-update.sh +++ b/targets/support/rc-update.sh @@ -42,39 +42,38 @@ then esac fi -# perform any rcadd then any rcdel +# Perform any rcadd then any rcdel if [ -n "${clst_rcadd}" ] || [ -n "${clst_rcdel}" ] then if [ -n "${clst_rcadd}" ] then - for x in ${clst_rcadd} - do - echo "Adding ${x%%|*} to ${x##*|}" - if [ ! -d /etc/runlevels/${x%%|*} ] - then - echo "Runlevel ${x##*|} doesn't exist .... creating it" - mkdir -p "/etc/runlevels/${x##*|}" - fi - rc-update add "${x%%|*}" "${x##*|}" - done + for x in ${clst_rcadd} + do + echo "Adding ${x%%|*} to ${x##*|}" + if [ ! -d /etc/runlevels/${x%%|*} ] + then + echo "Runlevel ${x##*|} doesn't exist .... creating it" + mkdir -p "/etc/runlevels/${x##*|}" + fi + rc-update add "${x%%|*}" "${x##*|}" + done fi if [ -n "${clst_rcdel}" ] then - for x in ${clst_rcdel} - do - rc-update del "${x%%|*}" "${x##*|}" - done - for x in $(ls /etc/runlevels) - do - CONTENTS=$(find /etc/runlevels/${x} -type f) - if [ -z "${CONTENTS}" ] - then - echo "${x}: Empty runlevel found.... deleting" - rmdir "/etc/runlevels/${x}" - fi - done - + for x in ${clst_rcdel} + do + rc-update del "${x%%|*}" "${x##*|}" + done + for x in $(ls /etc/runlevels) + do + CONTENTS=$(find /etc/runlevels/${x} -type f) + if [ -z "${CONTENTS}" ] + then + echo "${x}: Empty runlevel found.... deleting" + rmdir "/etc/runlevels/${x}" + fi + done fi fi diff --git a/targets/support/target_image_setup.sh b/targets/support/target_image_setup.sh index 13cb1447..bee6e08f 100755 --- a/targets/support/target_image_setup.sh +++ b/targets/support/target_image_setup.sh @@ -1,5 +1,6 @@ # Copyright 1999-2005 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 + . ${clst_sharedir}/targets/support/functions.sh . ${clst_sharedir}/targets/support/filesystem-functions.sh @@ -37,6 +38,7 @@ case ${clst_fstype} in loopret=$? ;; esac + if [ ${loopret} = "1" ] then die "Filesystem not setup" diff --git a/targets/support/unmerge.sh b/targets/support/unmerge.sh index 5dc4d5be..345c551a 100644 --- a/targets/support/unmerge.sh +++ b/targets/support/unmerge.sh @@ -1,6 +1,6 @@ # Copyright 1999-2005 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo/src/catalyst/targets/support/unmerge.sh,v 1.2 2005/12/09 19:03:07 wolf31o2 Exp $ +# $Header: /var/cvsroot/gentoo/src/catalyst/targets/support/unmerge.sh,v 1.3 2005/12/19 16:52:01 wolf31o2 Exp $ source /tmp/chroot-functions.sh @@ -8,5 +8,4 @@ source /tmp/chroot-functions.sh update_env_settings run_emerge -C "${clst_packages}" - exit 0 -- 2.26.2