Quantcast
Channel: xda-developers - Android Software and Hacking General [Developers Only]
Viewing all articles
Browse latest Browse all 3614

[SCRIPT] Change default CM10 bootanimations in Ubuntu

$
0
0
I was pretty excited to start messing around with building my own ROMS, and after I compiled CM10 from source for my GNex, I decided I wanted to tweak it somehow. I started messing around with the boot animations, and then had a really tough time getting it to work on my phone.

There are a lot of great tutorials on XDA about creating boot animations I mostly used this one: http://forum.xda-developers.com/show....php?t=1212555 ), but almost all of them assume a Windows environment. This is not important until it comes to creating the bootanimation.zip, which must be stored only and not compressed.

In order to execute the zip correctly on Ubuntu, the command must be given with the following form:

Code:

zip -0 ../bootanimation.zip desc.txt part0/* part1/* part2/*
This command assumes that you are inside the directory that holds your desc.txt file, and that the directories listed in the desc.txt are subdirectories of the current directory, named part0, part1 and part2. Obviously, you can modify this command as needed, but this will create a ZIP file that Android can read. This is where I finally found the instruction on how to create the ZIP:

http://www.modaco.com/topic/338623-u...tanimationzip/

By the time I had figured out the correct zip command, I had put together my boot animation countless times. To speed up this process, I wrote a script to do it. By the time I was done, I had a pretty full featured script for changing CM10 boot animations, so I decided to share it.

What this script does not do
This script does not help with the graphical design. It assumes you have a working directory of 1200x1200 jpgs, that are already number correctly. It assumes that you have created a valid desc.txt for those jpgs.

What this script does
This script takes your baseline 1200x1200 jpgs, and scales them for each of the resolutions that CM10 uses. It then (optionally) places them in the directory that CM10 pulls from when it creates a ROM from source.

Why this useful
I wanted to take the baseline CM10 boot animation and tweak it. Using this script, I can create the full boot animation I want at 1200x1200, execute, and then it will automatically drop the correct scaled boot animation for each resolution that CM10 uses. Plus, it automatically creates archives of all your work, date and time stamped, along the way. It can handle any number of parts, with any names.

It does not create the desc.txt automatically.

Of course, this script can be tweaked for your own needs. I hope this is helpful to someone.

Code:

#!/bin/bash
#This script assumes that a directory called 1200 has the template files to use
#It will blow away any files in the other directories!

#In the GRAPHDIR variable, put the location where the graphics are located
#This script assumes that the base images are jpgs and are 1200x1200

#If $GRAPHDIR has any spaces in the path, this script will not work.
# $WORKDIR is the directory that holds the originals, and must be a subdirectory of $GRAPHDIR

GRAPHDIR="/home/jbk/androiddev/bootanimgraphics"
CMGRAPH="/home/jbk/androiddev/Source/vendor/cm/prebuilt/common/bootanimation"
WORKDIR="working"

PARTDIR=""
TAIL='/*'

#First, figure out the names of the part directories and store for later
for f in $(find "$GRAPHDIR/$WORKDIR/" -maxdepth 1 -mindepth 1 -type d -print)
do
        b=$(basename $f)
PARTDIR="$PARTDIR $b$TAIL"
done

#now, create a set of images and desc.txt for each resolution used by CM10,
#then zip them without compression
#next, delete the working directory
for RESOL in 240 320 360 480 540 600 720 768 800
do
        if [ -d $GRAPHDIR/$RESOL ]; then
                rm -rf $GRAPHDIR/$RESOL
        fi
        cp -r $GRAPHDIR/$WORKDIR $GRAPHDIR/$RESOL
        find $GRAPHDIR/$RESOL -name *.jpg -execdir convert {} -resize "$RESOL"x"$RESOL" {} \;
        sed -i -e "s/1200/$RESOL/g" $GRAPHDIR/$RESOL/desc.txt
        cd $GRAPHDIR/$RESOL
        zip -0 ../$RESOL.zip desc.txt $PARTDIR
        cd -
        rm -rf $GRAPHDIR/$RESOL
done

#Now, create the zip for the template images
cd $GRAPHDIR/$WORKDIR
zip -0 ../1200.zip desc.txt $PARTDIR
cd -

#Determine if the CM boot animation directory is valid
if [ -d $CMGRAPH ]; then

#If the CM boot anim dir is valid, tarball all the zips there back at the base dir
        cd $GRAPHDIR
        tar -cvzf CMBOOTBK_`date +%Y%m%d_%H%M%S`.tar.gz $CMGRAPH/*.zip
#Delete the old zips from the CM dir
        rm $CMGRAPH/*.zip
#Store the new zips in the CM dir
        cp *.zip $CMGRAPH/
        cd -
fi


Viewing all articles
Browse latest Browse all 3614

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>