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=${x#*=}
;;
# Start Volume manager options
# Start Volume manager options
dolvm)
USE_LVM_NORMAL=1
;;
@ -100,7 +100,7 @@ do
debug)
DEBUG='yes'
;;
# Scan delay options
# Scan delay options
scandelay=*)
SDELAY=${x#*=}
;;
@ -228,30 +228,12 @@ do
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'
@ -325,22 +307,22 @@ then
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}"
@ -362,7 +344,7 @@ if [ "${CDROOT}" = '1' ]
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}"
@ -393,7 +375,7 @@ then
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
@ -428,26 +410,26 @@ do
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}"
@ -458,7 +440,7 @@ do
fi
;;
esac
if [ "${REAL_ROOT}" = '' ]
then
# 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}
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
@ -613,7 +595,7 @@ 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 /'
@ -631,7 +613,7 @@ then
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})
@ -645,7 +627,7 @@ then
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}")

@ -42,7 +42,7 @@ get_official_arch() {
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}"
}

@ -60,7 +60,7 @@ set_bootloader_grub() {
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' ]
@ -109,7 +109,7 @@ set_bootloader_grub_check_for_existing_entry() {
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

@ -422,11 +422,11 @@ parse_cmdline() {
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}"

@ -517,10 +517,10 @@ compile_dmraid() {
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" \

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

@ -30,7 +30,7 @@ get_KV() {
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 };'`
@ -143,7 +143,7 @@ determine_real_args() {
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}"`
@ -166,7 +166,7 @@ determine_real_args() {
BOOTLOADER=`echo "${CMD_BOOTLOADER}" | cut -f1 -d:`
fi
fi
if [ "${NO_KERNEL_SOURCES}" != "1" ]
then
if [ ! -d ${KERNEL_DIR} ]
@ -192,7 +192,7 @@ determine_real_args() {
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
@ -201,12 +201,12 @@ determine_real_args() {
MRPROPER=0
fi
fi
if [ -n "${MINKERNPACKAGE}" ]
then
mkdir -p `dirname ${MINKERNPACKAGE}`
fi
if [ -n "${MODULESPACKAGE}" ]
then
mkdir -p `dirname ${MODULESPACKAGE}`
@ -221,6 +221,6 @@ determine_real_args() {
then
INTEGRATED_INITRAMFS=0
fi
get_KV
}

@ -22,7 +22,7 @@ isTrue() {
return 1
}
setColorVars() {
setColorVars() {
if isTrue ${USECOLOR}
then
GOOD=$'\e[32;01m'
@ -144,7 +144,7 @@ print_info() {
DEBUGCACHE="${DEBUGCACHE}${STR}"
else
echo -ne "${STR}" >> ${LOGFILE}
fi
fi
else
if [ "${TODEBUGCACHE}" = '1' ]; then
DEBUGCACHE="${DEBUGCACHE}${STR}"$'\n'
@ -178,7 +178,7 @@ var_replace()
# 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" -
}
@ -194,7 +194,7 @@ clear_log() {
if [ -f "${LOGFILE}" ]
then
(echo > "${LOGFILE}") 2>/dev/null || small_die "Genkernel: Could not write to ${LOGFILE}."
fi
fi
}
gen_die() {
@ -267,7 +267,7 @@ then
rm ${TMPDIR}/${i}
done
fi
}
}
#
# 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 "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
@ -61,7 +61,7 @@ append_busybox() {
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"
@ -174,7 +174,7 @@ append_multipath(){
|| 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
@ -475,12 +475,12 @@ append_modules() {
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 `
@ -489,11 +489,11 @@ append_modules() {
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"
@ -519,13 +519,13 @@ append_auxilary() {
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"
@ -546,12 +546,12 @@ append_auxilary() {
# 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
@ -566,13 +566,13 @@ append_auxilary() {
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
@ -607,7 +607,7 @@ append_auxilary() {
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() {

@ -59,9 +59,9 @@ gen_dep_list()
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

@ -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"
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!'; }
@ -40,8 +40,8 @@ gen_minkernpackage() {
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
}
@ -84,27 +84,27 @@ gen_kerncache()
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}"
@ -115,7 +115,7 @@ gen_kerncache_extract_kernel()
"${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}"
@ -123,7 +123,7 @@ gen_kerncache_extract_kernel()
gen_kerncache_extract_modules()
{
if [ -e "${KERNCACHE}" ]
if [ -e "${KERNCACHE}" ]
then
print_info 1 'Extracting kerncache kernel modules'
if [ "${INSTALL_MOD_PATH}" != '' ]
@ -137,7 +137,7 @@ gen_kerncache_extract_modules()
gen_kerncache_extract_config()
{
if [ -e "${KERNCACHE}" ]
if [ -e "${KERNCACHE}" ]
then
print_info 1 'Extracting kerncache config to /etc/kernels'
mkdir -p /etc/kernels
@ -156,13 +156,13 @@ gen_kerncache_is_valid()
# 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}" != '' ]
@ -183,7 +183,6 @@ gen_kerncache_is_valid()
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
@ -192,6 +191,6 @@ gen_kerncache_is_valid()
fi
fi
fi
export KERNCACHE_IS_VALID
export KERNCACHE_IS_VALID
return 1
}

Loading…
Cancel
Save