# 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 <wolf31o2@gentoo.org> 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 <rocket@gentoo.org>
modules/generic_stage_target.py, modules/livecd_stage2_target.py:
# 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 *
"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})
-
+
#!/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
((bctr=${bctr}+1))
done
;;
-
arm)
;;
hppa)
for x in ${clst_boot_kernel}
do
-
eval custom_kopts=\$${x}_kernelopts
echo "APPENDING CUSTOM KERNEL ARGS: ${custom_kopts}"
echo >> ${icfg}
}
setup_myfeatures(){
-
if [ -n "${clst_CCACHE}" ]
then
export clst_myfeatures="${clst_myfeatures} ccache"
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"
}
run_emerge() {
-
# Sets up the ROOT= parameter
# with no options ROOT=/
make_destpath ${clst_root_path}
# 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}
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} !"
}
function copy_symlink() {
-
STACK=${2}
[ "${STACK}" = "" ] && STACK=16 || STACK=$((${STACK} - 1 ))
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} ]
else
copy_file ${TARGET}
fi
- }
+}
function copy_file() {
-
f="${1}"
if [ ! -e "${f}" ]
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}
+#!/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
# 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
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
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}
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
;;
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 ]
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)
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 ]
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)
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
;;
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`
# 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"
}
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
}
# 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#/}
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
# $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}"
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}" ]
# 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-*
}
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}/
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}/
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
-}
+}