Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- exec<$1
- res_dir="./res/"
- drawables=$res_dir'drawable-mdpi/'
- echo "Reading public.xml..."
- value=0
- while read line
- do
- PUBLIC[$value]=$line$'\n'
- ((value ++))
- done < $1
- echo "Parsing public.xml for declared filenames..."
- for ((i=0; i<${#PUBLIC[@]};i++));
- do
- temp[$i]=$(echo ${PUBLIC[$i]}| awk -F ' ' '{print $3}'| cut -c 7-| head -c -2)
- done
- parsed_fnames=($(for((i=0;i<"${#temp[@]}";i++));do echo ${temp[$i]}; done |sort))
- echo "Scanning resources folders for actual resources present..."
- pngres=($(find $res_dir -type f -name \*.png -printf %f\\n| sort))
- echo "Looking for \"APKTOOL_DUMMY\" files in resources..."
- for ((i=0; i<${#PUBLIC[@]};i++));
- do
- str5=$(echo ${PUBLIC[$i]}| awk -F ' ' '{print $3}'| cut -c 7-| head -c -7)
- if [ "$str5" == "APKTOOL_DUMMY" ]; then
- echo "${PUBLIC[$i]}"
- fi
- #echo $str5
- done
- echo "Comparing declared resources against actual resources present..."
- k=0
- for ((i=0; i<${#parsed_fnames[@]};i++));
- do
- str1=${parsed_fnames[$i]}.png
- str2=${pngres[$k]}
- #echo "str1 = $str1 str2 = $str2"
- if [ "$str1" != "$str2" ]; then
- #echo "$str1 does not equal $str2" >> test1.txt
- str3=${parsed_fnames[$i]}.9.png
- fi
- if [ "$str3" != "$str2" ]; then
- #echo "$str3 does not equal $str2 Creating dummy resource for $str1" >> test1.txt
- #touch "$drawables$str1"
- dummy_list[$k]=$str1
- else
- ((k++))
- #echo "$str3 equals $str2 No action required" >> test1.txt
- fi
- #echo "str1 = $str1 not equal str2 = $str2" >> test1.txt
- done
- echo $k
- echo "${dummy_list[@]}"
- echo
- echo "Created ${#dummy_list[@]} dummy files..."
- echo "Public key's = ${#PUBLIC[@]}"
- echo "Parsed public for filenames = ${#parsed_fnames[@]}"
- echo "Total found PNG files = ${#pngres[@]}"
Advertisement
Add Comment
Please, Sign In to add comment