summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Pipping2011-01-07 02:45:39 (GMT)
committerSebastian Pipping2011-01-07 03:01:28 (GMT)
commit532dd7a3871e389351d115fb19db73532bb6dd5b (patch)
tree6cb9e80ab8b3e30cc83af41b876dd24cca5b7fc0
parent0e1fd6c173ca059320aac2e5a215f5d629e453e5 (diff)
Review and fix some -eq and -ne conditionals
This fixes "sh: bad number" with busybox 1.18.1 during activation of mdev.
-rwxr-xr-xdefaults/initrd.scripts18
-rwxr-xr-xdefaults/linuxrc20
-rwxr-xr-xdefaults/modprobe2
-rwxr-xr-xgen_bootloader.sh2
-rwxr-xr-xgen_compile.sh2
-rwxr-xr-xgen_funcs.sh22
-rwxr-xr-xgen_initramfs.sh8
-rwxr-xr-xgen_package.sh2
-rwxr-xr-xgenkernel42
9 files changed, 59 insertions, 59 deletions
diff --git a/defaults/initrd.scripts b/defaults/initrd.scripts
index e0710c4..2b6834e 100755
--- a/defaults/initrd.scripts
+++ b/defaults/initrd.scripts
@@ -212,7 +212,7 @@ cache_cd_contents() {
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() {
@@ -351,7 +351,7 @@ warn_msg() {
}
crypt_filter() {
- if [ ${CRYPT_SILENT} -eq 1 ]
+ if [ "${CRYPT_SILENT}" = '1' ]
then
eval $1 >/dev/null 2>/dev/null
else
@@ -507,7 +507,7 @@ setup_keymap() {
[ "${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
@@ -573,7 +573,7 @@ chooseKeymap() {
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
@@ -604,7 +604,7 @@ startVolumes() {
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
@@ -755,7 +755,7 @@ openLUKS() {
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
@@ -926,7 +926,7 @@ setup_md_device() {
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
@@ -1059,7 +1059,7 @@ setup_unionfs() {
# # 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
@@ -1084,7 +1084,7 @@ setup_unionfs() {
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
diff --git a/defaults/linuxrc b/defaults/linuxrc
index 0bf7316..adaab62 100755
--- a/defaults/linuxrc
+++ b/defaults/linuxrc
@@ -238,7 +238,7 @@ do
# 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%,*}`
@@ -250,7 +250,7 @@ do
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
@@ -318,22 +318,22 @@ then
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
@@ -425,22 +425,22 @@ do
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
diff --git a/defaults/modprobe b/defaults/modprobe
index 8790122..ba2d890 100755
--- a/defaults/modprobe
+++ b/defaults/modprobe
@@ -112,7 +112,7 @@ modprobe2() {
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=', '
diff --git a/gen_bootloader.sh b/gen_bootloader.sh
index 9b1deef..3e6f98b 100755
--- a/gen_bootloader.sh
+++ b/gen_bootloader.sh
@@ -63,7 +63,7 @@ set_bootloader_grub() {
# 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
diff --git a/gen_compile.sh b/gen_compile.sh
index 7bab9e1..1a59dff 100755
--- a/gen_compile.sh
+++ b/gen_compile.sh
@@ -264,7 +264,7 @@ compile_generic() {
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
diff --git a/gen_funcs.sh b/gen_funcs.sh
index e4a1c4a..074ae0d 100755
--- a/gen_funcs.sh
+++ b/gen_funcs.sh
@@ -94,7 +94,7 @@ print_info() {
# 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
@@ -106,7 +106,7 @@ print_info() {
fi
# STRUCTURE DATA TO BE OUTPUT TO SCREEN, AND OUTPUT IT
- if [ "${SCRPRINT}" -eq '1' ]
+ if [ "${SCRPRINT}" = '1' ]
then
if [ "${PREFIXLINE}" = '1' ]
then
@@ -124,7 +124,7 @@ print_info() {
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}/}
@@ -140,13 +140,13 @@ print_info() {
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}
@@ -303,7 +303,7 @@ copy_image_with_preserve() {
# 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}" ]
@@ -349,7 +349,7 @@ copy_image_with_preserve() {
# 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}"
@@ -367,7 +367,7 @@ copy_image_with_preserve() {
#
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
@@ -395,14 +395,14 @@ copy_image_with_preserve() {
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" ||
@@ -486,7 +486,7 @@ set_config_with_override() {
fi
fi
- if [ "$VarType" -eq "1" ]
+ if [ "${VarType}" = "1" ]
then
if isTrue "${Result}"
then
diff --git a/gen_initramfs.sh b/gen_initramfs.sh
index 231411e..d735eef 100755
--- a/gen_initramfs.sh
+++ b/gen_initramfs.sh
@@ -74,7 +74,7 @@ append_blkid(){
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/"
@@ -278,7 +278,7 @@ append_evms(){
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
@@ -328,7 +328,7 @@ append_mdadm(){
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!"
@@ -627,7 +627,7 @@ create_initramfs() {
append_data 'luks' "${LUKS}"
append_data 'multipath' "${MULTIPATH}"
- if [ "${NORAMDISKMODULES}" -eq '0' ]
+ if [ "${NORAMDISKMODULES}" = '0' ]
then
append_data 'modules'
else
diff --git a/gen_package.sh b/gen_package.sh
index 60cbce0..a0a6bd0 100755
--- a/gen_package.sh
+++ b/gen_package.sh
@@ -31,7 +31,7 @@ gen_minkernpackage() {
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}" != "" ]
diff --git a/genkernel b/genkernel
index 9326dff..c8a6614 100755
--- a/genkernel
+++ b/genkernel
@@ -86,7 +86,7 @@ do
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
@@ -200,7 +200,7 @@ then
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
@@ -217,12 +217,12 @@ then
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
@@ -240,7 +240,7 @@ fi
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
@@ -254,13 +254,13 @@ then
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
@@ -268,7 +268,7 @@ then
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..."
@@ -277,11 +277,11 @@ then
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
@@ -298,7 +298,7 @@ else
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
@@ -311,7 +311,7 @@ fi
# Clean up...
[ -n "${CTEMP}" ] && rm -rf "${TEMP}"
-if [ "${BUILD_KERNEL}" -eq '1' ]
+if [ "${BUILD_KERNEL}" = '1' ]
then
if ! isTrue "${CMD_NOINSTALL}"
then
@@ -321,7 +321,7 @@ 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 ]'
@@ -341,17 +341,17 @@ then
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}