From f9cd3d84ca2cdefd485718512efed1cfb2840f55 Mon Sep 17 00:00:00 2001 From: Chris Gianelloni Date: Fri, 16 Dec 2005 18:57:57 +0000 Subject: [PATCH] Removing extra line from x86.py, fixing up comments, spacing, and coding style in targets/support through functions.sh git-svn-id: svn+ssh://svn.gentoo.org/var/svnroot/catalyst/trunk@971 d1e1f19c-881f-0410-ab34-b69fee027534 --- ChangeLog | 9 +- arch/x86.py | 4 +- targets/support/bootloader-setup.sh | 4 +- targets/support/chroot-functions.sh | 31 +++-- targets/support/create-iso.sh | 157 +++++++++++++++++------- targets/support/filesystem-functions.sh | 61 +++++---- targets/support/functions.sh | 62 +++++----- 7 files changed, 202 insertions(+), 126 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5a405c68..9523489e 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.458 2005/12/16 14:53:29 rocket Exp $ +# $Header: /var/cvsroot/gentoo/src/catalyst/ChangeLog,v 1.459 2005/12/16 18:57:57 wolf31o2 Exp $ + + 16 Dec 2005; Chris Gianelloni arch/x86.py, + targets/support/bootloader-setup.sh, targets/support/chroot-functions.sh, + targets/support/create-iso.sh, targets/support/filesystem-functions.sh, + targets/support/functions.sh: + Removing extra line from x86.py, fixing up comments, spacing, and coding + style in targets/support through functions.sh 16 Dec 2005; Eric Edgar modules/generic_stage_target.py, modules/livecd_stage2_target.py: diff --git a/arch/x86.py b/arch/x86.py index d9112715..6ac90b84 100644 --- a/arch/x86.py +++ b/arch/x86.py @@ -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/arch/x86.py,v 1.20 2005/10/11 22:26:17 wolf31o2 Exp $ +# $Header: /var/cvsroot/gentoo/src/catalyst/arch/x86.py,v 1.21 2005/12/16 18:57:57 wolf31o2 Exp $ import builder,os from catalyst_support import * @@ -87,4 +87,4 @@ def register(foo): "Inform main catalyst program of the contents of this plugin." foo.update({"pentium4":arch_pentium4,"x86":arch_x86,"i386":arch_i386,"i486":arch_i486,"i586":arch_i586,"i686":arch_i686,"athlon":arch_athlon, "athlon-xp":arch_athlon_xp,"athlon-mp":arch_athlon_xp,"pentium3":arch_pentium3,"pentium-mmx":arch_pentium_mmx}) - + diff --git a/targets/support/bootloader-setup.sh b/targets/support/bootloader-setup.sh index 8532c56c..8543d48d 100755 --- a/targets/support/bootloader-setup.sh +++ b/targets/support/bootloader-setup.sh @@ -1,7 +1,7 @@ #!/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/bootloader-setup.sh,v 1.21 2005/12/11 20:34:42 rocket Exp $ +# $Header: /var/cvsroot/gentoo/src/catalyst/targets/support/bootloader-setup.sh,v 1.22 2005/12/16 18:57:57 wolf31o2 Exp $ . ${clst_sharedir}/targets/support/functions.sh . ${clst_sharedir}/targets/support/filesystem-functions.sh @@ -34,7 +34,6 @@ case ${clst_mainarch} in ((bctr=${bctr}+1)) done ;; - arm) ;; hppa) @@ -164,7 +163,6 @@ case ${clst_mainarch} in for x in ${clst_boot_kernel} do - eval custom_kopts=\$${x}_kernelopts echo "APPENDING CUSTOM KERNEL ARGS: ${custom_kopts}" echo >> ${icfg} diff --git a/targets/support/chroot-functions.sh b/targets/support/chroot-functions.sh index 6e4c84e3..404f4949 100755 --- a/targets/support/chroot-functions.sh +++ b/targets/support/chroot-functions.sh @@ -35,7 +35,6 @@ check_genkernel_version(){ } setup_myfeatures(){ - if [ -n "${clst_CCACHE}" ] then export clst_myfeatures="${clst_myfeatures} ccache" @@ -74,9 +73,8 @@ setup_myemergeopts(){ setup_portage(){ - # portage needs to be merged manually with USE="build" set to avoid frying our - # make.conf. emerge system could merge it otherwise. - + # portage needs to be merged manually with USE="build" set to avoid frying + # our make.conf. emerge system could merge it otherwise. if [ "${clst_AUTORESUME}" = "1" -a -e /tmp/.clst_portage ] then echo "Portage Autoresume point found not emerging portage" @@ -135,7 +133,6 @@ make_destpath() { } run_emerge() { - # Sets up the ROOT= parameter # with no options ROOT=/ make_destpath ${clst_root_path} @@ -173,11 +170,9 @@ run_emerge() { # Functions # Copy libs of a executable in the chroot function copy_libs() { - # Check if it's a dynamix exec - ldd ${1} > /dev/null 2>&1 || return - + for lib in `ldd ${1} | awk '{ print $3 }'` do echo ${lib} @@ -186,7 +181,9 @@ function copy_libs() { if [ ! -e ${clst_root_path}/${lib} ] then copy_file ${lib} - [ -e "${clst_root_path}/${lib}" ] && strip -R .comment -R .note ${clst_root_path}/${lib} || echo "WARNING : Cannot strip lib ${clst_root_path}/${lib} !" + [ -e "${clst_root_path}/${lib}" ] && \ + strip -R .comment -R .note ${clst_root_path}/${lib} \ + || echo "WARNING : Cannot strip lib ${clst_root_path}/${lib} !" fi else echo "WARNING : Some library was not found for ${lib} !" @@ -195,7 +192,6 @@ function copy_libs() { } function copy_symlink() { - STACK=${2} [ "${STACK}" = "" ] && STACK=16 || STACK=$((${STACK} - 1 )) @@ -205,8 +201,10 @@ function copy_symlink() { return fi - [ ! -e ${clst_root_path}/`dirname ${1}` ] && mkdir -p ${clst_root_path}/`dirname ${1}` - [ ! -e ${clst_root_path}/${1} ] && cp -vfdp ${1} ${clst_root_path}/${1} + [ ! -e ${clst_root_path}/`dirname ${1}` ] && \ + mkdir -p ${clst_root_path}/`dirname ${1}` + [ ! -e ${clst_root_path}/${1} ] && \ + cp -vfdp ${1} ${clst_root_path}/${1} TARGET=`readlink -f ${1}` if [ -h ${TARGET} ] @@ -215,10 +213,9 @@ function copy_symlink() { else copy_file ${TARGET} fi - } +} function copy_file() { - f="${1}" if [ ! -e "${f}" ] @@ -227,8 +224,10 @@ function copy_file() { continue fi - [ ! -e ${clst_root_path}/`dirname ${f}` ] && mkdir -p ${clst_root_path}/`dirname ${f}` - [ ! -e ${clst_root_path}/${f} ] && cp -vfdp ${f} ${clst_root_path}/${f} + [ ! -e ${clst_root_path}/`dirname ${f}` ] && \ + mkdir -p ${clst_root_path}/`dirname ${f}` + [ ! -e ${clst_root_path}/${f} ] && \ + cp -vfdp ${f} ${clst_root_path}/${f} if [ -x ${f} -a ! -h ${f} ] then copy_libs ${f} diff --git a/targets/support/create-iso.sh b/targets/support/create-iso.sh index a2cb3b39..eb3f6401 100755 --- a/targets/support/create-iso.sh +++ b/targets/support/create-iso.sh @@ -1,6 +1,7 @@ +#!/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/create-iso.sh,v 1.18 2005/11/30 21:34:03 wolf31o2 Exp $ +# $Header: /var/cvsroot/gentoo/src/catalyst/targets/support/create-iso.sh,v 1.19 2005/12/16 18:57:57 wolf31o2 Exp $ . ${clst_sharedir}/targets/support/functions.sh . ${clst_sharedir}/targets/support/filesystem-functions.sh @@ -8,13 +9,19 @@ # Check for our CD ISO creation tools case ${clst_mainarch} in - mips) cdmaker="sgibootcd"; cdmakerpkg="sys-boot/sgibootcd" ;; - *) cdmaker="mkisofs"; cdmakerpkg="app-cdr/cdrtools" ;; + mips) + cdmaker="sgibootcd" + cdmakerpkg="sys-boot/sgibootcd" + ;; + *) + cdmaker="mkisofs" + cdmakerpkg="app-cdr/cdrtools" + ;; esac [ ! -f /usr/bin/${cdmaker} ] \ - && echo && echo \ - && die "!!! /usr/bin/${cdmaker} is not found. Have you merged ${cdmakerpkg}?" \ + && echo && echo && die \ + "!!! /usr/bin/${cdmaker} is not found. Have you merged ${cdmakerpkg}?" \ && echo && echo # If not volume ID is set, make up a sensible default @@ -75,13 +82,17 @@ case ${clst_mainarch} in case ${clst_fstype} in zisofs) echo "Running mkisofs to create iso image...." - echo "mkisofs -J -R -l -z -V \"${clst_iso_volume_id}\" -o ${1} ${clst_target_path}" - mkisofs -J -R -l -z -V "${clst_iso_volume_id}" -o ${1} ${clst_target_path} || die "Cannot make ISO image" + echo "mkisofs -J -R -l -z -V \"${clst_iso_volume_id}\" -o \ + ${1} ${clst_target_path}" + mkisofs -J -R -l -z -V "${clst_iso_volume_id}" -o ${1} \ + ${clst_target_path} || die "Cannot make ISO image" ;; *) echo "Running mkisofs to create iso image...." - echo "mkisofs -J -R -l -V \"${clst_iso_volume_id}\" -o ${1} ${clst_target_path}" - mkisofs -J -R -l -V "${clst_iso_volume_id}" -o ${1} ${clst_target_path} || die "Cannot make ISO image" + echo "mkisofs -J -R -l -V \"${clst_iso_volume_id}\" -o ${1} \ + ${clst_target_path}" + mkisofs -J -R -l -V "${clst_iso_volume_id}" -o ${1} \ + ${clst_target_path} || die "Cannot make ISO image" ;; esac isomarkboot ${1} /boot/bootlx @@ -92,13 +103,17 @@ case ${clst_mainarch} in case ${clst_livecd_cdfstype} in zisofs) echo "Running mkisofs to create iso image...." - echo "mkisofs -J -R -l -z -V \"${clst_iso_volume_id}\" -o ${1} ${clst_target_path}" - mkisofs -J -R -l -z -V "${clst_iso_volume_id}" -o ${1} ${clst_target_path} || die "Cannot make ISO image" + echo "mkisofs -J -R -l -z -V \"${clst_iso_volume_id}\" -o \ + ${1} ${clst_target_path}" + mkisofs -J -R -l -z -V "${clst_iso_volume_id}" -o ${1} \ + ${clst_target_path} || die "Cannot make ISO image" ;; *) echo "Running mkisofs to create iso image...." - echo "mkisofs -J -R -l -V \"${clst_iso_volume_id}\" -o ${1} ${clst_target_path}" - mkisofs -J -R -l -V "${clst_iso_volume_id}" -o ${1} ${clst_target_path} || die "Cannot make ISO image" + echo "mkisofs -J -R -l -V \"${clst_iso_volume_id}\" -o ${1} \ + ${clst_target_path}" + mkisofs -J -R -l -V "${clst_iso_volume_id}" -o ${1} \ + ${clst_target_path} || die "Cannot make ISO image" ;; esac palo -f boot/palo.conf -C ${1} @@ -107,13 +122,29 @@ case ${clst_mainarch} in case ${clst_livecd_cdfstype} in zisofs) echo "Running mkisofs to create iso image...." - echo "mkisofs -J -r -l -z -chrp-boot -netatalk -hfs -probe -map ${clst_target_path}/boot/map.hfs -part -no-desktop -hfs-volid \"${clst_iso_volume_id}\" -hfs-bless ${clst_target_path}/boot -V \"${clst_iso_volume_id}\" -o ${1} ${clst_target_path}" - mkisofs -J -r -l -z -chrp-boot -netatalk -hfs -probe -map ${clst_target_path}/boot/map.hfs -part -no-desktop -hfs-volid "${clst_iso_volume_id}" -hfs-bless ${clst_target_path}/boot -V "${clst_iso_volume_id}" -o ${1} ${clst_target_path} || die "Cannot make ISO image" + echo "mkisofs -J -r -l -z -chrp-boot -netatalk -hfs -probe \ + -map ${clst_target_path}/boot/map.hfs -part -no-desktop \ + -hfs-volid \"${clst_iso_volume_id}\" -hfs-bless \ + ${clst_target_path}/boot -V \"${clst_iso_volume_id}\" -o \ + ${1} ${clst_target_path}" + mkisofs -J -r -l -z -chrp-boot -netatalk -hfs -probe -map \ + ${clst_target_path}/boot/map.hfs -part -no-desktop \ + -hfs-volid "${clst_iso_volume_id}" -hfs-bless \ + ${clst_target_path}/boot -V "${clst_iso_volume_id}" -o \ + ${1} ${clst_target_path} || die "Cannot make ISO image" ;; *) echo "Running mkisofs to create iso image...." - echo "mkisofs -J -r -l -chrp-boot -netatalk -hfs -probe -map ${clst_target_path}/boot/map.hfs -part -no-desktop -hfs-volid \"${clst_iso_volume_id}\" -hfs-bless ${clst_target_path}/boot -V \"${clst_iso_volume_id}\" -o ${1} ${clst_target_path}" - mkisofs -J -r -l -chrp-boot -netatalk -hfs -probe -map ${clst_target_path}/boot/map.hfs -part -no-desktop -hfs-volid "${clst_iso_volume_id}" -hfs-bless ${clst_target_path}/boot -V "${clst_iso_volume_id}" -o ${1} ${clst_target_path} || die "Cannot make ISO image" + echo "mkisofs -J -r -l -chrp-boot -netatalk -hfs -probe -map \ + ${clst_target_path}/boot/map.hfs -part -no-desktop \ + -hfs-volid \"${clst_iso_volume_id}\" -hfs-bless \ + ${clst_target_path}/boot -V \"${clst_iso_volume_id}\" -o \ + ${1} ${clst_target_path}" + mkisofs -J -r -l -chrp-boot -netatalk -hfs -probe -map \ + ${clst_target_path}/boot/map.hfs -part -no-desktop \ + -hfs-volid "${clst_iso_volume_id}" -hfs-bless \ + ${clst_target_path}/boot -V "${clst_iso_volume_id}" -o \ + ${1} ${clst_target_path} || die "Cannot make ISO image" ;; esac ;; @@ -126,22 +157,27 @@ case ${clst_mainarch} in case ${clst_livecd_cdfstype} in zisofs) echo "Running mkisofs.sparc.fu to create iso image...." - echo "/tmp/mkisofs.sparc.fu -z -o ${1} -D -r -pad -quiet -S 'boot/cd.b' -B '/boot/second.b' -s '/boot/silo.conf'" + echo "/tmp/mkisofs.sparc.fu -z -o ${1} -D -r -pad -quiet -S \ + 'boot/cd.b' -B '/boot/second.b' -s '/boot/silo.conf'" echo "-V \"${clst_iso_volume_id}\" ${clst_target_path}" - /tmp/mkisofs.sparc.fu -z -o ${1} -D -r -pad -quiet -S 'boot/cd.b' -B '/boot/second.b' -s '/boot/silo.conf'\ - -V "${clst_iso_volume_id}" ${clst_target_path} || die "Cannot make ISO image" + /tmp/mkisofs.sparc.fu -z -o ${1} -D -r -pad -quiet -S 'boot/cd.b' \ + -B '/boot/second.b' -s '/boot/silo.conf'\ + -V "${clst_iso_volume_id}" ${clst_target_path} \ + || die "Cannot make ISO image" ;; *) echo "Running mkisofs.sparc.fu to create iso image...." - echo "/tmp/mkisofs.sparc.fu -o ${1} -D -r -pad -quiet -S 'boot/cd.b' -B '/boot/second.b' -s '/boot/silo.conf'" + echo "/tmp/mkisofs.sparc.fu -o ${1} -D -r -pad -quiet -S \ + 'boot/cd.b' -B '/boot/second.b' -s '/boot/silo.conf'" echo "-V \"${clst_iso_volume_id}\" ${clst_target_path}" - /tmp/mkisofs.sparc.fu -o ${1} -D -r -pad -quiet -S 'boot/cd.b' -B '/boot/second.b' -s '/boot/silo.conf'\ - -V "${clst_iso_volume_id}" ${clst_target_path} || die "Cannot make ISO image" + /tmp/mkisofs.sparc.fu -o ${1} -D -r -pad -quiet -S 'boot/cd.b' \ + -B '/boot/second.b' -s '/boot/silo.conf'\ + -V "${clst_iso_volume_id}" ${clst_target_path} \ + || die "Cannot make ISO image" ;; esac rm /tmp/mkisofs.sparc.fu - ;; ia64) if [ ! -e ${clst_target_path}/gentoo.efimg ] @@ -150,26 +186,32 @@ case ${clst_mainarch} in iaSizeB=$(echo ${iaSizeTemp} | cut '-d ' -f1) iaSize=$((${iaSizeB}+32)) # Add slack - dd if=/dev/zero of=${clst_target_path}/gentoo.efimg bs=1k count=${iaSize} + dd if=/dev/zero of=${clst_target_path}/gentoo.efimg bs=1k \ + count=${iaSize} mkdosfs -F 16 -n GENTOO ${clst_target_path}/gentoo.efimg mkdir ${clst_target_path}/gentoo.efimg.mountPoint - mount -t vfat -o loop ${clst_target_path}/gentoo.efimg ${clst_target_path}/gentoo.efimg.mountPoint + mount -t vfat -o loop ${clst_target_path}/gentoo.efimg \ + ${clst_target_path}/gentoo.efimg.mountPoint echo '>> Populating EFI image...' - cp -av ${clst_target_path}/boot/* ${clst_target_path}/gentoo.efimg.mountPoint + cp -pPRv ${clst_target_path}/boot/* \ + ${clst_target_path}/gentoo.efimg.mountPoint umount ${clst_target_path}/gentoo.efimg.mountPoint rmdir ${clst_target_path}/gentoo.efimg.mountPoint else - echo ">> Found populated EFI image at ${clst_target_path}/gentoo.efimg" + echo ">> Found populated EFI image at \ + ${clst_target_path}/gentoo.efimg" fi echo '>> Removing /boot...' rm -rf ${clst_target_path}/boot echo '>> Generating ISO...' - echo "mkisofs -J -R -l -V \"${clst_iso_volume_id}\" -o ${1} -b gentoo.efimg -c boot.cat -no-emul-boot ${clst_target_path}" - mkisofs -J -R -l -V "${clst_iso_volume_id}" -o ${1} -b gentoo.efimg -c boot.cat -no-emul-boot \ + echo "mkisofs -J -R -l -V \"${clst_iso_volume_id}\" -o ${1} -b \ + gentoo.efimg -c boot.cat -no-emul-boot ${clst_target_path}" + mkisofs -J -R -l -V "${clst_iso_volume_id}" -o ${1} -b gentoo.efimg -c \ + boot.cat -no-emul-boot \ ${clst_target_path} || die "Cannot make ISO image" ;; x86|amd64) @@ -187,12 +229,24 @@ case ${clst_mainarch} in case ${clst_fstype} in zisofs) - echo "mkisofs -J -R -l -V \"${clst_iso_volume_id}\" -o ${1} -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -z ${clst_target_path}" - mkisofs -J -R -l -V "${clst_iso_volume_id}" -o ${1} -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -z ${clst_target_path} || die "Cannot make ISO image" + echo "mkisofs -J -R -l -V \"${clst_iso_volume_id}\" -o \ + ${1} -b isolinux/isolinux.bin -c isolinux/boot.cat \ + -no-emul-boot -boot-load-size 4 -boot-info-table -z \ + ${clst_target_path}" + mkisofs -J -R -l -V "${clst_iso_volume_id}" -o ${1} -b \ + isolinux/isolinux.bin -c isolinux/boot.cat \ + -no-emul-boot -boot-load-size 4 -boot-info-table -z \ + ${clst_target_path} || die "Cannot make ISO image" ;; *) - echo "mkisofs -J -R -l -V \"${clst_iso_volume_id}\" -o ${1} -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table ${clst_target_path}" - mkisofs -J -R -l -V "${clst_iso_volume_id}" -o ${1} -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table ${clst_target_path} || die "Cannot make ISO image" + echo "mkisofs -J -R -l -V \"${clst_iso_volume_id}\" -o \ + ${1} -b isolinux/isolinux.bin -c isolinux/boot.cat \ + -no-emul-boot -boot-load-size 4 -boot-info-table \ + ${clst_target_path}" + mkisofs -J -R -l -V "${clst_iso_volume_id}" -o ${1} -b \ + isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot \ + -boot-load-size 4 -boot-info-table ${clst_target_path} \ + || die "Cannot make ISO image" ;; esac elif [ -e ${clst_target_path}/boot/grub/stage2_eltorito ] @@ -200,30 +254,43 @@ case ${clst_mainarch} in echo "Creating ISO using GRUB bootloader" case ${clst_fstype} in zisofs) - echo "mkisofs -J -R -l -V \"${clst_iso_volume_id}\" -o ${1} -b boot/grub/stage2_eltorito -c boot/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -z ${clst_target_path}" - mkisofs -J -R -l -V "${clst_iso_volume_id}" -o ${1} -b boot/grub/stage2_eltorito -c boot/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -z ${clst_target_path} || die "Cannot make ISO image" + echo "mkisofs -J -R -l -V \"${clst_iso_volume_id}\" -o \ + ${1} -b boot/grub/stage2_eltorito -c boot/boot.cat \ + -no-emul-boot -boot-load-size 4 -boot-info-table -z \ + ${clst_target_path}" + mkisofs -J -R -l -V "${clst_iso_volume_id}" -o ${1} -b \ + boot/grub/stage2_eltorito -c boot/boot.cat \ + -no-emul-boot -boot-load-size 4 -boot-info-table -z \ + ${clst_target_path} || die "Cannot make ISO image" ;; *) - echo "mkisofs -J -R -l -V \"${clst_iso_volume_id}\" -o ${1} -b boot/grub/stage2_eltorito -c boot/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table ${clst_target_path}" - mkisofs -J -R -l -V "${clst_iso_volume_id}" -o ${1} -b boot/grub/stage2_eltorito -c boot/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table ${clst_target_path} || die "Cannot make ISO image" + echo "mkisofs -J -R -l -V \"${clst_iso_volume_id}\" -o \ + ${1} -b boot/grub/stage2_eltorito -c boot/boot.cat \ + -no-emul-boot -boot-load-size 4 -boot-info-table \ + ${clst_target_path}" + mkisofs -J -R -l -V "${clst_iso_volume_id}" -o ${1} -b \ + boot/grub/stage2_eltorito -c boot/boot.cat \ + -no-emul-boot -boot-load-size 4 -boot-info-table \ + ${clst_target_path} || die "Cannot make ISO image" ;; esac else case ${clst_fstype} in zisofs) - echo "mkisofs -J -R -l -V \"${clst_iso_volume_id}\" -o ${1} -z ${clst_target_path}" + echo "mkisofs -J -R -l -V \"${clst_iso_volume_id}\" -o \ + ${1} -z ${clst_target_path}" mkisofs -J -R -l -V "${clst_iso_volume_id}" -o ${1} \ - -z ${clst_target_path} || die "Cannot make ISO image" + -z ${clst_target_path} || die "Cannot make ISO image" ;; *) - echo "mkisofs -J -R -l -V \"${clst_iso_volume_id}\" -o ${1} ${clst_target_path}" + echo "mkisofs -J -R -l -V \"${clst_iso_volume_id}\" -o \ + ${1} ${clst_target_path}" mkisofs -J -R -l -V "${clst_iso_volume_id}" -o ${1} \ - ${clst_target_path} || die "Cannot make ISO image" + ${clst_target_path} || die "Cannot make ISO image" ;; esac fi ;; - mips) case ${clst_fstype} in normal) @@ -255,10 +322,10 @@ case ${clst_mainarch} in echo -e "p8=#dvh" >> ${cfg} echo -e "p10=#volume" >> ${cfg} - # All done; feed the config to sgibootcd and end up with an image + # All done; feed the config to sgibootcd and end up with an + # image /usr/bin/sgibootcd c=${cfg} o=${clst_iso} ;; - *) die "SGI LiveCDs only support the 'normal' fstype!" ;; esac ;; diff --git a/targets/support/filesystem-functions.sh b/targets/support/filesystem-functions.sh index 740a0683..ef1bd675 100755 --- a/targets/support/filesystem-functions.sh +++ b/targets/support/filesystem-functions.sh @@ -6,9 +6,9 @@ create_normal_loop() { export destination_path="$1" export loopname="image.loop" - #We get genkernel-built kernels and initrds in place, create the loopback fs on - #$clst_target_path, mount it, copy our bootable filesystem over, umount it, and - #we then have a ready-to-burn ISO tree at $clst_target_path. + # We get genkernel-built kernels and initrds in place, create the loopback + # file system on $clst_target_path, mount it, copy our bootable filesystem + # over, umount it, and have a ready-to-burn ISO tree at $clst_target_path. echo "Calculating size of loopback filesystem..." loopsize=`du -ks ${source_path} | cut -f1` @@ -16,60 +16,67 @@ create_normal_loop() { # Add 4MB for filesystem slop loopsize=`expr ${loopsize} + 4096` echo "Creating loopback file..." - dd if=/dev/zero of=${destination_path}/${loopname} bs=1k count=${loopsize} || die "${loopname} creation failure" - mke2fs -m 0 -F -q ${destination_path}/${loopname} || die "Couldn't create ext2 filesystem" + dd if=/dev/zero of=${destination_path}/${loopname} bs=1k count=${loopsize} \ + || die "${loopname} creation failure" + mke2fs -m 0 -F -q ${destination_path}/${loopname} \ + || die "Couldn't create ext2 filesystem" install -d ${destination_path}/loopmount - sync; sync; sleep 3 #try to work around 2.6.0+ loopback bug - mount -t ext2 -o loop ${destination_path}/${loopname} ${destination_path}/loopmount || die "Couldn't mount loopback ext2 filesystem" - sync; sync; sleep 3 #try to work around 2.6.0+ loopback bug - echo "cp -a ${source_path}/* ${destination_path}/loopmount" - cp -a ${source_path}/* ${destination_path}/loopmount - [ $? -ne 0 ] && { umount ${destination_path}/${loopname}; die "Couldn't copy files to loopback ext2 filesystem"; } - umount ${destination_path}/loopmount || die "Couldn't unmount loopback ext2 filesystem" + sync; sync; sleep 3 # Try to work around 2.6.0+ loopback bug + mount -t ext2 -o loop ${destination_path}/${loopname} \ + ${destination_path}/loopmount \ + || die "Couldn't mount loopback ext2 filesystem" + sync; sync; sleep 3 # Try to work around 2.6.0+ loopback bug + echo "cp -pPR ${source_path}/* ${destination_path}/loopmount" + cp -pPR ${source_path}/* ${destination_path}/loopmount + [ $? -ne 0 ] && { umount ${destination_path}/${loopname}; \ + die "Couldn't copy files to loopback ext2 filesystem"; } + umount ${destination_path}/loopmount \ + || die "Couldn't unmount loopback ext2 filesystem" rm -rf ${destination_path}/loopmount - #now, $clst_target_path should contain a proper bootable image for our iso, including - #boot loader and loopback filesystem. + # Now, $clst_target_path should contain a proper bootable image for our + # ISO, including boot loader and loopback filesystem. } - - create_zisofs() { rm -rf "$1/zisofs" > /dev/null 2>&1 echo "Creating zisofs..." - mkzftree -z 9 -p2 "${clst_destpath}" "$1/zisofs" || die "Could not run mkzftree, did you emerge zisofs" - + mkzftree -z 9 -p2 "${clst_destpath}" "$1/zisofs" \ + || die "Could not run mkzftree, did you emerge zisofs" } create_noloop() { echo "Copying files for image (no loop)..." - cp -a "${clst_destpath}"/* "$1" || die "Could not copy files to image (no loop)" - + cp -pPR "${clst_destpath}"/* "$1" \ + || die "Could not copy files to image (no loop)" } create_squashfs() { echo "Creating squashfs..." export loopname="image.squashfs" - mksquashfs "${clst_destpath}" "$1/${loopname}" ${clst_fs_ops} -noappend || die "mksquashfs failed, did you emerge squashfs-tools?" - + mksquashfs "${clst_destpath}" "$1/${loopname}" ${clst_fs_ops} -noappend \ + || die "mksquashfs failed, did you emerge squashfs-tools?" } create_jffs() { echo "Creating jffs..." export loopname="image.jffs" - #fs_check /usr/sbin/mkfs.jffs jffs sys-fs/mtd - mkfs.jffs -d ${clst_destpath} -o $1/${loopname} ${clst_fs_ops} || die "Could not create a jffs filesystem" + # fs_check /usr/sbin/mkfs.jffs jffs sys-fs/mtd + mkfs.jffs -d ${clst_destpath} -o $1/${loopname} ${clst_fs_ops} \ + || die "Could not create a jffs filesystem" } create_jffs2(){ echo "Creating jffs2..." export loopname="image.jffs" - #fs_check /usr/sbin/mkfs.jffs2 jffs2 sys-fs/mtd - mkfs.jffs2 --root=${clst_destpath} --output=$1/${loopname} ${clst_fs_ops} || die "Could not create a jffs2 filesystem" + # fs_check /usr/sbin/mkfs.jffs2 jffs2 sys-fs/mtd + mkfs.jffs2 --root=${clst_destpath} --output=$1/${loopname} ${clst_fs_ops} \ + || die "Could not create a jffs2 filesystem" } create_cramfs(){ echo "Creating cramfs..." export loopname="image.cramfs" #fs_check /sbin/mkcramfs cramfs sys-fs/cramfs - mkcramfs ${clst_fs_ops} ${clst_destpath} $1/${loopname} || die "Could not create a cramfs filesystem" + mkcramfs ${clst_fs_ops} ${clst_destpath} $1/${loopname} \ + || die "Could not create a cramfs filesystem" } diff --git a/targets/support/functions.sh b/targets/support/functions.sh index f6306b96..ae7c703d 100755 --- a/targets/support/functions.sh +++ b/targets/support/functions.sh @@ -7,12 +7,12 @@ copy_to_chroot(){ then echo "copying ${file_name} to ${dest_dir}" mkdir -p ${dest_dir} - cp -a ${1} ${dest_dir} + cp -pPR ${1} ${dest_dir} chmod 755 ${dest_dir}/${file_name} else echo "copying ${file_name} to ${clst_chroot_path}/tmp" mkdir -p ${chroot_path}/tmp - cp -a ${1} ${clst_chroot_path}/tmp + cp -pPR ${1} ${clst_chroot_path}/tmp chmod 755 ${clst_chroot_path}/tmp/${file_name} fi } @@ -29,7 +29,6 @@ exec_in_chroot(){ # Takes the full path to the source file as its argument # copies the file to the /tmp directory of the chroot # and executes it. - local file_name=$(basename ${1}) local subdir=${2#/} @@ -37,13 +36,15 @@ exec_in_chroot(){ then copy_to_chroot ${1} ${subdir}/tmp/ chroot_path=${clst_chroot_path}${subdir} - copy_to_chroot ${clst_sharedir}/targets/support/chroot-functions.sh ${subdir}/tmp/ + copy_to_chroot ${clst_sharedir}/targets/support/chroot-functions.sh \ + ${subdir}/tmp/ echo "Running ${file_name} in chroot ${chroot_path}" ${clst_CHROOT} ${chroot_path} /tmp/${file_name} || exit 1 else copy_to_chroot ${1} tmp/ chroot_path=${clst_chroot_path} - copy_to_chroot ${clst_sharedir}/targets/support/chroot-functions.sh tmp/ + copy_to_chroot ${clst_sharedir}/targets/support/chroot-functions.sh \ + tmp/ echo "Running ${file_name} in chroot ${chroot_path}" ${clst_CHROOT} ${chroot_path}/ /tmp/${file_name} || exit 1 fi @@ -70,7 +71,6 @@ extract_cdtar() { # $clst_target_path. We extract the "cdtar" to this directory, # which will normally contains a pre-built binary # boot-loader/filesystem skeleton for the ISO. - cdtar=${clst_cdtar} [ -z "${cdtar}" ] && die "Required key cdtar not defined, exiting" tar xjpf ${cdtar} -C $1 || die "Couldn't extract cdtar ${cdtar}" @@ -78,16 +78,16 @@ extract_cdtar() { extract_kernels() { # extract multiple kernels - #$1 = Destination - #${clst_target_path}/kernel is often a good choice for ${1} + # $1 = Destination + # ${clst_target_path}/kernel is often a good choice for ${1} # Takes the relative desination dir for the kernel as an arguement # i.e boot or isolinux - [ -z "$clst_boot_kernel" ] && die "Required key boot/kernel not defined, exiting" + [ -z "$clst_boot_kernel" ] && \ + die "Required key boot/kernel not defined, exiting" # install the kernels built in kmerge.sh for x in ${clst_boot_kernel} do - first=${first:-""} kbinary="${clst_chroot_path}/usr/portage/packages/gk_binaries/${x}-kernel-initrd-${clst_version_stamp}.tar.bz2" if [ -z "${first}" ] @@ -95,13 +95,11 @@ extract_kernels() { # grab name of first kernel export first="${x}" fi - + [ ! -e "${kbinary}" ] && die "Can't find kernel tarball at ${kbinary}" mkdir -p ${1}/ tar xjf ${kbinary} -C ${1}/ - - # change config name from "config-*" to "gentoo", for example #mv ${1}/config-* ${1}/${x}-config rm ${1}/config-* @@ -132,10 +130,10 @@ extract_kernels() { } extract_modules() { - #$1 = Destination - #$2 = kname + # $1 = Destination + # $2 = kname kmodules="${clst_chroot_path}/usr/portage/packages/gk_binaries/${2}-modules-${clst_version_stamp}.tar.bz2" - + if [ -f "${kmodules}" ] then mkdir -p ${1}/ @@ -145,9 +143,9 @@ extract_modules() { fi } extract_kernel() { - #$1 = Destination - #$2 = kname - + # $1 = Destination + # $2 = kname + kbinary="${clst_chroot_path}/usr/portage/packages/gk_binaries/${2}-kernel-initrd-${clst_version_stamp}.tar.bz2" [ ! -e "${kbinary}" ] && die "Can't find kernel tarball at ${kbinary}" mkdir -p ${1}/ @@ -197,24 +195,24 @@ check_bootargs(){ check_filesystem_type(){ case ${clst_fstype} in normal) - cmdline_opts="${cmdline_opts} looptype=normal loop=/image.loop" + cmdline_opts="${cmdline_opts} looptype=normal loop=/image.loop" ;; - zisofs) - cmdline_opts="${cmdline_opts} looptype=zisofs loop=/zisofs" + zisofs) + cmdline_opts="${cmdline_opts} looptype=zisofs loop=/zisofs" ;; - noloop) + noloop) ;; - squashfs) - cmdline_opts="${cmdline_opts} looptype=squashfs loop=/image.squashfs" + squashfs) + cmdline_opts="${cmdline_opts} looptype=squashfs loop=/image.squashfs" ;; - jffs) - cmdline_opts="${cmdline_opts} looptype=jffs loop=/image.jffs" + jffs) + cmdline_opts="${cmdline_opts} looptype=jffs loop=/image.jffs" ;; - jffs2) - cmdline_opts="${cmdline_opts} looptype=jffs2 loop=/image.jffs2" + jffs2) + cmdline_opts="${cmdline_opts} looptype=jffs2 loop=/image.jffs2" ;; - cramfs) - cmdline_opts="${cmdline_opts} looptype=cramfs loop=/image.cramfs" + cramfs) + cmdline_opts="${cmdline_opts} looptype=cramfs loop=/image.cramfs" ;; esac -} +} -- 2.26.2