[TCT][TPK Scripts][NONACR][Fixed resource copy as per profile only]
authorShobhit Verma <shobhit.v@samsung.com>
Mon, 12 Sep 2016 12:36:12 +0000 (18:06 +0530)
committerShobhit Verma <shobhit.v@samsung.com>
Mon, 12 Sep 2016 12:36:12 +0000 (18:06 +0530)
Change-Id: I7fee07282355ddf9f833594e6278a542c3b2350e
Signed-off-by: Shobhit Verma <shobhit.v@samsung.com>
scripts_tpk/tpk_create.sh

index 741a445ee1f20153fee964c2218f9c0b3a007bee..5c473e129e0ae351ea598e249afd364fdec981bd 100755 (executable)
@@ -152,23 +152,35 @@ deploySourceFile() {
        done < $2/CMakeLists.txt
        
        # copying data and shared data 
-#      find $2/. -type f ! -iname "*.c" ! -iname "*.cpp" ! -iname "*.h" ! -iname "*.tpk"  ! -iname "CMakeLists.txt" -exec cp  {} $1/shared/res \;
-       
-#      if [ -d $2/res/$3 ];then
-#              find $2/res/$3/. -type f -iname "*.tpk"  -exec cp  {} $1/shared/res \;
-#      fi
-
        WORKDIR=`pwd`
        cd $2
        find . -type f ! -iname "*.c" ! -iname "*.cpp" ! -iname "*.h" ! -iname "CMakeLists.txt" -exec cp -p --parents {} $1/shared/res/. ";"
        cd $WORKDIR
        
        if [ -d $2/res/$3 ];then
-               #find $2/res/$3/. -type f -iname "*.tpk"  -exec cp  {} $1/shared/res \;
-               cp -rf $2/res/$3/. $1/shared/res/.
+               cp -rf $2/res/$3/. $1/shared/res/. 
+               # As Profile specific resources has been copied from shared/res/res/<profile> to shared/res location 
+               # So removing all profile specific folders from shared/res/res/
+               WORKDIR=`pwd`
+               cd $1/shared/res/res
+               dirs=(*/)
+               for dir in "${dirs[@]}"
+               do
+                       if [[ $dir =~ "mobile" ]] || [[ $dir =~ "wearable" ]] || [[ $dir =~ "common_iot" ]] || [[ $dir =~ "tv" ]]; then
+                               # So removing all profile specific folders from shared/res/res/
+                               rm -rf $dir     
+                       fi
+               done
+               
+               #if 'res' (/shared/res/res) folder is empty, then remove 'res' folder too.
+               cd ..
+               VALUE=`ls -l res | wc -l`
+               if [ $VALUE == 1 ]; then
+                       rm -rf res
+               fi
+               cd $WORKDIR
        fi
        
-       
        cp scripts_tpk/spec.sh $1/shared/res/.
 
        sed -i -f scripts_tpk/$3.sed $1/inc/tct_common.h