Icon harvesting Script: Get all of your icons in one place!

Discussion in 'iOS Themes and Customization' started by (har*ty, Aug 20, 2010.

  1. (har*ty

    (har*ty New Member

    Joined:
    Dec 12, 2009
    Messages:
    66
    Likes Received:
    0
    Device:
    2G iPod touch
    very beta and possibly buggy (i had to restore, but dont worry i fixed that bug lol)

    by buggy i mean it doesnt get ALL of the icons. i am 90% sure it gets all the icons in var/mobile/Applications though.

    please please if you try this give feedback

    instruction:
    1. make a new extensionless file and paste the code below into it
    2. copy it to ur ipod /usr/bin/
    3. change the permissions to read write execute preferably with iFile if not use the command below
    Code:
    chmod 777 /usr/bin/filename
    4. in terminal type the name of the file. for me it was "icostash"

    -note: if u get a weird error thats like bash^C is messed up or something with that open up the document with iFile on ur idevice click edit then after the first or third line press backspace to go up a line then enter again if you want. i believe this removes a weird newline character or something *** like that.

    Code:
    #!/bin/bash
    # icon stasher for themers
    # written by Josh aka Phanatic
    
    function exo {
    exit 0
    }
    
    if [ "$(id -u)" != "0" ]; then
       echo "This script must be run as root"
       exit 1
    fi
    
    
    if [ ! -e "/usr/bin/zip" ]; then
    if [ ! -e "/usr/bin/plutil" ]; then
      echo "Please install zip"
      echo "Please install erica utilities"
      exo
    else
      echo "Please install zip"
      exo
    fi
    fi
    if [ ! -e "/usr/bin/plutil" ]; then
    if [ ! -e "/usr/bin/zip" ]; then
      echo "Please install zip"
      echo "Please install erica utilities"
      exo
    else
      echo "Please install erica utilities"
      exo
    fi
    fi
    
    cd /var/mobile
    
    if [ ! -e "/var/mobile/icostash" ]; then
      mkdir icostash
      chown mobile icostash
      chmod 777 icostash
      chgrp mobile icostash
    else
      echo "removing previous icostash"
      rm -rf icostash
      rm -rf icostash.zip
      mkdir icostash
      chown mobile icostash
      chmod 777 icostash
      chgrp mobile icostash
    fi
    
    cd /var/mobile/Applications
    
    echo "processing.."
    
    for dname in $(ls);
    
    do 
    
    	iname="$(plutil -CFBundleIconFile /var/mobile/Applications/$dname/*.app/Info.plist 2>/dev/null)"
    	bname="$(plutil -CFBundleName /var/mobile/Applications/$dname/*app/Info.plist 2>/dev/null)"
    	wname="$(plutil -CFBundleDisplayName /var/mobile/Applications/$dname/*app/Info.plist 2>/dev/null)"
    	
    	if [ -z "$iname" ]; then
    		
    		find /var/mobile/Applications/"$dname" -name "icon.png" -type f -exec cp {} /var/mobile/icostash \; 2>/dev/null
    		find /var/mobile/Applications/"$dname" -name "Icon.png" -type f -exec cp {} /var/mobile/icostash \; 2>/dev/null
    	
    		chown mobile /var/mobile/icostash/*png 2>/dev/null
    		chmod 777 /var/mobile/icostash/*png 2>/dev/null
    		chgrp mobile /var/mobile/icostash/*png 2>/dev/null
    	
    		if [ -z "$wname" ]; then
    			if [ -z "$bname" ]; then
    				altname=/var/mobile/Applications/"$dname"/*.app
    				naltname="${altname##*/}"
    				nnaltname="${naltname%\.*}"
    				mv /var/mobile/icostash/Icon.png "$nnaltname" 2>/dev/null
    				mv /var/mobile/icostash/icon.png "$nnaltname" 2>/dev/null
    			else
    				mv /var/mobile/icostash/Icon.png /var/mobile/icostash/"$bname" 2>/dev/null
    				mv /var/mobile/icostash/icon.png /var/mobile/icostash/"$bname" 2>/dev/null
    			fi
    		else
    			mv /var/mobile/icostash/Icon.png /var/mobile/icostash/"$wname" 2>/dev/null	
    			mv /var/mobile/icostash/icon.png /var/mobile/icostash/"$wname" 2>/dev/null
    		fi
    	
    		if [ -e "/var/mobile/icostash/*png" ]; then
    		echo "Error"
    		fi
    		
    	
    	else
    
    	
    
    
    		cp /var/mobile/Applications/$dname/*.app/"$iname" /var/mobile/icostash 2>/dev/null
    
    	
    		chown mobile /var/mobile/icostash/*png 2>/dev/null
    		chmod 777 /var/mobile/icostash/*png 2>/dev/null
    		chgrp mobile /var/mobile/icostash/*png 2>/dev/null
    	
    		if [ -z "$wname" ]; then
    			if [ -z "$bname" ]; then
    				altname=/var/mobile/Applications/"$dname"/*.app
    				naltname="${altname##*/}"
    				nnaltname="${naltname%\.*}"
    				mv /var/mobile/icostash/"$iname" "$nnaltname" 2>/dev/null
    			else
    				mv /var/mobile/icostash/"$iname" /var/mobile/icostash/"$bname" 2>/dev/null
    			fi
    		else
    				mv /var/mobile/icostash/"$iname" /var/mobile/icostash/"$wname" 2>/dev/null
    		fi
    
    	
    	
    
    	
    		if [ -e "/var/mobile/icostash/*png" ]; then
    		echo "Error"
    		fi
    	
    
    	
    	fi
    
    done
    
    cd /Applications
    
    for ename in $(ls);
    
    do 
    
    	iname=
    	bname=
    	wname=
    
    	iname="$(plutil -CFBundleIconFile /Applications/$ename/Info.plist 2>/dev/null)"
    	bname="$(plutil -CFBundleName /Applications/$ename/Info.plist 2>/dev/null)"
    	wname="$(plutil -CFBundleDisplayName /Applications/$ename/Info.plist 2>/dev/null)"
    
    	if [ -z "$iname" ]; then
    	
    		find -H /Applications/"$ename" -name "icon.png" -type f -exec cp -f {} /var/mobile/icostash \; 2>/dev/null
    		find -H /Applications/"$ename" -name "Icon.png" -type f -exec cp -f {} /var/mobile/icostash \; 2>/dev/null
    		
    		chown mobile /var/mobile/icostash/*png 2>/dev/null
    		chmod 777 /var/mobile/icostash/*png 2>/dev/null
    		chgrp mobile /var/mobile/icostash/*png 2>/dev/null
    		
    		if [ -z "$wname" ]; then
    			if [ -z "$bname" ]; then
    				altname=/Applications/"$ename"
    				naltname="${altname##*/}"
    				nnaltname="${naltname%\.*}"
    				mv /var/mobile/icostash/Icon.png "$nnaltname" 2>/dev/null
    				mv /var/mobile/icostash/icon.png "$nnaltname" 2>/dev/null
    			else
    				mv /var/mobile/icostash/Icon.png /var/mobile/icostash/"$bname" 2>/dev/null
    				mv /var/mobile/icostash/icon.png /var/mobile/icostash/"$bname" 2>/dev/null
    			fi
    		else
    			mv /var/mobile/icostash/Icon.png /var/mobile/icostash/"$wname" 2>/dev/null	
    			mv /var/mobile/icostash/icon.png /var/mobile/icostash/"$wname" 2>/dev/null
    		fi
    		
    		if [ -e "/var/mobile/icostash/*png" ]; then
    		echo "Error"
    		fi
    		
    		
    	else
    
    	
    		cp /Applications/$ename/"$iname" /var/mobile/icostash 2>/dev/null
    	
    	
    		chown mobile /var/mobile/icostash/*png 2>/dev/null
    		chmod 777 /var/mobile/icostash/*png 2>/dev/null
    		chgrp mobile /var/mobile/icostash/*png 2>/dev/null
    	
    	
    	
    		if [ -z "$wname" ]; then
    			if [ -z "$bname" ]; then
    				altname=/Applications/"$ename"
    				naltname="${altname##*/}"
    				nnaltname="${naltname%\.*}"
    				mv /var/mobile/icostash/"$iname" "$nnaltname" 2>/dev/null
    			else
    				mv /var/mobile/icostash/"$iname" /var/mobile/icostash/"$bname" 2>/dev/null
    			fi
    		else
    				mv /var/mobile/icostash/"$iname" /var/mobile/icostash/"$wname" 2>/dev/null
    		fi
    		
    		if [ -e "/var/mobile/icostash/*png" ]; then
    		echo "Error"
    		fi
    	fi
    done
    
    cd /var/mobile
    cd /var/mobile/icostash
    
    find /var/mobile/icostash
     -type f -exec mv '{}' '{}'.png \; 2>/dev/null
    
    cd ..
    echo "zipping.."
    zip -r icostash.zip icostash 1>/dev/null
    echo "done"
    
    echo "icons are in var/mobile/icostash"
    echo "also zipped as icostash.zip in var/mobile"
    
    echo ""
    echo "thank you for using my script.. support me"
    echo "by joining ipod-hacking.com"
    echo ""
    
    exo
    
  2. iLove

    iLove Active Member

    Joined:
    Jan 14, 2009
    Messages:
    507
    Likes Received:
    34
    Device:
    iPhone 4 (White)
    Could i ask, to what the usefulness of this is?
  3. iRa1n

    iRa1n Banned

    Joined:
    Jul 15, 2010
    Messages:
    814
    Likes Received:
    0
    Device:
    2G iPod touch
    Is this for the app icon harvester
  4. (har*ty

    (har*ty New Member

    Joined:
    Dec 12, 2009
    Messages:
    66
    Likes Received:
    0
    Device:
    2G iPod touch
    uhmm it says what it does in the title, gets all of your icons on your ipod to one zip file, mostly useful to themers who want to work on existing icons

    its not from iconharvester, i dont even know what that is
  5. killer54291

    killer54291 New Member

    Joined:
    Sep 3, 2009
    Messages:
    14
    Likes Received:
    0
    Why do you have two identical ifs?
    Code:
    if [ ! -e "/usr/bin/zip" ]; then
    if [ ! -e "/usr/bin/plutil" ]; then
      echo "Please install zip"
      echo "Please install erica utilities"
      exo
    else
      echo "Please install zip"
      exo
    fi
    fi
    if [ ! -e "/usr/bin/plutil" ]; then
    if [ ! -e "/usr/bin/zip" ]; then
      echo "Please install zip"
      echo "Please install erica utilities"
      exo
    else
      echo "Please install erica utilities"
      exo
    fi
    fi
    Ahhh sorry. Different order.

Share This Page