Skip to contentSkip to conversation

fix bashism for a few scripts

PATCH New [email protected] 1 participant 5 messages Aug 2, 2013

lore
Share & tools
lore
#0 lore raw

cover fix bashism for a few scripts

From: Chen Qi <[email protected]>

I used the checkbashism command to check our OE repo. This patchset fixes the auto-detected bashism.

The following changes since commit bd1c441a210cae03fb6006c996227211cc29056b:

bitbake: bitbake: runqueue: add warning if invalidating invalid task (2013-07-29 15:25:09 +0100)

are available in the git repository at:

git://git.pokylinux.org/poky-contrib ChenQi/fix-bashism
http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=ChenQi/fix-bashism

Chen Qi (4):
scripts/contrib/mkefidisk.sh: fix bashism
qtdemo-init: fix bashism
xtscal: fix bashism
initramfs-framework: fix bashism

 .../initrdscripts/initramfs-framework/finish       |    5 +++--
 .../initrdscripts/initramfs-framework/init         |   13 +++++++------
 .../xtscal/xtscal/30xTs_Calibrate.sh               |    2 +-
 meta/recipes-qt/qt-demo/qt-demo-init/qtdemo-init   |    8 ++++----
 scripts/contrib/mkefidisk.sh                       |    8 ++++----
 5 files changed, 19 insertions(+), 17 deletions(-)
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH 1/4 scripts/contrib/mkefidisk.sh: fix bashism

From: Chen Qi <[email protected]>

Remove the function keyword.

---
 scripts/contrib/mkefidisk.sh |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
scripts/contrib/mkefidisk.sh +4 -4
index bcc2411..af06b4b 100755
@@ -28,14 +28,14 @@ BOOT_SIZE=20
 # 5% for swap
 SWAP_RATIO=5
 
-function usage() {
+usage() {
 	echo "Usage: $(basename $0) DEVICE HDDIMG TARGET_DEVICE"
 	echo "       DEVICE: The device to write the image to, e.g. /dev/sdh"
 	echo "       HDDIMG: The hddimg file to generate the efi disk from"
 	echo "       TARGET_DEVICE: The device the target will boot from, e.g.  /dev/mmcblk0"
 }
 
-function image_details() {
+image_details() {
 	IMG=$1
 	echo "Image details"
 	echo "============="
@@ -46,7 +46,7 @@ function image_details() {
 	echo ""
 }
 
-function device_details() {
+device_details() {
 	DEV=$1
 	BLOCK_SIZE=512
 
@@ -71,7 +71,7 @@ function device_details() {
 	echo ""
 }
 
-function unmount_device() {
+unmount_device() {
 	grep -q $DEVICE /proc/mounts
 	if [ $? -eq 0 ]; then
 		echo -n "$DEVICE listed in /proc/mounts, attempting to unmount..."
Signature · 1 line
1.7.9.5
#2 lore raw

PATCH 2/4 qtdemo-init: fix bashism

In reply to [email protected]

From: Chen Qi <[email protected]>

---
 meta/recipes-qt/qt-demo/qt-demo-init/qtdemo-init |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
meta/recipes-qt/qt-demo/qt-demo-init/qtdemo-init +4 -4
index 0748fcd..3a1f2cb 100644
@@ -12,13 +12,13 @@ case "$1" in
   start)
 	echo "Starting qtdemo"
 	if [ -f /etc/profile.d/tslib.sh ]; then
-		source /etc/profile.d/tslib.sh
+		. /etc/profile.d/tslib.sh
 	fi
 	if [ -e "$TSLIB_TSDEVICE" ]; then
 		if [ ! -f /etc/pointercal ]; then
 			/usr/bin/ts_calibrate
 		fi
-		if [ "$QTDEMO" == qtdemo ]; then
+		if [ "$QTDEMO" = qtdemo ]; then
 			Xorg &
 			export DISPLAY=:0
 			$QTDEMO &
@@ -26,7 +26,7 @@ case "$1" in
 			QWS_MOUSE_PROTO=tslib:$TSLIB_TSDEVICE $QTDEMO &
 		fi
 	else
-		if [ "$QTDEMO" == qtdemo ]; then
+		if [ "$QTDEMO" = qtdemo ]; then
 			Xorg &
 			export DISPLAY=:0
 		fi
@@ -35,7 +35,7 @@ case "$1" in
 	;;
   stop)
 	echo "Stopping qtdemo"
-	if [ "$QTDEMO" == qtdemo ]; then
+	if [ "$QTDEMO" = qtdemo ]; then
 		killall Xorg
 		killall qtdemo
 	else
Signature · 1 line
1.7.9.5
#3 lore raw

PATCH 3/4 xtscal: fix bashism

In reply to [email protected]

From: Chen Qi <[email protected]>

---
 .../xtscal/xtscal/30xTs_Calibrate.sh               |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/recipes-graphics/xtscal/xtscal/30xTs_Calibrate.sh +1 -1
index b8383bf..fa43617 100644
@@ -8,6 +8,6 @@ if [ "$HAVE_TOUCHSCREEN" = "1" ]; then
 	do
 	   /usr/bin/xtscal
 	   sleep 1
-	   let "n += 1"
+	   n=$(($n+1))
 	done
 fi
Signature · 1 line
1.7.9.5
#4 lore raw

PATCH 4/4 initramfs-framework: fix bashism

In reply to [email protected]

From: Chen Qi <[email protected]>

---
 .../initrdscripts/initramfs-framework/finish       |    5 +++--
 .../initrdscripts/initramfs-framework/init         |   13 +++++++------
 2 files changed, 10 insertions(+), 8 deletions(-)
meta/recipes-core/initrdscripts/initramfs-framework/finish +3 -2
index bedd803..325f47b 100755
@@ -16,8 +16,9 @@ finish_run() {
 		if [ -n "$bootparam_root" ]; then
 			debug "No e2fs compatible filesystem has been mounted, mounting $bootparam_root..."
 
-			if [ "${bootparam_root:0:5}" = "UUID=" ]; then
-				bootparam_root="/dev/disk/by-uuid/${bootparam_root/UUID=/}"
+			if [ "`echo ${bootparam_root} | cut -c1-5`" = "UUID=" ]; then
+				root_uuid=`echo $bootparam_root | cut -c6-`
+				bootparam_root="/dev/disk/by-uuid/$root_uuid"
 			fi
 
 			if [ -e "$bootparam_root" ]; then
meta/recipes-core/initrdscripts/initramfs-framework/init +7 -6
index 0be8f4d..20774aa 100755
@@ -78,12 +78,13 @@ mount -t sysfs sysfs /sys
 
 # populate bootparam environment
 for p in `cat /proc/cmdline`; do
-	opt="${p%%=*}"
-	opt=${opt/-/_}
-	if [ "${p/=/}" = "$p" ]; then
+	opt=`echo $p | cut -d'=' -f1`
+	opt=`echo $opt | sed -e 's/-/_/'`
+	if [ "`echo $p | cut -d'=' -f1`" = "$p" ]; then
 		eval "bootparam_${opt}=true"
 	else
-		eval "bootparam_${opt}=\"${p#*=}\""
+		value="`echo $p | cut -d'=' -f2-`"
+		eval "bootparam_${opt}=\"${value}\""
 	fi
 done
 
@@ -102,7 +103,7 @@ mkdir $ROOTFS_DIR
 # Load and run modules
 for m in $MODULES_DIR/*; do
 	# Skip backup files
-	if [ "${m/\~/}" != "$m" ]; then
+	if [ "`echo $m | sed -e 's/\~$//'`" = "$m" ]; then
 		continue
 	fi
 
@@ -117,7 +118,7 @@ for m in $MODULES_DIR/*; do
 	done
 
 	# process module
-	source $m
+	. $m
 
 	if ! eval "${module}_enabled"; then
 		debug "Skipping module $module"
Signature · 1 line
1.7.9.5