trivial: cleanup code, drop whitespaces and some more cruft

cleanup-cruft
Fabio Erculiani 14 years ago
parent 7fef86581a
commit 1e50bd01d2

@ -78,7 +78,7 @@ do
isoboot=*) isoboot=*)
ISOBOOT=${x#*=} ISOBOOT=${x#*=}
;; ;;
# Start Volume manager options # Start Volume manager options
dolvm) dolvm)
USE_LVM_NORMAL=1 USE_LVM_NORMAL=1
;; ;;
@ -100,7 +100,7 @@ do
debug) debug)
DEBUG='yes' DEBUG='yes'
;; ;;
# Scan delay options # Scan delay options
scandelay=*) scandelay=*)
SDELAY=${x#*=} SDELAY=${x#*=}
;; ;;
@ -228,30 +228,12 @@ do
nounionfs) nounionfs)
USE_UNIONFS_NORMAL=0 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 esac
done done
if [ -z "${REAL_ROOT}" -a \( "${CDROOT}" = '0' \) -a \( "${FAKE_ROOT}" != "/dev/ram0" \) ] if [ -z "${REAL_ROOT}" -a \( "${CDROOT}" = '0' \) -a \( "${FAKE_ROOT}" != "/dev/ram0" \) ]
then then
REAL_ROOT="${FAKE_ROOT}" REAL_ROOT="${FAKE_ROOT}"
fi fi
splash 'init' splash 'init'
@ -325,22 +307,22 @@ then
RESUME_DEV="" RESUME_DEV=""
retval=1 retval=1
if [ ${retval} -ne 0 ]; then if [ ${retval} -ne 0 ]; then
RESUME_DEV=$(findfs "${REAL_RESUME}" 2>/dev/null) RESUME_DEV=$(findfs "${REAL_RESUME}" 2>/dev/null)
retval=$? retval=$?
fi fi
if [ ${retval} -ne 0 ]; then if [ ${retval} -ne 0 ]; then
RESUME_DEV=$(busybox findfs "${REAL_RESUME}" 2>/dev/null) RESUME_DEV=$(busybox findfs "${REAL_RESUME}" 2>/dev/null)
retval=$? retval=$?
fi fi
if [ ${retval} -ne 0 ]; then if [ ${retval} -ne 0 ]; then
RESUME_DEV=$(blkid -l -t "${REAL_RESUME}" | cut -d ":" -f 1 2>/dev/null) RESUME_DEV=$(blkid -l -t "${REAL_RESUME}" | cut -d ":" -f 1 2>/dev/null)
retval=$? retval=$?
fi fi
if [ ${retval} -eq 0 ] && [ -n "${RESUME_DEV}" ]; then if [ ${retval} -eq 0 ] && [ -n "${RESUME_DEV}" ]; then
good_msg "Detected real_resume=${RESUME_DEV}" good_msg "Detected real_resume=${RESUME_DEV}"
REAL_RESUME="${RESUME_DEV}" REAL_RESUME="${RESUME_DEV}"
@ -362,7 +344,7 @@ if [ "${CDROOT}" = '1' ]
then then
good_msg "Making tmpfs for ${NEW_ROOT}" good_msg "Making tmpfs for ${NEW_ROOT}"
mount -n -t tmpfs tmpfs "${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 for i in dev mnt mnt/cdrom mnt/livecd mnt/key tmp tmp/.initrd mnt/gentoo sys
do do
mkdir -p "${NEW_ROOT}/${i}" mkdir -p "${NEW_ROOT}/${i}"
@ -393,7 +375,7 @@ then
if [ "${REAL_ROOT}" = '' ] if [ "${REAL_ROOT}" = '' ]
then then
echo -n -e "${WARN}>>${NORMAL}${BOLD} No bootable medium found. Waiting for new devices" echo -n -e "${WARN}>>${NORMAL}${BOLD} No bootable medium found. Waiting for new devices"
COUNTER=0 COUNTER=0
while [ ${COUNTER} -lt 3 ]; do while [ ${COUNTER} -lt 3 ]; do
sleep 3 sleep 3
@ -428,26 +410,26 @@ do
while [ "${got_good_root}" != '1' ] while [ "${got_good_root}" != '1' ]
do do
case "${REAL_ROOT}" in case "${REAL_ROOT}" in
LABEL\=*|UUID\=*) LABEL=*|UUID=*)
ROOT_DEV="" ROOT_DEV=""
retval=1 retval=1
if [ ${retval} -ne 0 ]; then if [ ${retval} -ne 0 ]; then
ROOT_DEV=$(findfs "${REAL_ROOT}" 2>/dev/null) ROOT_DEV=$(findfs "${REAL_ROOT}" 2>/dev/null)
retval=$? retval=$?
fi fi
if [ ${retval} -ne 0 ]; then if [ ${retval} -ne 0 ]; then
ROOT_DEV=$(busybox findfs "${REAL_ROOT}" 2>/dev/null) ROOT_DEV=$(busybox findfs "${REAL_ROOT}" 2>/dev/null)
retval=$? retval=$?
fi fi
if [ ${retval} -ne 0 ]; then if [ ${retval} -ne 0 ]; then
ROOT_DEV=$(blkid -l -t "${REAL_ROOT}" | cut -d ":" -f 1 2>/dev/null) ROOT_DEV=$(blkid -l -t "${REAL_ROOT}" | cut -d ":" -f 1 2>/dev/null)
retval=$? retval=$?
fi fi
if [ ${retval} -eq 0 ] && [ -n "${ROOT_DEV}" ]; then if [ ${retval} -eq 0 ] && [ -n "${ROOT_DEV}" ]; then
good_msg "Detected real_root=${ROOT_DEV}" good_msg "Detected real_root=${ROOT_DEV}"
REAL_ROOT="${ROOT_DEV}" REAL_ROOT="${ROOT_DEV}"
@ -458,7 +440,7 @@ do
fi fi
;; ;;
esac esac
if [ "${REAL_ROOT}" = '' ] if [ "${REAL_ROOT}" = '' ]
then then
# No REAL_ROOT determined/specified. Prompt user for root block device. # No REAL_ROOT determined/specified. Prompt user for root block device.
@ -503,8 +485,8 @@ do
mount -t ${ROOTFSTYPE} -o ro,${REAL_ROOTFLAGS} ${REAL_ROOT} ${NEW_ROOT} mount -t ${ROOTFSTYPE} -o ro,${REAL_ROOTFLAGS} ${REAL_ROOT} ${NEW_ROOT}
fi fi
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. # else not a good root and start over.
if [ "$?" = '0' ] if [ "$?" = '0' ]
then then
@ -613,7 +595,7 @@ then
"${NEW_ROOT}${CDROOT_DEV}" \ "${NEW_ROOT}${CDROOT_DEV}" \
"${NEW_ROOT}${REAL_ROOT}" "${NEW_ROOT}${REAL_ROOT}"
test_success 'losetup /dev/sr0 /dev/loop0' test_success 'losetup /dev/sr0 /dev/loop0'
good_msg 'Mounting the Root Partition' good_msg 'Mounting the Root Partition'
mount -t squashfs -o ro "${NEW_ROOT}${CDROOT_DEV}" "${NEW_ROOT}/mnt/livecd" mount -t squashfs -o ro "${NEW_ROOT}${CDROOT_DEV}" "${NEW_ROOT}/mnt/livecd"
test_success 'mount /dev/loop0 /' test_success 'mount /dev/loop0 /'
@ -631,7 +613,7 @@ then
if [ -e "${NEW_ROOT}/mnt/cdrom/add" ] if [ -e "${NEW_ROOT}/mnt/cdrom/add" ]
then then
for targz in $(ls ${NEW_ROOT}/mnt/cdrom/add/*.tar.gz) for targz in $(ls ${NEW_ROOT}/mnt/cdrom/add/*.tar.gz)
do do
tarname=$(basename ${targz}) tarname=$(basename ${targz})
good_msg "Adding additional package ${tarname}" good_msg "Adding additional package ${tarname}"
(cd ${NEW_ROOT} ; /bin/tar -xzf ${targz}) (cd ${NEW_ROOT} ; /bin/tar -xzf ${targz})
@ -645,7 +627,7 @@ then
setup_unionfs ${NEW_ROOT} ${NEW_ROOT}/${FS_LOCATION} setup_unionfs ${NEW_ROOT} ${NEW_ROOT}/${FS_LOCATION}
CHROOT=/union CHROOT=/union
elif [ "${USE_AUFS_NORMAL}" != '1' ]; then elif [ "${USE_AUFS_NORMAL}" != '1' ]; then
good_msg "Copying read-write image contents to tmpfs" good_msg "Copying read-write image contents to tmpfs"
# Copy over stuff that should be writable # Copy over stuff that should be writable
(cd "${NEW_ROOT}/${FS_LOCATION}"; cp -a ${ROOT_TREES} "${NEW_ROOT}") (cd "${NEW_ROOT}/${FS_LOCATION}"; cp -a ${ROOT_TREES} "${NEW_ROOT}")

@ -42,7 +42,7 @@ get_official_arch() {
then then
UTILS_ARCH='sparc' UTILS_ARCH='sparc'
fi fi
ARCH_CONFIG="${GK_SHARE}/arch/${ARCH}/config.sh" 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}" [ -f "${ARCH_CONFIG}" ] || gen_die "${ARCH} not yet supported by genkernel. Please add the arch-specific config file, ${ARCH_CONFIG}"
} }

@ -60,7 +60,7 @@ set_bootloader_grub() {
echo "root (${GRUB_BOOT_DISK},${GRUB_BOOT_PARTITION})" >> ${GRUB_CONF} echo "root (${GRUB_BOOT_DISK},${GRUB_BOOT_PARTITION})" >> ${GRUB_CONF}
echo >> ${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 "# Genkernel generated entry, see GRUB documentation for details" >> ${GRUB_CONF}
echo "title=Gentoo Linux ($KV)" >> ${GRUB_CONF} echo "title=Gentoo Linux ($KV)" >> ${GRUB_CONF}
if [ "${BUILD_INITRD}" = '0' ] if [ "${BUILD_INITRD}" = '0' ]
@ -109,7 +109,7 @@ set_bootloader_grub_check_for_existing_entry() {
set_bootloader_grub_duplicate_default() { set_bootloader_grub_duplicate_default() {
local GRUB_CONF=$1 local GRUB_CONF=$1
local GRUB_CONF_TMP="${GRUB_CONF}.tmp" local GRUB_CONF_TMP="${GRUB_CONF}.tmp"
line_count=$(wc -l < "${GRUB_CONF}") line_count=$(wc -l < "${GRUB_CONF}")
line_nums="$(grep -n "^title" "${GRUB_CONF}" | cut -d: -f1)" line_nums="$(grep -n "^title" "${GRUB_CONF}" | cut -d: -f1)"
if [ -z "${line_nums}" ]; then if [ -z "${line_nums}" ]; then

@ -422,11 +422,11 @@ parse_cmdline() {
TEMP=${TMPDIR}/$RANDOM.$RANDOM.$RANDOM.$$ TEMP=${TMPDIR}/$RANDOM.$RANDOM.$RANDOM.$$
print_info 2 "TMPDIR: ${TMPDIR}" print_info 2 "TMPDIR: ${TMPDIR}"
print_info 2 "TEMP: ${TEMP}" print_info 2 "TEMP: ${TEMP}"
;; ;;
--postclear) --postclear)
CMD_POSTCLEAR=1 CMD_POSTCLEAR=1
print_info 2 "CMD_POSTCLEAR: ${CMD_POSTCLEAR}" print_info 2 "CMD_POSTCLEAR: ${CMD_POSTCLEAR}"
;; ;;
--arch-override=*) --arch-override=*)
CMD_ARCHOVERRIDE=`parse_opt "$*"` CMD_ARCHOVERRIDE=`parse_opt "$*"`
print_info 2 "CMD_ARCHOVERRIDE: ${CMD_ARCHOVERRIDE}" print_info 2 "CMD_ARCHOVERRIDE: ${CMD_ARCHOVERRIDE}"

@ -517,10 +517,10 @@ compile_dmraid() {
rm -rf "${TEMP}/device-mapper" > /dev/null rm -rf "${TEMP}/device-mapper" > /dev/null
/bin/tar -jxpf "${DEVICE_MAPPER_BINCACHE}" -C "${TEMP}" || /bin/tar -jxpf "${DEVICE_MAPPER_BINCACHE}" -C "${TEMP}" ||
gen_die "Could not extract device-mapper binary cache!"; gen_die "Could not extract device-mapper binary cache!";
cd "${DMRAID_DIR}" cd "${DMRAID_DIR}"
print_info 1 'dmraid: >> Configuring...' print_info 1 'dmraid: >> Configuring...'
LDFLAGS="-L${TEMP}/device-mapper/lib" \ LDFLAGS="-L${TEMP}/device-mapper/lib" \
CFLAGS="-I${TEMP}/device-mapper/include" \ CFLAGS="-I${TEMP}/device-mapper/include" \
CPPFLAGS="-I${TEMP}/device-mapper/include" \ CPPFLAGS="-I${TEMP}/device-mapper/include" \

@ -73,7 +73,7 @@ config_kernel() {
else else
print_info 1 "kernel: --clean is disabled; not running 'make clean'." print_info 1 "kernel: --clean is disabled; not running 'make clean'."
fi fi
if isTrue ${MENUCONFIG} if isTrue ${MENUCONFIG}
then then
print_info 1 'kernel: >> Invoking menuconfig...' print_info 1 'kernel: >> Invoking menuconfig...'

@ -30,7 +30,7 @@ get_KV() {
SUB=`grep ^SUBLEVEL\ \= ${KERNEL_DIR}/Makefile | awk '{ print $3 };'` 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'` 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 then
# Handle O= build directories # Handle O= build directories
KERNEL_SOURCE_DIR=`grep ^MAKEARGS\ \:\= ${KERNEL_DIR}/Makefile | awk '{ print $4 };'` KERNEL_SOURCE_DIR=`grep ^MAKEARGS\ \:\= ${KERNEL_DIR}/Makefile | awk '{ print $4 };'`
@ -143,7 +143,7 @@ determine_real_args() {
FUSE_BINCACHE=`cache_replace "${FUSE_BINCACHE}"` FUSE_BINCACHE=`cache_replace "${FUSE_BINCACHE}"`
UNIONFS_FUSE_BINCACHE=`cache_replace "${UNIONFS_FUSE_BINCACHE}"` UNIONFS_FUSE_BINCACHE=`cache_replace "${UNIONFS_FUSE_BINCACHE}"`
GPG_BINCACHE=`cache_replace "${GPG_BINCACHE}"` GPG_BINCACHE=`cache_replace "${GPG_BINCACHE}"`
DEFAULT_KERNEL_CONFIG=`arch_replace "${DEFAULT_KERNEL_CONFIG}"` DEFAULT_KERNEL_CONFIG=`arch_replace "${DEFAULT_KERNEL_CONFIG}"`
BUSYBOX_CONFIG=`arch_replace "${BUSYBOX_CONFIG}"` BUSYBOX_CONFIG=`arch_replace "${BUSYBOX_CONFIG}"`
BUSYBOX_BINCACHE=`arch_replace "${BUSYBOX_BINCACHE}"` BUSYBOX_BINCACHE=`arch_replace "${BUSYBOX_BINCACHE}"`
@ -166,7 +166,7 @@ determine_real_args() {
BOOTLOADER=`echo "${CMD_BOOTLOADER}" | cut -f1 -d:` BOOTLOADER=`echo "${CMD_BOOTLOADER}" | cut -f1 -d:`
fi fi
fi fi
if [ "${NO_KERNEL_SOURCES}" != "1" ] if [ "${NO_KERNEL_SOURCES}" != "1" ]
then then
if [ ! -d ${KERNEL_DIR} ] if [ ! -d ${KERNEL_DIR} ]
@ -192,7 +192,7 @@ determine_real_args() {
fi fi
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. # imply --no-mrproper.
if [ "${CMD_CLEAN}" != '' ] if [ "${CMD_CLEAN}" != '' ]
then then
@ -201,12 +201,12 @@ determine_real_args() {
MRPROPER=0 MRPROPER=0
fi fi
fi fi
if [ -n "${MINKERNPACKAGE}" ] if [ -n "${MINKERNPACKAGE}" ]
then then
mkdir -p `dirname ${MINKERNPACKAGE}` mkdir -p `dirname ${MINKERNPACKAGE}`
fi fi
if [ -n "${MODULESPACKAGE}" ] if [ -n "${MODULESPACKAGE}" ]
then then
mkdir -p `dirname ${MODULESPACKAGE}` mkdir -p `dirname ${MODULESPACKAGE}`
@ -221,6 +221,6 @@ determine_real_args() {
then then
INTEGRATED_INITRAMFS=0 INTEGRATED_INITRAMFS=0
fi fi
get_KV get_KV
} }

@ -22,7 +22,7 @@ isTrue() {
return 1 return 1
} }
setColorVars() { setColorVars() {
if isTrue ${USECOLOR} if isTrue ${USECOLOR}
then then
GOOD=$'\e[32;01m' GOOD=$'\e[32;01m'
@ -144,7 +144,7 @@ print_info() {
DEBUGCACHE="${DEBUGCACHE}${STR}" DEBUGCACHE="${DEBUGCACHE}${STR}"
else else
echo -ne "${STR}" >> ${LOGFILE} echo -ne "${STR}" >> ${LOGFILE}
fi fi
else else
if [ "${TODEBUGCACHE}" = '1' ]; then if [ "${TODEBUGCACHE}" = '1' ]; then
DEBUGCACHE="${DEBUGCACHE}${STR}"$'\n' DEBUGCACHE="${DEBUGCACHE}${STR}"$'\n'
@ -178,7 +178,7 @@ var_replace()
# in the later sed expression # in the later sed expression
local SAFE_VAR local SAFE_VAR
SAFE_VAR=`echo "${2}" | sed -e 's/\([\/\.]\)/\\\\\\1/g'` SAFE_VAR=`echo "${2}" | sed -e 's/\([\/\.]\)/\\\\\\1/g'`
echo "${3}" | sed -e "s/%%${1}%%/${SAFE_VAR}/g" - echo "${3}" | sed -e "s/%%${1}%%/${SAFE_VAR}/g" -
} }
@ -194,7 +194,7 @@ clear_log() {
if [ -f "${LOGFILE}" ] if [ -f "${LOGFILE}" ]
then then
(echo > "${LOGFILE}") 2>/dev/null || small_die "Genkernel: Could not write to ${LOGFILE}." (echo > "${LOGFILE}") 2>/dev/null || small_die "Genkernel: Could not write to ${LOGFILE}."
fi fi
} }
gen_die() { gen_die() {
@ -267,7 +267,7 @@ then
rm ${TMPDIR}/${i} rm ${TMPDIR}/${i}
done done
fi fi
} }
# #
# Function to copy various kernel boot image products to the boot directory, # Function to copy various kernel boot image products to the boot directory,

@ -25,7 +25,7 @@ append_base_layout() {
echo "/dev/ram0 / ext2 defaults 0 0" > ${TEMP}/initramfs-base-temp/etc/fstab 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 echo "proc /proc proc defaults 0 0" >> ${TEMP}/initramfs-base-temp/etc/fstab
cd ${TEMP}/initramfs-base-temp/dev cd ${TEMP}/initramfs-base-temp/dev
mknod -m 660 console c 5 1 mknod -m 660 console c 5 1
mknod -m 660 null c 1 3 mknod -m 660 null c 1 3
@ -61,7 +61,7 @@ append_busybox() {
ln -s busybox ${TEMP}/initramfs-busybox-temp/bin/$i || ln -s busybox ${TEMP}/initramfs-busybox-temp/bin/$i ||
gen_die "Busybox error: could not link ${i}!" gen_die "Busybox error: could not link ${i}!"
done done
cd "${TEMP}/initramfs-busybox-temp/" cd "${TEMP}/initramfs-busybox-temp/"
find . -print | cpio ${CPIO_ARGS} --append -F "${CPIO}" \ find . -print | cpio ${CPIO_ARGS} --append -F "${CPIO}" \
|| gen_die "compressing busybox cpio" || gen_die "compressing busybox cpio"
@ -174,7 +174,7 @@ append_multipath(){
|| gen_die "Could not copy file ${i} for MULTIPATH" || gen_die "Could not copy file ${i} for MULTIPATH"
done done
if [ -x /sbin/multipath ] if [ -x /sbin/multipath ]
then then
cp /etc/multipath.conf "${TEMP}/initramfs-multipath-temp/etc/" || gen_die 'could not copy /etc/multipath.conf please check this' cp /etc/multipath.conf "${TEMP}/initramfs-multipath-temp/etc/" || gen_die 'could not copy /etc/multipath.conf please check this'
fi fi
@ -475,12 +475,12 @@ append_modules() {
else else
cd / cd /
fi fi
if [ -d "${TEMP}/initramfs-modules-${KV}-temp" ] if [ -d "${TEMP}/initramfs-modules-${KV}-temp" ]
then then
rm -r "${TEMP}/initramfs-modules-${KV}-temp/" rm -r "${TEMP}/initramfs-modules-${KV}-temp/"
fi 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` for i in `gen_dep_list`
do do
mymod=`find ./lib/modules/${KV} -name "${i}${MOD_EXT}" 2>/dev/null| head -n 1 ` mymod=`find ./lib/modules/${KV} -name "${i}${MOD_EXT}" 2>/dev/null| head -n 1 `
@ -489,11 +489,11 @@ append_modules() {
print_warning 2 "Warning :: ${i}${MOD_EXT} not found; skipping..." print_warning 2 "Warning :: ${i}${MOD_EXT} not found; skipping..."
continue; continue;
fi fi
print_info 2 "initramfs: >> Copying ${i}${MOD_EXT}..." print_info 2 "initramfs: >> Copying ${i}${MOD_EXT}..."
cp -ax --parents "${mymod}" "${TEMP}/initramfs-modules-${KV}-temp" cp -ax --parents "${mymod}" "${TEMP}/initramfs-modules-${KV}-temp"
done done
cp -ax --parents ./lib/modules/${KV}/modules* ${TEMP}/initramfs-modules-${KV}-temp 2>/dev/null cp -ax --parents ./lib/modules/${KV}/modules* ${TEMP}/initramfs-modules-${KV}-temp 2>/dev/null
mkdir -p "${TEMP}/initramfs-modules-${KV}-temp/etc/modules" mkdir -p "${TEMP}/initramfs-modules-${KV}-temp/etc/modules"
@ -519,13 +519,13 @@ append_auxilary() {
then then
rm -r "${TEMP}/initramfs-aux-temp/" rm -r "${TEMP}/initramfs-aux-temp/"
fi fi
mkdir -p "${TEMP}/initramfs-aux-temp/etc" mkdir -p "${TEMP}/initramfs-aux-temp/etc"
mkdir -p "${TEMP}/initramfs-aux-temp/sbin" mkdir -p "${TEMP}/initramfs-aux-temp/sbin"
if [ -f "${CMD_LINUXRC}" ] if [ -f "${CMD_LINUXRC}" ]
then then
cp "${CMD_LINUXRC}" "${TEMP}/initramfs-aux-temp/init" cp "${CMD_LINUXRC}" "${TEMP}/initramfs-aux-temp/init"
print_info 2 " >> Copying user specified linuxrc: ${CMD_LINUXRC} to init" print_info 2 " >> Copying user specified linuxrc: ${CMD_LINUXRC} to init"
else else
if isTrue ${NETBOOT} if isTrue ${NETBOOT}
then then
cp "${GK_SHARE}/netboot/linuxrc.x" "${TEMP}/initramfs-aux-temp/init" cp "${GK_SHARE}/netboot/linuxrc.x" "${TEMP}/initramfs-aux-temp/init"
@ -546,12 +546,12 @@ append_auxilary() {
# big cpio. # big cpio.
cd ${TEMP}/initramfs-aux-temp cd ${TEMP}/initramfs-aux-temp
ln -s init linuxrc 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" ] if [ -f "${GK_SHARE}/arch/${ARCH}/initrd.scripts" ]
then then
cp "${GK_SHARE}/arch/${ARCH}/initrd.scripts" "${TEMP}/initramfs-aux-temp/etc/initrd.scripts" 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" cp "${GK_SHARE}/defaults/initrd.scripts" "${TEMP}/initramfs-aux-temp/etc/initrd.scripts"
fi fi
@ -566,13 +566,13 @@ append_auxilary() {
then then
sed -i "s:^REAL_ROOT=.*$:REAL_ROOT='${REAL_ROOT}':" "${TEMP}/initramfs-aux-temp/etc/initrd.defaults" sed -i "s:^REAL_ROOT=.*$:REAL_ROOT='${REAL_ROOT}':" "${TEMP}/initramfs-aux-temp/etc/initrd.defaults"
fi 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 for group_modules in ${!MODULES_*}; do
group="$(echo $group_modules | cut -d_ -f2 | tr "[:upper:]" "[:lower:]")" group="$(echo $group_modules | cut -d_ -f2 | tr "[:upper:]" "[:lower:]")"
echo -n "${group} " >> "${TEMP}/initramfs-aux-temp/etc/initrd.defaults" echo -n "${group} " >> "${TEMP}/initramfs-aux-temp/etc/initrd.defaults"
done done
echo '"' >> "${TEMP}/initramfs-aux-temp/etc/initrd.defaults" echo '"' >> "${TEMP}/initramfs-aux-temp/etc/initrd.defaults"
if [ -f "${GK_SHARE}/arch/${ARCH}/modprobe" ] if [ -f "${GK_SHARE}/arch/${ARCH}/modprobe" ]
then then
@ -607,7 +607,7 @@ append_auxilary() {
find . -print | cpio ${CPIO_ARGS} --append -F "${CPIO}" \ find . -print | cpio ${CPIO_ARGS} --append -F "${CPIO}" \
|| gen_die "compressing auxilary cpio" || gen_die "compressing auxilary cpio"
cd "${TEMP}" cd "${TEMP}"
rm -r "${TEMP}/initramfs-aux-temp/" rm -r "${TEMP}/initramfs-aux-temp/"
} }
append_data() { append_data() {

@ -59,9 +59,9 @@ gen_dep_list()
if [ "${ALLRAMDISKMODULES}" = "1" ]; then if [ "${ALLRAMDISKMODULES}" = "1" ]; then
strip_mod_paths $(find "${INSTALL_MOD_PATH}/lib/modules/${KV}" -name "*$(modules_kext)") | sort strip_mod_paths $(find "${INSTALL_MOD_PATH}/lib/modules/${KV}" -name "*$(modules_kext)") | sort
else else
local group_modules local group_modules
rm -f ${TEMP}/moddeps > /dev/null rm -f ${TEMP}/moddeps > /dev/null
for group_modules in ${!MODULES_*}; do for group_modules in ${!MODULES_*}; do
gen_deps ${!group_modules} gen_deps ${!group_modules}
done done

@ -28,7 +28,7 @@ gen_minkernpackage() {
cp "${tmp_kernel_binary2}" "${TEMP}/minkernpackage/kernelz-${KV}" || gen_die "Could not copy the kernelz for the min kernel package" cp "${tmp_kernel_binary2}" "${TEMP}/minkernpackage/kernelz-${KV}" || gen_die "Could not copy the kernelz for the min kernel package"
fi fi
fi fi
if ! isTrue "${INTEGRATED_INITRAMFS}" if ! isTrue "${INTEGRATED_INITRAMFS}"
then then
[ "${BUILD_RAMDISK}" != '0' ] && { cp "${TMPDIR}/initramfs-${KV}" "${TEMP}/minkernpackage/initramfs-${ARCH}-${KV}" || gen_die 'Could not copy the initramfs for the kernel package!'; } [ "${BUILD_RAMDISK}" != '0' ] && { cp "${TMPDIR}/initramfs-${KV}" "${TEMP}/minkernpackage/initramfs-${ARCH}-${KV}" || gen_die 'Could not copy the initramfs for the kernel package!'; }
@ -40,8 +40,8 @@ gen_minkernpackage() {
else else
cp "${KERNEL_DIR}/System.map" "${TEMP}/minkernpackage/System.map-${ARCH}-${KV}" || gen_die 'Could not copy System.map for the kernel package!'; cp "${KERNEL_DIR}/System.map" "${TEMP}/minkernpackage/System.map-${ARCH}-${KV}" || gen_die 'Could not copy System.map for the kernel package!';
fi fi
cd "${TEMP}/minkernpackage" cd "${TEMP}/minkernpackage"
/bin/tar -jcpf ${MINKERNPACKAGE} * || gen_die 'Could not compress the kernel package!' /bin/tar -jcpf ${MINKERNPACKAGE} * || gen_die 'Could not compress the kernel package!'
cd "${TEMP}" && rm -rf "${TEMP}/minkernpackage" > /dev/null 2>&1 cd "${TEMP}" && rm -rf "${TEMP}/minkernpackage" > /dev/null 2>&1
} }
@ -84,27 +84,27 @@ gen_kerncache()
then then
cp "${tmp_kernel_binary2}" "${TEMP}/kerncache/kernelz-${ARCH}-${KV}" || gen_die "Could not copy the kernelz for the kernel package" cp "${tmp_kernel_binary2}" "${TEMP}/kerncache/kernelz-${ARCH}-${KV}" || gen_die "Could not copy the kernelz for the kernel package"
fi fi
echo "VERSION = ${VER}" > "${TEMP}/kerncache/kerncache.config" echo "VERSION = ${VER}" > "${TEMP}/kerncache/kerncache.config"
echo "PATCHLEVEL = ${PAT}" >> "${TEMP}/kerncache/kerncache.config" echo "PATCHLEVEL = ${PAT}" >> "${TEMP}/kerncache/kerncache.config"
echo "SUBLEVEL = ${SUB}" >> "${TEMP}/kerncache/kerncache.config" echo "SUBLEVEL = ${SUB}" >> "${TEMP}/kerncache/kerncache.config"
echo "EXTRAVERSION = ${EXV}" >> "${TEMP}/kerncache/kerncache.config" echo "EXTRAVERSION = ${EXV}" >> "${TEMP}/kerncache/kerncache.config"
mkdir -p "${TEMP}/kerncache/lib/modules/" mkdir -p "${TEMP}/kerncache/lib/modules/"
if [ -d ${INSTALL_MOD_PATH}/lib/modules/${KV} ] if [ -d ${INSTALL_MOD_PATH}/lib/modules/${KV} ]
then then
cp -r "${INSTALL_MOD_PATH}/lib/modules/${KV}" "${TEMP}/kerncache/lib/modules" cp -r "${INSTALL_MOD_PATH}/lib/modules/${KV}" "${TEMP}/kerncache/lib/modules"
fi fi
cd "${TEMP}/kerncache" cd "${TEMP}/kerncache"
/bin/tar -jcpf ${KERNCACHE} * || gen_die 'Could not compress the kernel package!' /bin/tar -jcpf ${KERNCACHE} * || gen_die 'Could not compress the kernel package!'
cd "${TEMP}" && rm -rf "${TEMP}/kerncache" > /dev/null 2>&1 cd "${TEMP}" && rm -rf "${TEMP}/kerncache" > /dev/null 2>&1
} }
gen_kerncache_extract_kernel() gen_kerncache_extract_kernel()
{ {
/bin/tar -f ${KERNCACHE} -C ${TEMP} -xj /bin/tar -f ${KERNCACHE} -C ${TEMP} -xj
copy_image_with_preserve "kernel" \ copy_image_with_preserve "kernel" \
"${TEMP}/kernel-${ARCH}-${KV}" \ "${TEMP}/kernel-${ARCH}-${KV}" \
"kernel-${KNAME}-${ARCH}-${KV}" "kernel-${KNAME}-${ARCH}-${KV}"
@ -115,7 +115,7 @@ gen_kerncache_extract_kernel()
"${TEMP}/kernelz-${ARCH}-${KV}" \ "${TEMP}/kernelz-${ARCH}-${KV}" \
"kernelz-${KNAME}-${ARCH}-${KV}" "kernelz-${KNAME}-${ARCH}-${KV}"
fi fi
copy_image_with_preserve "System.map" \ copy_image_with_preserve "System.map" \
"${TEMP}/System.map-${ARCH}-${KV}" \ "${TEMP}/System.map-${ARCH}-${KV}" \
"System.map-${KNAME}-${ARCH}-${KV}" "System.map-${KNAME}-${ARCH}-${KV}"
@ -123,7 +123,7 @@ gen_kerncache_extract_kernel()
gen_kerncache_extract_modules() gen_kerncache_extract_modules()
{ {
if [ -e "${KERNCACHE}" ] if [ -e "${KERNCACHE}" ]
then then
print_info 1 'Extracting kerncache kernel modules' print_info 1 'Extracting kerncache kernel modules'
if [ "${INSTALL_MOD_PATH}" != '' ] if [ "${INSTALL_MOD_PATH}" != '' ]
@ -137,7 +137,7 @@ gen_kerncache_extract_modules()
gen_kerncache_extract_config() gen_kerncache_extract_config()
{ {
if [ -e "${KERNCACHE}" ] if [ -e "${KERNCACHE}" ]
then then
print_info 1 'Extracting kerncache config to /etc/kernels' print_info 1 'Extracting kerncache config to /etc/kernels'
mkdir -p /etc/kernels mkdir -p /etc/kernels
@ -156,13 +156,13 @@ gen_kerncache_is_valid()
# Can make this more secure .... # Can make this more secure ....
/bin/tar -xj -f ${KERNCACHE} -C ${TEMP} /bin/tar -xj -f ${KERNCACHE} -C ${TEMP}
if [ -e ${TEMP}/config-${ARCH}-${KV} -a -e ${TEMP}/kernel-${ARCH}-${KV} ] if [ -e ${TEMP}/config-${ARCH}-${KV} -a -e ${TEMP}/kernel-${ARCH}-${KV} ]
then then
print_info 1 'Valid kernel cache found; no sources will be used' print_info 1 'Valid kernel cache found; no sources will be used'
KERNCACHE_IS_VALID=1 KERNCACHE_IS_VALID=1
fi fi
else else
if [ -e "${KERNCACHE}" ] if [ -e "${KERNCACHE}" ]
then then
KERNEL_CONFIG="/${KERNEL_DIR}/.config" KERNEL_CONFIG="/${KERNEL_DIR}/.config"
if [ "${CMD_KERNEL_CONFIG}" != '' ] if [ "${CMD_KERNEL_CONFIG}" != '' ]
@ -183,7 +183,6 @@ gen_kerncache_is_valid()
test2=$(grep -v "^#" ${KERNEL_CONFIG} | md5sum | cut -d " " -f 1) test2=$(grep -v "^#" ${KERNEL_CONFIG} | md5sum | cut -d " " -f 1)
if [ "${test1}" == "${test2}" ] if [ "${test1}" == "${test2}" ]
then then
echo echo
print_info 1 "No kernel configuration change, skipping kernel build..." print_info 1 "No kernel configuration change, skipping kernel build..."
echo echo
@ -192,6 +191,6 @@ gen_kerncache_is_valid()
fi fi
fi fi
fi fi
export KERNCACHE_IS_VALID export KERNCACHE_IS_VALID
return 1 return 1
} }

Loading…
Cancel
Save