Skip to content

Instantly share code, notes, and snippets.

@KhasMek
Created May 18, 2012 04:12
Show Gist options
  • Save KhasMek/2723104 to your computer and use it in GitHub Desktop.
Save KhasMek/2723104 to your computer and use it in GitHub Desktop.
automation script for creating T-Mobile theme overlay xml files.
#!/bin/bash
package=${1}
# test for parent directory
if [ -d xml ]; then
echo "directory exists"
else
mkdir xml
fi
find . -name "$package"* | cut -f3 -d "/" | cut -f1 -d "." > .list
(cat << EOF) > xml/$package.xml
<?xml version="1.0" encoding="utf-8"?>
<!--
# Copyright (C) 2010, T-Mobile USA, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-->
<resource-redirections>
EOF
while read line ;do
resource_name=$(echo "$line" | awk -F "$package"_ '{print $2}')
echo "<item name="drawable/$resource_name">@drawable/$line</item>" >> xml/$package.xml
done < .list
echo "</resource-redirections>" >> xml/$package.xml
# cleanup
rm .list
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment