This fixes "sh: bad number" with busybox 1.18.1 during activation of mdev.
mount_sysfs() {
mount -t sysfs /sys /sys >/dev/null 2>&1
ret=$?
- [ "$ret" -eq '0' ] || bad_msg "Failed to mount /sys!"
+ [ ${ret} -eq 0 ] || bad_msg "Failed to mount /sys!"
}
findnfsmount() {
}
crypt_filter() {
- if [ ${CRYPT_SILENT} -eq 1 ]
+ if [ "${CRYPT_SILENT}" = '1' ]
then
eval $1 >/dev/null 2>/dev/null
else
[ "${DEVBIND}" = '1' ] && umount /dev
- if [ -e /etc/sysconfig/keyboard -a "${CDROOT}" -eq '1' ]
+ if [ -e /etc/sysconfig/keyboard -a "${CDROOT}" = '1' ]
then
mkdir -p ${NEW_ROOT}/etc/sysconfig/
cp /etc/sysconfig/keyboard ${NEW_ROOT}/etc/sysconfig/keyboard
loadkmap < /lib/keymaps/${keymap}.map
# xkeymap=${keymap}
# echo ${keymap} | egrep -e "[0-9]+" >/dev/null 2>&1
-# if [ "$?" -eq '0' ]
+# if [ $? -eq 0 ]
# then
# xkeymap=`tail -n 7 /lib/keymaps/keymapList | grep ${keymap} | sed -r "s/.*\s+${keymap}\s+([a-z-]+).*/\1/g" | egrep -v 1`
# fi
ln -sf /dev/device-mapper /dev/mapper/control
fi
- if [ "${USE_MDADM}" -eq '1' ]
+ if [ "${USE_MDADM}" = '1' ]
then
if [ ! -e '/etc/mdadm.conf' ]
then
else
setup_md_device ${LUKS_DEVICE}
cryptsetup isLuks ${LUKS_DEVICE}
- if [ ! "$?" -eq '0' ]
+ if [ $? -ne 0 ]
then
bad_msg "The LUKS device ${LUKS_DEVICE} does not contain a LUKS header" ${CRYPT_SILENT}
DEV_ERROR=1
if [ ! -e /dev/md${MD_NUMBER} ]
then
mknod /dev/md${MD_NUMBER} b 9 ${MD_NUMBER} >/dev/null 2>&1
- [ "$?" -ne 0 ] && bad_msg "Creation of /dev/md${MD_NUMBER} failed..."
+ [ $? -ne 0 ] && bad_msg "Creation of /dev/md${MD_NUMBER} failed..."
fi
mdstart ${MDPART} /dev/md${MD_NUMBER}
fi
# # mount tmpfs only in the case when changes= boot parameter was
# # empty or we were not able to mount the storage device
# ret=$?
-# if [ "${ret}" -ne 0 ]
+# if [ ${ret} -ne 0 ]
# then
# bad_msg "mount of $CHANGESDEV failed falling back to ramdisk based unionfs"
# mount -t tmpfs tmpfs $MEMORY
good_msg "Creating union mount"
unionfs -o allow_other,cow,noinitgroups,suid,dev,default_permissions,use_ino ${rw_dir}=RW:${ro_dir}=RO ${UNION} 2>/dev/null
ret=$?
- if [ "${ret}" -ne 0 ]
+ if [ ${ret} -ne 0 ]
then
bad_msg "Can't setup union mount!"
USE_UNIONFS_NORMAL=0
# USE_UNIONFS_NORMAL=1
# CMD_UNIONFS=`parse_opt "${x}"`
# echo ${CMD_UNIONFS}|grep , >/dev/null 2>&1
-# if [ "$?" -eq '0' ]
+# if [ $? -eq 0 ]
# then
# UID=`echo ${CMD_UNIONFS#*,}`
# UNIONFS=`echo ${CMD_UNIONFS%,*}`
esac
done
-if [ -z "${REAL_ROOT}" -a \( "${CDROOT}" -eq 0 \) -a \( "${FAKE_ROOT}" != "/dev/ram0" \) ]
+if [ -z "${REAL_ROOT}" -a \( "${CDROOT}" = '0' \) -a \( "${FAKE_ROOT}" != "/dev/ram0" \) ]
then
REAL_ROOT="${FAKE_ROOT}"
fi
RESUME_DEV=""
retval=1
- if [ "${retval}" -ne '0' ]; then
+ if [ ${retval} -ne 0 ]; then
RESUME_DEV=`findfs "${REAL_RESUME}" 2>/dev/null`
retval=$?
fi
- if [ "$retval" -ne '0' ]; then
+ if [ ${retval} -ne 0 ]; then
RESUME_DEV=`busybox findfs "${REAL_RESUME}" 2>/dev/null`
retval=$?
fi
- if [ "${retval}" -ne '0' ]; then
+ if [ ${retval} -ne 0 ]; then
RESUME_DEV=`blkid -t "${REAL_RESUME}" | cut -d ":" -f 1 2>/dev/null`
retval=$?
fi
- if [ "${retval}" -eq '0' ] && [ -n "${RESUME_DEV}" ]; then
+ if [ ${retval} -eq 0 ] && [ -n "${RESUME_DEV}" ]; then
good_msg "Detected real_resume=${RESUME_DEV}"
REAL_RESUME="${RESUME_DEV}"
fi
ROOT_DEV=""
retval=1
- if [ "${retval}" -ne '0' ]; then
+ if [ ${retval} -ne 0 ]; then
ROOT_DEV=`findfs "${REAL_ROOT}" 2>/dev/null`
retval=$?
fi
- if [ "$retval" -ne '0' ]; then
+ if [ ${retval} -ne 0 ]; then
ROOT_DEV=`busybox findfs "${REAL_ROOT}" 2>/dev/null`
retval=$?
fi
- if [ "${retval}" -ne '0' ]; then
+ if [ ${retval} -ne 0 ]; then
ROOT_DEV=`blkid -t "${REAL_ROOT}" | cut -d ":" -f 1 2>/dev/null`
retval=$?
fi
- if [ "${retval}" -eq '0' ] && [ -n "${ROOT_DEV}" ]; then
+ if [ ${retval} -eq 0 ] && [ -n "${ROOT_DEV}" ]; then
good_msg "Detected real_root=${ROOT_DEV}"
REAL_ROOT="${ROOT_DEV}"
else
done
${INSMOD} ${real_path} > /dev/null 2>&1
ret=$?
- if [ "$ret" -eq '0' ]
+ if [ ${ret} -eq 0 ]
then
echoAppend=' loaded.'
[ "${2}" = '-n' ] && echoFlags='-n' && echoAppend=', '
# 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}" -eq '0' ]
+ if [ "${BUILD_INITRD}" = '0' ]
then
echo -e "\tkernel /kernel-${KNAME}-${ARCH}-${KV} root=${GRUB_ROOTFS}" >> ${GRUB_CONF}
else
eval ${MAKE} ${MAKEOPTS} ${ARGS} ${target} $* >> ${LOGFILE} 2>&1
RET=$?
fi
- [ "${RET}" -ne '0' ] &&
+ [ ${RET} -ne 0 ] &&
gen_die "Failed to compile the \"${target}\" target..."
unset MAKE
# PRINT TO SCREEN ONLY IF PASSED LOGLEVEL IS HIGHER THAN
# OR EQUAL TO SET DEBUG LEVEL
- if [ "$1" -lt "${LOGLEVEL}" -o "$1" -eq "${LOGLEVEL}" ]
+ if [ "$1" -lt "${LOGLEVEL}" -o "$1" = "${LOGLEVEL}" ]
then
SCRPRINT='1'
fi
fi
# STRUCTURE DATA TO BE OUTPUT TO SCREEN, AND OUTPUT IT
- if [ "${SCRPRINT}" -eq '1' ]
+ if [ "${SCRPRINT}" = '1' ]
then
if [ "${PREFIXLINE}" = '1' ]
then
fi
# STRUCTURE DATA TO BE OUTPUT TO FILE, AND OUTPUT IT
- if [ "${SCRPRINT}" -eq '1' -o "${FORCEFILE}" -eq '1' ]
+ if [ "${SCRPRINT}" = '1' -o "${FORCEFILE}" = '1' ]
then
STRR=${2//${WARN}/}
STRR=${STRR//${BAD}/}
if [ "${NEWLINE}" = '0' ]
then
- if [ "${TODEBUGCACHE}" -eq '1' ]; then
+ if [ "${TODEBUGCACHE}" = '1' ]; then
DEBUGCACHE="${DEBUGCACHE}${STR}"
else
echo -ne "${STR}" >> ${LOGFILE}
fi
else
- if [ "${TODEBUGCACHE}" -eq '1' ]; then
+ if [ "${TODEBUGCACHE}" = '1' ]; then
DEBUGCACHE="${DEBUGCACHE}${STR}"$'\n'
else
echo "${STR}" >> ${LOGFILE}
# Old product might be a different version. If so, we need to read
# the symlink to see what it's name is, if there are symlinks.
- if [ "${SYMLINK}" -eq '1' ]
+ if [ "${SYMLINK}" = '1' ]
then
print_info 4 "automatically managing symlinks and old images." 1 0
if [ -e "${BOOTDIR}/${symlinkName}" ]
# When symlinks are not being managed by genkernel, old symlinks might
# still be useful. Leave 'em alone unless managed.
- if [ "${SYMLINK}" -eq '1' ]
+ if [ "${SYMLINK}" = '1' ]
then
print_info 5 " Deleting old symlinks, if any."
rm -f "${BOOTDIR}/${symlinkName}"
#
print_info 5 " Same base version. May have to delete old image to make room."
- if [ "${currDestImageExists}" -eq '1' ]
+ if [ "${currDestImageExists}" = '1' ]
then
if [ -e "${BOOTDIR}/${currDestImage}.old" ]
then
cp "${newSrceImage}" "${BOOTDIR}/${currDestImage}" ||
gen_die "Could not copy the ${symlinkName} image to ${BOOTDIR}!"
- if [ "${SYMLINK}" -eq '1' ]
+ if [ "${SYMLINK}" = '1' ]
then
print_info 5 " Make new symlink(s) (from ${BOOTDIR}):"
print_info 5 " ${symlinkName} -> ${currDestImage}"
pushd ${BOOTDIR} >/dev/null
ln -s "${currDestImage}" "${symlinkName}" ||
gen_die "Could not create the ${symlinkName} symlink!"
- if [ "${prevDestImageExists}" -eq '1' ]
+ if [ "${prevDestImageExists}" = '1' ]
then
print_info 5 " ${symlinkName}.old -> ${prevDestImage}"
ln -s "${prevDestImage}" "${symlinkName}.old" ||
fi
fi
- if [ "$VarType" -eq "1" ]
+ if [ "${VarType}" = "1" ]
then
if isTrue "${Result}"
then
fi
cd ${TEMP}
mkdir -p "${TEMP}/initramfs-blkid-temp/bin/"
- [ "${DISKLABEL}" -eq '1' ] && { /bin/bzip2 -dc "${BLKID_BINCACHE}" > "${TEMP}/initramfs-blkid-temp/bin/blkid" ||
+ [ "${DISKLABEL}" = '1' ] && { /bin/bzip2 -dc "${BLKID_BINCACHE}" > "${TEMP}/initramfs-blkid-temp/bin/blkid" ||
gen_die "Could not extract blkid binary cache!"; }
chmod a+x "${TEMP}/initramfs-blkid-temp/bin/blkid"
cd "${TEMP}/initramfs-blkid-temp/"
mkdir -p "${TEMP}/initramfs-evms-temp/etc/"
mkdir -p "${TEMP}/initramfs-evms-temp/bin/"
mkdir -p "${TEMP}/initramfs-evms-temp/sbin/"
- if [ "${EVMS}" -eq '1' ]
+ if [ "${EVMS}" = '1' ]
then
print_info 1 ' EVMS: Adding support...'
mkdir -p ${TEMP}/initramfs-evms-temp/lib
fi
cd ${TEMP}
mkdir -p "${TEMP}/initramfs-mdadm-temp/etc/"
- if [ "${MDADM}" -eq '1' ]
+ if [ "${MDADM}" = '1' ]
then
cp -a /etc/mdadm.conf "${TEMP}/initramfs-mdadm-temp/etc" \
|| gen_die "Could not copy mdadm.conf!"
append_data 'luks' "${LUKS}"
append_data 'multipath' "${MULTIPATH}"
- if [ "${NORAMDISKMODULES}" -eq '0' ]
+ if [ "${NORAMDISKMODULES}" = '0' ]
then
append_data 'modules'
else
if ! isTrue "${INTEGRATED_INITRAMFS}"
then
- [ "${BUILD_RAMDISK}" -ne 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!'; }
fi
if [ "${KERNCACHE}" != "" ]
done
# Check if no action is specified...
-if [ "${BUILD_KERNEL}" -eq '0' -a "${BUILD_RAMDISK}" -eq '0' ]
+if [ "${BUILD_KERNEL}" = '0' -a "${BUILD_RAMDISK}" = '0' ]
then
usage
exit 1
gen_kerncache_is_valid
fi
-if [ ${BUILD_KERNEL} -eq '1' -a "${KERNCACHE_IS_VALID}" == "0" ]
+if [ ${BUILD_KERNEL} = '1' -a "${KERNCACHE_IS_VALID}" = '0' ]
then
# Configure kernel
config_kernel
compile_kernel
# Compile modules
- if [ ${BUILD_MODULES} -eq '1' -a ${BUILD_STATIC} -eq '0' ]
+ if [ "${BUILD_MODULES}" = '1' -a "${BUILD_STATIC}" = '0' ]
then
compile_modules
fi
- if [ ${SAVE_CONFIG} -eq '1' ]
+ if [ "${SAVE_CONFIG}" = '1' ]
then
print_info 1 "Copying config for successful build to /etc/kernels/kernel-config-${ARCH}-${KV}"
[ ! -e '/etc/kernels' ] && mkdir -p /etc/kernels
if [ "${KERNCACHE}" != "" -a "${KERNCACHE_IS_VALID}" != "0" ]
then
- [ ${BUILD_STATIC} -eq '0' ] && gen_kerncache_extract_modules
+ [ "${BUILD_STATIC}" = '0' ] && gen_kerncache_extract_modules
gen_kerncache_extract_config
fi
CALLBACK_COUNT=0
trap "CALLBACK_ESCAPE=1" TERM KILL INT QUIT ABRT
- while [[ ${CALLBACK_ESCAPE} -eq '0' && ${CALLBACK_COUNT} -lt 5 ]]
+ while [[ "${CALLBACK_ESCAPE}" = '0' && ${CALLBACK_COUNT} -lt 5 ]]
do
sleep 1; echo -n '.';
let CALLBACK_COUNT=${CALLBACK_COUNT}+1
done
- if [ "${CALLBACK_ESCAPE}" -eq '0' ]
+ if [ "${CALLBACK_ESCAPE}" = '0' ]
then
echo
echo
CMD_STATUS="${PIPESTATUS[0]}"
echo
print_info 1 "<<< Callback exit status: ${CMD_STATUS}"
- [ "${CMD_STATUS}" -ne 0 ] && gen_die '--callback failed!'
+ [ "${CMD_STATUS}" != '0' ] && gen_die '--callback failed!'
else
echo
print_info 1 ">>> Callback cancelled..."
print_info 1 "" 1 0
fi
-if [ "${BUILD_RAMDISK}" -eq '1' ]
+if [ "${BUILD_RAMDISK}" = '1' ]
then
- [ "${DISKLABEL}" -eq '1' ] && compile_e2fsprogs
+ [ "${DISKLABEL}" = '1' ] && compile_e2fsprogs
- if [ "${BUSYBOX}" -eq '1' ]
+ if [ "${BUSYBOX}" = '1' ]
then
# Compile Busybox
compile_busybox
print_info 1 'initrd: Not building since only the kernel was requested...'
fi
-if isTrue "${INTEGRATED_INITRAMFS}" #|| [ ${BUILD_KERNEL} -eq '1' -a "${KERNCACHE_IS_VALID}" == "0" ]
+if isTrue "${INTEGRATED_INITRAMFS}" #|| [ "${BUILD_KERNEL}" = '1' -a "${KERNCACHE_IS_VALID}" == "0" ]
then
# We build the kernel a second time to include the initramfs
compile_kernel
# Clean up...
[ -n "${CTEMP}" ] && rm -rf "${TEMP}"
-if [ "${BUILD_KERNEL}" -eq '1' ]
+if [ "${BUILD_KERNEL}" = '1' ]
then
if ! isTrue "${CMD_NOINSTALL}"
then
print_info 1 "Kernel compiled successfully!"
print_info 1 ''
print_info 1 'Required Kernel Parameters:'
- if [ "${BUILD_RAMDISK}" -eq '0' ]
+ if [ "${BUILD_RAMDISK}" = '0' ]
then
print_info 1 ' root=/dev/$ROOT'
print_info 1 ' [ And "vga=0x317 splash=verbose" if you use a framebuffer ]'
fi
fi
-if [ "${BUILD_RAMDISK}" -eq '1' ]
+if [ "${BUILD_RAMDISK}" = '1' ]
then
echo
print_info 1 'WARNING... WARNING... WARNING...'
print_info 1 'Additional kernel cmdline arguments that *may* be required to boot properly...'
- [ "${SPLASH}" -eq '1' ] && print_info 1 "add \"vga=791 splash=silent,theme:${SPLASH_THEME} console=tty1 quiet\" if you use a splash framebuffer ]"
- [ "${LVM}" -eq '1' ] && print_info 1 'add "dolvm" for lvm support'
- [ "${EVMS}" -eq '1' ] && print_info 1 'add "doevms" for evms support'
- [ "${DMRAID}" -eq '1' ] && print_info 1 'add "dodmraid" for dmraid support'
- [ "${DMRAID}" -eq '1' ] && print_info 1 ' or "dodmraid=<additional options>"'
- [ "${ISCSI}" -eq '1' ] && print_info 1 'add at least "iscsi_initiatorname=<initiator name> iscsi_target=<target name> and iscsi_address=<target ip>" for iscsi support'
+ [ "${SPLASH}" = '1' ] && print_info 1 "add \"vga=791 splash=silent,theme:${SPLASH_THEME} console=tty1 quiet\" if you use a splash framebuffer ]"
+ [ "${LVM}" = '1' ] && print_info 1 'add "dolvm" for lvm support'
+ [ "${EVMS}" = '1' ] && print_info 1 'add "doevms" for evms support'
+ [ "${DMRAID}" = '1' ] && print_info 1 'add "dodmraid" for dmraid support'
+ [ "${DMRAID}" = '1' ] && print_info 1 ' or "dodmraid=<additional options>"'
+ [ "${ISCSI}" = '1' ] && print_info 1 'add at least "iscsi_initiatorname=<initiator name> iscsi_target=<target name> and iscsi_address=<target ip>" for iscsi support'
fi
[ "${BOOTRW}" != '' ] && mount -o remount,ro ${BOOTDIR}