isoboot=*)
ISOBOOT=${x#*=}
;;
- # Start Volume manager options
+ # Start Volume manager options
dolvm)
USE_LVM_NORMAL=1
;;
debug)
DEBUG='yes'
;;
- # Scan delay options
+ # Scan delay options
scandelay=*)
SDELAY=${x#*=}
;;
nounionfs)
USE_UNIONFS_NORMAL=0
;;
-# unionfs=*)
-# if [ ! -x /sbin/unionfs ]
-# then
-# USE_UNIONFS_NORMAL=0
-# bad_msg 'unionfs binary not found: aborting use of unionfs!'
-# else
-# USE_UNIONFS_NORMAL=1
-# CMD_UNIONFS=${x#*=}
-# echo ${CMD_UNIONFS}|grep , >/dev/null 2>&1
-# if [ $? -eq 0 ]
-# then
-# UID=$(echo ${CMD_UNIONFS#*,})
-# UNIONFS=$(echo ${CMD_UNIONFS%,*})
-# else
-# UNIONFS=${CMD_UNIONFS}
-# fi
-# fi
-# ;;
esac
done
if [ -z "${REAL_ROOT}" -a \( "${CDROOT}" = '0' \) -a \( "${FAKE_ROOT}" != "/dev/ram0" \) ]
then
- REAL_ROOT="${FAKE_ROOT}"
+ REAL_ROOT="${FAKE_ROOT}"
fi
splash 'init'
RESUME_DEV=""
retval=1
-
+
if [ ${retval} -ne 0 ]; then
RESUME_DEV=$(findfs "${REAL_RESUME}" 2>/dev/null)
retval=$?
fi
-
+
if [ ${retval} -ne 0 ]; then
RESUME_DEV=$(busybox findfs "${REAL_RESUME}" 2>/dev/null)
retval=$?
fi
-
+
if [ ${retval} -ne 0 ]; then
RESUME_DEV=$(blkid -l -t "${REAL_RESUME}" | cut -d ":" -f 1 2>/dev/null)
retval=$?
fi
-
+
if [ ${retval} -eq 0 ] && [ -n "${RESUME_DEV}" ]; then
good_msg "Detected real_resume=${RESUME_DEV}"
REAL_RESUME="${RESUME_DEV}"
then
good_msg "Making tmpfs for ${NEW_ROOT}"
mount -n -t tmpfs tmpfs "${NEW_ROOT}"
-
+
for i in dev mnt mnt/cdrom mnt/livecd mnt/key tmp tmp/.initrd mnt/gentoo sys
do
mkdir -p "${NEW_ROOT}/${i}"
if [ "${REAL_ROOT}" = '' ]
then
echo -n -e "${WARN}>>${NORMAL}${BOLD} No bootable medium found. Waiting for new devices"
-
+
COUNTER=0
while [ ${COUNTER} -lt 3 ]; do
sleep 3
while [ "${got_good_root}" != '1' ]
do
case "${REAL_ROOT}" in
- LABEL\=*|UUID\=*)
-
+ LABEL=*|UUID=*)
+
ROOT_DEV=""
retval=1
-
+
if [ ${retval} -ne 0 ]; then
ROOT_DEV=$(findfs "${REAL_ROOT}" 2>/dev/null)
retval=$?
fi
-
+
if [ ${retval} -ne 0 ]; then
ROOT_DEV=$(busybox findfs "${REAL_ROOT}" 2>/dev/null)
retval=$?
fi
-
+
if [ ${retval} -ne 0 ]; then
ROOT_DEV=$(blkid -l -t "${REAL_ROOT}" | cut -d ":" -f 1 2>/dev/null)
retval=$?
fi
-
+
if [ ${retval} -eq 0 ] && [ -n "${ROOT_DEV}" ]; then
good_msg "Detected real_root=${ROOT_DEV}"
REAL_ROOT="${ROOT_DEV}"
fi
;;
esac
-
+
if [ "${REAL_ROOT}" = '' ]
then
# No REAL_ROOT determined/specified. Prompt user for root block device.
mount -t ${ROOTFSTYPE} -o ro,${REAL_ROOTFLAGS} ${REAL_ROOT} ${NEW_ROOT}
fi
fi
-
- # If mount is successful break out of the loop
+
+ # If mount is successful break out of the loop
# else not a good root and start over.
if [ "$?" = '0' ]
then
"${NEW_ROOT}${CDROOT_DEV}" \
"${NEW_ROOT}${REAL_ROOT}"
test_success 'losetup /dev/sr0 /dev/loop0'
-
+
good_msg 'Mounting the Root Partition'
mount -t squashfs -o ro "${NEW_ROOT}${CDROOT_DEV}" "${NEW_ROOT}/mnt/livecd"
test_success 'mount /dev/loop0 /'
if [ -e "${NEW_ROOT}/mnt/cdrom/add" ]
then
for targz in $(ls ${NEW_ROOT}/mnt/cdrom/add/*.tar.gz)
- do
+ do
tarname=$(basename ${targz})
good_msg "Adding additional package ${tarname}"
(cd ${NEW_ROOT} ; /bin/tar -xzf ${targz})
setup_unionfs ${NEW_ROOT} ${NEW_ROOT}/${FS_LOCATION}
CHROOT=/union
elif [ "${USE_AUFS_NORMAL}" != '1' ]; then
-
+
good_msg "Copying read-write image contents to tmpfs"
# Copy over stuff that should be writable
(cd "${NEW_ROOT}/${FS_LOCATION}"; cp -a ${ROOT_TREES} "${NEW_ROOT}")
then
UTILS_ARCH='sparc'
fi
-
+
ARCH_CONFIG="${GK_SHARE}/arch/${ARCH}/config.sh"
[ -f "${ARCH_CONFIG}" ] || gen_die "${ARCH} not yet supported by genkernel. Please add the arch-specific config file, ${ARCH_CONFIG}"
}
echo "root (${GRUB_BOOT_DISK},${GRUB_BOOT_PARTITION})" >> ${GRUB_CONF}
echo >> ${GRUB_CONF}
- # Add grub configuration to grub.conf
+ # Add grub configuration to grub.conf
echo "# Genkernel generated entry, see GRUB documentation for details" >> ${GRUB_CONF}
echo "title=Gentoo Linux ($KV)" >> ${GRUB_CONF}
if [ "${BUILD_INITRD}" = '0' ]
set_bootloader_grub_duplicate_default() {
local GRUB_CONF=$1
local GRUB_CONF_TMP="${GRUB_CONF}.tmp"
-
+
line_count=$(wc -l < "${GRUB_CONF}")
line_nums="$(grep -n "^title" "${GRUB_CONF}" | cut -d: -f1)"
if [ -z "${line_nums}" ]; then
TEMP=${TMPDIR}/$RANDOM.$RANDOM.$RANDOM.$$
print_info 2 "TMPDIR: ${TMPDIR}"
print_info 2 "TEMP: ${TEMP}"
- ;;
+ ;;
--postclear)
CMD_POSTCLEAR=1
print_info 2 "CMD_POSTCLEAR: ${CMD_POSTCLEAR}"
- ;;
+ ;;
--arch-override=*)
CMD_ARCHOVERRIDE=`parse_opt "$*"`
print_info 2 "CMD_ARCHOVERRIDE: ${CMD_ARCHOVERRIDE}"
rm -rf "${TEMP}/device-mapper" > /dev/null
/bin/tar -jxpf "${DEVICE_MAPPER_BINCACHE}" -C "${TEMP}" ||
gen_die "Could not extract device-mapper binary cache!";
-
+
cd "${DMRAID_DIR}"
print_info 1 'dmraid: >> Configuring...'
-
+
LDFLAGS="-L${TEMP}/device-mapper/lib" \
CFLAGS="-I${TEMP}/device-mapper/include" \
CPPFLAGS="-I${TEMP}/device-mapper/include" \
else
print_info 1 "kernel: --clean is disabled; not running 'make clean'."
fi
-
+
if isTrue ${MENUCONFIG}
then
print_info 1 'kernel: >> Invoking menuconfig...'
SUB=`grep ^SUBLEVEL\ \= ${KERNEL_DIR}/Makefile | awk '{ print $3 };'`
EXV=`grep ^EXTRAVERSION\ \= ${KERNEL_DIR}/Makefile | sed -e "s/EXTRAVERSION =//" -e "s/ //g" -e 's/\$([a-z]*)//gi'`
- if [ -z "${SUB}" ];
+ if [ -z "${SUB}" ]
then
# Handle O= build directories
KERNEL_SOURCE_DIR=`grep ^MAKEARGS\ \:\= ${KERNEL_DIR}/Makefile | awk '{ print $4 };'`
FUSE_BINCACHE=`cache_replace "${FUSE_BINCACHE}"`
UNIONFS_FUSE_BINCACHE=`cache_replace "${UNIONFS_FUSE_BINCACHE}"`
GPG_BINCACHE=`cache_replace "${GPG_BINCACHE}"`
-
+
DEFAULT_KERNEL_CONFIG=`arch_replace "${DEFAULT_KERNEL_CONFIG}"`
BUSYBOX_CONFIG=`arch_replace "${BUSYBOX_CONFIG}"`
BUSYBOX_BINCACHE=`arch_replace "${BUSYBOX_BINCACHE}"`
BOOTLOADER=`echo "${CMD_BOOTLOADER}" | cut -f1 -d:`
fi
fi
-
+
if [ "${NO_KERNEL_SOURCES}" != "1" ]
then
if [ ! -d ${KERNEL_DIR} ]
fi
fi
- # Special case: If --no-clean is specified on the command line,
+ # Special case: If --no-clean is specified on the command line,
# imply --no-mrproper.
if [ "${CMD_CLEAN}" != '' ]
then
MRPROPER=0
fi
fi
-
+
if [ -n "${MINKERNPACKAGE}" ]
then
mkdir -p `dirname ${MINKERNPACKAGE}`
fi
-
+
if [ -n "${MODULESPACKAGE}" ]
then
mkdir -p `dirname ${MODULESPACKAGE}`
then
INTEGRATED_INITRAMFS=0
fi
-
+
get_KV
}
return 1
}
-setColorVars() {
+setColorVars() {
if isTrue ${USECOLOR}
then
GOOD=$'\e[32;01m'
DEBUGCACHE="${DEBUGCACHE}${STR}"
else
echo -ne "${STR}" >> ${LOGFILE}
- fi
+ fi
else
if [ "${TODEBUGCACHE}" = '1' ]; then
DEBUGCACHE="${DEBUGCACHE}${STR}"$'\n'
# in the later sed expression
local SAFE_VAR
SAFE_VAR=`echo "${2}" | sed -e 's/\([\/\.]\)/\\\\\\1/g'`
-
+
echo "${3}" | sed -e "s/%%${1}%%/${SAFE_VAR}/g" -
}
if [ -f "${LOGFILE}" ]
then
(echo > "${LOGFILE}") 2>/dev/null || small_die "Genkernel: Could not write to ${LOGFILE}."
- fi
+ fi
}
gen_die() {
rm ${TMPDIR}/${i}
done
fi
-}
+}
#
# Function to copy various kernel boot image products to the boot directory,
echo "/dev/ram0 / ext2 defaults 0 0" > ${TEMP}/initramfs-base-temp/etc/fstab
echo "proc /proc proc defaults 0 0" >> ${TEMP}/initramfs-base-temp/etc/fstab
-
+
cd ${TEMP}/initramfs-base-temp/dev
mknod -m 660 console c 5 1
mknod -m 660 null c 1 3
ln -s busybox ${TEMP}/initramfs-busybox-temp/bin/$i ||
gen_die "Busybox error: could not link ${i}!"
done
-
+
cd "${TEMP}/initramfs-busybox-temp/"
find . -print | cpio ${CPIO_ARGS} --append -F "${CPIO}" \
|| gen_die "compressing busybox cpio"
|| gen_die "Could not copy file ${i} for MULTIPATH"
done
- if [ -x /sbin/multipath ]
+ if [ -x /sbin/multipath ]
then
cp /etc/multipath.conf "${TEMP}/initramfs-multipath-temp/etc/" || gen_die 'could not copy /etc/multipath.conf please check this'
fi
else
cd /
fi
-
+
if [ -d "${TEMP}/initramfs-modules-${KV}-temp" ]
then
rm -r "${TEMP}/initramfs-modules-${KV}-temp/"
fi
- mkdir -p "${TEMP}/initramfs-modules-${KV}-temp/lib/modules/${KV}"
+ mkdir -p "${TEMP}/initramfs-modules-${KV}-temp/lib/modules/${KV}"
for i in `gen_dep_list`
do
mymod=`find ./lib/modules/${KV} -name "${i}${MOD_EXT}" 2>/dev/null| head -n 1 `
print_warning 2 "Warning :: ${i}${MOD_EXT} not found; skipping..."
continue;
fi
-
+
print_info 2 "initramfs: >> Copying ${i}${MOD_EXT}..."
cp -ax --parents "${mymod}" "${TEMP}/initramfs-modules-${KV}-temp"
done
-
+
cp -ax --parents ./lib/modules/${KV}/modules* ${TEMP}/initramfs-modules-${KV}-temp 2>/dev/null
mkdir -p "${TEMP}/initramfs-modules-${KV}-temp/etc/modules"
then
rm -r "${TEMP}/initramfs-aux-temp/"
fi
- mkdir -p "${TEMP}/initramfs-aux-temp/etc"
- mkdir -p "${TEMP}/initramfs-aux-temp/sbin"
+ mkdir -p "${TEMP}/initramfs-aux-temp/etc"
+ mkdir -p "${TEMP}/initramfs-aux-temp/sbin"
if [ -f "${CMD_LINUXRC}" ]
then
cp "${CMD_LINUXRC}" "${TEMP}/initramfs-aux-temp/init"
print_info 2 " >> Copying user specified linuxrc: ${CMD_LINUXRC} to init"
- else
+ else
if isTrue ${NETBOOT}
then
cp "${GK_SHARE}/netboot/linuxrc.x" "${TEMP}/initramfs-aux-temp/init"
# big cpio.
cd ${TEMP}/initramfs-aux-temp
ln -s init linuxrc
-# ln ${TEMP}/initramfs-aux-temp/init ${TEMP}/initramfs-aux-temp/linuxrc
+# ln ${TEMP}/initramfs-aux-temp/init ${TEMP}/initramfs-aux-temp/linuxrc
if [ -f "${GK_SHARE}/arch/${ARCH}/initrd.scripts" ]
then
cp "${GK_SHARE}/arch/${ARCH}/initrd.scripts" "${TEMP}/initramfs-aux-temp/etc/initrd.scripts"
- else
+ else
cp "${GK_SHARE}/defaults/initrd.scripts" "${TEMP}/initramfs-aux-temp/etc/initrd.scripts"
fi
then
sed -i "s:^REAL_ROOT=.*$:REAL_ROOT='${REAL_ROOT}':" "${TEMP}/initramfs-aux-temp/etc/initrd.defaults"
fi
-
- echo -n 'HWOPTS="$HWOPTS ' >> "${TEMP}/initramfs-aux-temp/etc/initrd.defaults"
+
+ echo -n 'HWOPTS="$HWOPTS ' >> "${TEMP}/initramfs-aux-temp/etc/initrd.defaults"
for group_modules in ${!MODULES_*}; do
group="$(echo $group_modules | cut -d_ -f2 | tr "[:upper:]" "[:lower:]")"
echo -n "${group} " >> "${TEMP}/initramfs-aux-temp/etc/initrd.defaults"
done
- echo '"' >> "${TEMP}/initramfs-aux-temp/etc/initrd.defaults"
+ echo '"' >> "${TEMP}/initramfs-aux-temp/etc/initrd.defaults"
if [ -f "${GK_SHARE}/arch/${ARCH}/modprobe" ]
then
find . -print | cpio ${CPIO_ARGS} --append -F "${CPIO}" \
|| gen_die "compressing auxilary cpio"
cd "${TEMP}"
- rm -r "${TEMP}/initramfs-aux-temp/"
+ rm -r "${TEMP}/initramfs-aux-temp/"
}
append_data() {
if [ "${ALLRAMDISKMODULES}" = "1" ]; then
strip_mod_paths $(find "${INSTALL_MOD_PATH}/lib/modules/${KV}" -name "*$(modules_kext)") | sort
else
- local group_modules
+ local group_modules
rm -f ${TEMP}/moddeps > /dev/null
-
+
for group_modules in ${!MODULES_*}; do
gen_deps ${!group_modules}
done
cp "${tmp_kernel_binary2}" "${TEMP}/minkernpackage/kernelz-${KV}" || gen_die "Could not copy the kernelz for the min kernel package"
fi
fi
-
+
if ! isTrue "${INTEGRATED_INITRAMFS}"
then
[ "${BUILD_RAMDISK}" != '0' ] && { cp "${TMPDIR}/initramfs-${KV}" "${TEMP}/minkernpackage/initramfs-${ARCH}-${KV}" || gen_die 'Could not copy the initramfs for the kernel package!'; }
else
cp "${KERNEL_DIR}/System.map" "${TEMP}/minkernpackage/System.map-${ARCH}-${KV}" || gen_die 'Could not copy System.map for the kernel package!';
fi
-
- cd "${TEMP}/minkernpackage"
+
+ cd "${TEMP}/minkernpackage"
/bin/tar -jcpf ${MINKERNPACKAGE} * || gen_die 'Could not compress the kernel package!'
cd "${TEMP}" && rm -rf "${TEMP}/minkernpackage" > /dev/null 2>&1
}
then
cp "${tmp_kernel_binary2}" "${TEMP}/kerncache/kernelz-${ARCH}-${KV}" || gen_die "Could not copy the kernelz for the kernel package"
fi
-
+
echo "VERSION = ${VER}" > "${TEMP}/kerncache/kerncache.config"
echo "PATCHLEVEL = ${PAT}" >> "${TEMP}/kerncache/kerncache.config"
echo "SUBLEVEL = ${SUB}" >> "${TEMP}/kerncache/kerncache.config"
echo "EXTRAVERSION = ${EXV}" >> "${TEMP}/kerncache/kerncache.config"
-
+
mkdir -p "${TEMP}/kerncache/lib/modules/"
-
+
if [ -d ${INSTALL_MOD_PATH}/lib/modules/${KV} ]
then
cp -r "${INSTALL_MOD_PATH}/lib/modules/${KV}" "${TEMP}/kerncache/lib/modules"
fi
-
- cd "${TEMP}/kerncache"
+
+ cd "${TEMP}/kerncache"
/bin/tar -jcpf ${KERNCACHE} * || gen_die 'Could not compress the kernel package!'
cd "${TEMP}" && rm -rf "${TEMP}/kerncache" > /dev/null 2>&1
}
gen_kerncache_extract_kernel()
{
- /bin/tar -f ${KERNCACHE} -C ${TEMP} -xj
+ /bin/tar -f ${KERNCACHE} -C ${TEMP} -xj
copy_image_with_preserve "kernel" \
"${TEMP}/kernel-${ARCH}-${KV}" \
"kernel-${KNAME}-${ARCH}-${KV}"
"${TEMP}/kernelz-${ARCH}-${KV}" \
"kernelz-${KNAME}-${ARCH}-${KV}"
fi
-
+
copy_image_with_preserve "System.map" \
"${TEMP}/System.map-${ARCH}-${KV}" \
"System.map-${KNAME}-${ARCH}-${KV}"
gen_kerncache_extract_modules()
{
- if [ -e "${KERNCACHE}" ]
+ if [ -e "${KERNCACHE}" ]
then
print_info 1 'Extracting kerncache kernel modules'
if [ "${INSTALL_MOD_PATH}" != '' ]
gen_kerncache_extract_config()
{
- if [ -e "${KERNCACHE}" ]
+ if [ -e "${KERNCACHE}" ]
then
print_info 1 'Extracting kerncache config to /etc/kernels'
mkdir -p /etc/kernels
# Can make this more secure ....
/bin/tar -xj -f ${KERNCACHE} -C ${TEMP}
- if [ -e ${TEMP}/config-${ARCH}-${KV} -a -e ${TEMP}/kernel-${ARCH}-${KV} ]
- then
+ if [ -e ${TEMP}/config-${ARCH}-${KV} -a -e ${TEMP}/kernel-${ARCH}-${KV} ]
+ then
print_info 1 'Valid kernel cache found; no sources will be used'
KERNCACHE_IS_VALID=1
fi
else
- if [ -e "${KERNCACHE}" ]
+ if [ -e "${KERNCACHE}" ]
then
KERNEL_CONFIG="/${KERNEL_DIR}/.config"
if [ "${CMD_KERNEL_CONFIG}" != '' ]
test2=$(grep -v "^#" ${KERNEL_CONFIG} | md5sum | cut -d " " -f 1)
if [ "${test1}" == "${test2}" ]
then
-
echo
print_info 1 "No kernel configuration change, skipping kernel build..."
echo
fi
fi
fi
- export KERNCACHE_IS_VALID
+ export KERNCACHE_IS_VALID
return 1
}