1 # Copyright 1999-2005 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
4 local file_name=$(basename ${1})
5 local dest_dir=${clst_chroot_path}${2}
8 echo "copying ${file_name} to ${dest_dir}"
10 cp -a ${1} ${dest_dir}
11 chmod 755 ${dest_dir}/${file_name}
13 echo "copying ${file_name} to ${clst_chroot_path}/tmp"
14 mkdir -p ${chroot_path}/tmp
15 cp -a ${1} ${clst_chroot_path}/tmp
16 chmod 755 ${clst_chroot_path}/tmp/${file_name}
22 if [ -e ${clst_chroot_path}${1} ]
24 echo "removing ${clst_chroot_path}${1} from the chroot"
25 rm -f ${clst_chroot_path}${1}
30 # Takes the full path to the source file as its argument
31 # copies the file to the /tmp directory of the chroot
34 local file_name=$(basename ${1})
37 if [ "${subdir}" != "" ]
39 copy_to_chroot ${1} ${subdir}/tmp/
40 chroot_path=${clst_chroot_path}${subdir}
41 copy_to_chroot ${clst_sharedir}/targets/support/chroot-functions.sh ${subdir}/tmp/
42 echo "Running ${file_name} in chroot ${chroot_path}"
43 ${clst_CHROOT} ${chroot_path} ${subdir}/tmp/${file_name} || exit 1
45 copy_to_chroot ${1} tmp/
46 chroot_path=${clst_chroot_path}
47 copy_to_chroot ${clst_sharedir}/targets/support/chroot-functions.sh tmp/
48 echo "Running ${file_name} in chroot ${chroot_path}"
49 ${clst_CHROOT} ${chroot_path}/ tmp/${file_name} || exit 1
52 rm -f ${chroot_path}/tmp/${file_name}
53 if [ "${subdir}" != "" ]
55 delete_from_chroot ${subdir}/tmp/${file_name}
56 delete_from_chroot ${subdir}/tmp/chroot-functions.sh
58 delete_from_chroot tmp/chroot-functions.sh
59 delete_from_chroot tmp/${file_name}
71 # Create a filesystem tree for the ISO at
72 # $clst_target_path. We extract the "cdtar" to this directory,
73 # which will normally contains a pre-built binary
74 # boot-loader/filesystem skeleton for the ISO.
77 [ -z "${cdtar}" ] && die "Required key cdtar not defined, exiting"
78 tar xjpf ${cdtar} -C $1 || die "Couldn't extract cdtar ${cdtar}"
82 # extract multiple kernels
84 #${clst_target_path}/kernel is often a good choice for ${1}
86 # Takes the relative desination dir for the kernel as an arguement
87 # i.e boot or isolinux
88 [ -z "$clst_boot_kernel" ] && die "Required key boot/kernel not defined, exiting"
89 # install the kernels built in kmerge.sh
90 for x in ${clst_boot_kernel}
94 kbinary="${clst_chroot_path}/usr/portage/packages/gk_binaries/${x}-kernel-initrd-${clst_version_stamp}.tar.bz2"
97 # grab name of first kernel
101 [ ! -e "${kbinary}" ] && die "Can't find kernel tarball at ${kbinary}"
103 tar xjf ${kbinary} -C ${1}/
107 # change config name from "config-*" to "gentoo", for example
108 #mv ${1}/config-* ${1}/${x}-config
111 # change kernel name from "kernel" to "gentoo", for example
112 mv ${1}/kernel-* ${1}/${x}
114 # change initrd name from "initrd" to "gentoo.igz", for example
115 if [ -e ${1}/initrd-* ]
117 mv ${1}/initrd-* ${1}/${x}.igz
120 if [ -e ${1}/initramfs-* ]
122 mv ${1}/initramfs-* ${1}/${x}.igz
130 kmodules="${clst_chroot_path}/usr/portage/packages/gk_binaries/${2}-modules-${clst_version_stamp}.tar.bz2"
132 [ ! -e "${kmodules}" ] && die "Can't find kernel modules tarball at ${kmodules}"
134 tar xjf ${kmodules} -C ${1} lib
140 kbinary="${clst_chroot_path}/usr/portage/packages/gk_binaries/${2}-kernel-initrd-${clst_version_stamp}.tar.bz2"
141 [ ! -e "${kbinary}" ] && die "Can't find kernel tarball at ${kbinary}"
143 tar xjf ${kbinary} -C ${1}/
144 # change config name from "config-*" to "gentoo", for example
145 #mv ${1}/config-* ${1}/${2}-config
148 # change kernel name from "kernel" to "gentoo", for example
149 mv ${1}/kernel-* ${1}/${2}
151 # change initrd name from "initrd" to "gentoo.igz", for example
152 if [ -e ${1}/initrd-* ]
154 mv ${1}/initrd-* ${1}/${2}.igz
157 # change initramfs name from "initramfs" to "gentoo.igz", for example
158 if [ -e ${1}/initramfs-* ]
160 mv ${1}/initramfs-* ${1}/${2}.igz
165 # figure out what device manager we are using and handle it accordingly
166 if [ "${clst_livecd_devmanager}" == "devfs" ]
168 cmdline_opts="${cmdline_opts} noudev devfs"
169 elif [ "${clst_livecd_devmanager}" == "devfs" ]
171 cmdline_opts="${cmdline_opts} udev nodevfs"
176 # Add any additional options
177 if [ -z "${clst_livecd_bootargs}" ]
179 for x in ${clst_livecd_bootargs}
181 cmdline_opts="${cmdline_opts} ${x}"
186 check_filesystem_type(){
187 case ${clst_fstype} in
189 cmdline_opts="${cmdline_opts} looptype=normal loop=/image.loop"
192 cmdline_opts="${cmdline_opts} looptype=zisofs loop=/zisofs"
197 cmdline_opts="${cmdline_opts} looptype=squashfs loop=/image.squashfs"
200 cmdline_opts="${cmdline_opts} looptype=jffs loop=/image.jffs"
203 cmdline_opts="${cmdline_opts} looptype=jffs2 loop=/image.jffs2"
206 cmdline_opts="${cmdline_opts} looptype=cramfs loop=/image.cramfs"