Jonathan Gordon | bdb6bf5 | 2010-05-28 05:25:48 +0000 | [diff] [blame] | 1 | #!/usr/bin/perl |
| 2 | # __________ __ ___. |
| 3 | # Open \______ \ ____ ____ | | _\_ |__ _______ ___ |
| 4 | # Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / |
| 5 | # Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < |
| 6 | # Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ |
| 7 | # \/ \/ \/ \/ \/ |
| 8 | # $Id: wpsbuild.pl 24813 2010-02-21 19:10:57Z kugel $ |
| 9 | # |
| 10 | |
| 11 | # usage: updatetheme.pl theme.zip workingdir [options passed to skinupdater] |
| 12 | use File::Basename; |
| 13 | |
| 14 | $numArgs = $#ARGV + 1; |
| 15 | |
| 16 | die "usage: updatetheme.pl theme.zip workingdir [options passed to skinupdater]" if ($numArgs < 2); |
| 17 | |
| 18 | $ARGV[0] =~ /.*\/(.*).(zip|ZIP)/; #fix this regex! |
| 19 | $theme_name = $1; |
| 20 | $tmp = $ARGV[1]; |
| 21 | $outdir = "$tmp/$theme_name"; |
| 22 | |
| 23 | if ($numArgs > 2) |
| 24 | { |
| 25 | $args = $ARGV[2]; |
| 26 | } else { |
| 27 | $args = ""; |
| 28 | } |
| 29 | |
| 30 | |
| 31 | system("mkdir $outdir") and die "couldnt mkdir $outdir"; |
| 32 | |
| 33 | # step 1, unzip the theme zip |
| 34 | system("unzip $ARGV[0] -d $outdir") and die; |
| 35 | |
| 36 | #for each skin in the zip run skinupdater |
| 37 | @files = `find $outdir -iname "*.wps" -o -iname "*.sbs" -o -iname "*.fms" -o -iname "*.rwps" -o -iname "*.rsbs" -o -iname "*.rfms"`; |
Jonathan Gordon | 8e07853 | 2010-05-30 02:32:44 +0000 | [diff] [blame] | 38 | `touch $tmp/theme_name.diff`; |
Jonathan Gordon | bdb6bf5 | 2010-05-28 05:25:48 +0000 | [diff] [blame] | 39 | foreach (@files) |
| 40 | { |
| 41 | chomp($_); |
| 42 | $file = $_; |
| 43 | $out = "$tmp/" . `basename $file`; chomp($out); |
| 44 | `./skinupdater $args $file $out`; |
Jonathan Gordon | e8ec204 | 2010-05-29 14:00:55 +0000 | [diff] [blame] | 45 | `diff -u $file $out >> $tmp/$theme_name.diff`; |
Jonathan Gordon | bdb6bf5 | 2010-05-28 05:25:48 +0000 | [diff] [blame] | 46 | `mv $out $file`; |
Jonathan Gordon | bdb6bf5 | 2010-05-28 05:25:48 +0000 | [diff] [blame] | 47 | |
| 48 | } |
Jonathan Gordon | d24cc39 | 2010-05-30 02:32:24 +0000 | [diff] [blame] | 49 | `cd $outdir && zip -r $tmp/$theme_name.zip .`; |
Jonathan Gordon | bdb6bf5 | 2010-05-28 05:25:48 +0000 | [diff] [blame] | 50 | |
| 51 | |
| 52 | system("rm -Rf $outdir"); |