added number checking routine to model-config.sh
authorgiwoong.kim <giwoong.kim@samsung.com>
Wed, 26 Jun 2013 07:55:15 +0000 (16:55 +0900)
committergiwoong.kim <giwoong.kim@samsung.com>
Wed, 26 Jun 2013 08:00:35 +0000 (17:00 +0900)
Change-Id: Idfd450d8df534adf6f65f0f92375c552ddaa76af
Signed-off-by: GiWoong Kim <giwoong.kim@samsung.com>
filesystem/etc/emulator/model-config.sh
packaging/system-plugin-emulator.spec

index 156c7b3..f6f617d 100755 (executable)
@@ -1,43 +1,48 @@
 #!/bin/sh
 
-#if grep "platform_feature=3btn" /proc/cmdline ; then
-#        echo -e "[${_G} turn on the input.keys feature ${C_}]"
-#        sed -i 's/name=\"tizen.org\/feature\/input.keys.back\" type=\"bool\">false/name=\"tizen.org\/feature\/input.keys.back\" type=\"bool\">true/g' ./model-config.xml
-#else
-#        echo -e "[${_G} turn off the input.keys feature ${C_}]"
-#        sed -i 's/name=\"tizen.org\/feature\/input.keys.back\" type=\"bool\">true/name=\"tizen.org\/feature\/input.keys.back\" type=\"bool\">false/g' ./model-config.xml
-#fi
-
 CMDLINE=/proc/cmdline
 XML=/etc/config/model-config.xml
 
 
 echo -e "[${_G} model config setting ${C_}]"
 
+# display resolution
 if grep --silent "video=" $CMDLINE ; then
         echo -e "[${_G} modify the resolution value of platform features: ${C_}]"
 
-        VIDEO=`sed s/.*video=// $CMDLINE | cut -d' ' -f1`
-        FORMAT=`echo $VIDEO | cut -d',' -f2`
-        RESOLUTION=`echo $FORMAT | cut -d'-' -f1`
-        WIDTH=`echo $RESOLUTION | cut -d'x' -f1`
-        HEIGHT=`echo $RESOLUTION | cut -d'x' -f2`
-
-        WIDTH_KEY="tizen.org\/feature\/screen.width\" type=\"int\""
-        sed -i s/"$WIDTH_KEY".*\</"$WIDTH_KEY"\>"$WIDTH"\</ $XML
-        HEIGHT_KEY="tizen.org\/feature\/screen.height\" type=\"int\""
-        sed -i s/"$HEIGHT_KEY".*\</"$HEIGHT_KEY"\>"$HEIGHT"\</ $XML
-        echo -e "[${_G} width=$WIDTH, height=$HEIGHT ${C_}]"
+        VIDEO=`sed s/.*video=// $CMDLINE | cut -d ' ' -f1`
+        FORMAT=`echo $VIDEO | cut -d ',' -f2`
+        RESOLUTION=`echo $FORMAT | cut -d '-' -f1`
+        WIDTH=`echo $RESOLUTION | cut -d 'x' -f1`
+        HEIGHT=`echo $RESOLUTION | cut -d 'x' -f2`
+
+        TR_NUM=`echo $WIDTH$HEIGHT | tr -d '[0-9]'`
+        if [ "$TR_NUM" != "" ] ; then
+            echo "non-integer argument"
+        else
+            WIDTH_KEY="tizen.org\/feature\/screen.width\" type=\"int\""
+            sed -i s/"$WIDTH_KEY".*\</"$WIDTH_KEY"\>"$WIDTH"\</ $XML
+            HEIGHT_KEY="tizen.org\/feature\/screen.height\" type=\"int\""
+            sed -i s/"$HEIGHT_KEY".*\</"$HEIGHT_KEY"\>"$HEIGHT"\</ $XML
+            echo -e "[${_G} width=$WIDTH, height=$HEIGHT ${C_}]"
+        fi
 fi
 
+# dot per inch
 if grep --silent "dpi=" $CMDLINE ; then
         echo -e "[${_G} modify the dpi value of platform features: ${C_}]"
 
-        DPI=`sed s/.*dpi=// $CMDLINE | cut -d' ' -f1`
-        SCREEN_DPI=`expr "$DPI" "/" 10`
+        DPI=`sed s/.*dpi=// $CMDLINE | cut -d ' ' -f1`
+
+        TR_NUM=`echo $DPI | tr -d '[0-9]'`
+        if [ "$TR_NUM" != "" ] ; then
+            echo "non-integer argument"
+        else
+            SCREEN_DPI=`expr "$DPI" "/" 10`
 
-        DPI_KEY="tizen.org\/feature\/screen.dpi\" type=\"int\""
-        sed -i s/"$DPI_KEY".*\</"$DPI_KEY"\>"$SCREEN_DPI"\</ $XML
-        echo -e "[${_G} dpi=$SCREEN_DPI ${C_}]"
+            DPI_KEY="tizen.org\/feature\/screen.dpi\" type=\"int\""
+            sed -i s/"$DPI_KEY".*\</"$DPI_KEY"\>"$SCREEN_DPI"\</ $XML
+            echo -e "[${_G} dpi=$SCREEN_DPI ${C_}]"
+        fi
 fi
 
index 48ad0d7..d6d96f6 100644 (file)
@@ -1,5 +1,5 @@
 Name: system-plugin-emulator
-Version: 0.0.8
+Version: 0.0.9
 Release: 1
 
 %define systemd_dir     /usr/lib/systemd