Add COPYING file
[ps3tools.git] / pupexplode
bloba926dfe80a086ee11cbdcb6e0096bcf3b3fa2be2
1 #!/bin/bash
3 if (( $# != 2 )); then
4 echo "Usage: pupexplode <pup> <out_dir>"
5 echo "pupexplode expands all important files in a PUP and tries to decrypt every file as a self"
6 exit 1
7 fi
9 pup=$1
10 outdir=$2
12 pupunpack $pup $outdir || exit
14 cd $outdir || exit
16 mkdir update_files
17 cd update_files
18 tar xvf ../update_files.tar || exit
20 for f in dev_flash*; do
21 unpkg $f ${f}_unpkg || exit
22 tar xvf ${f}_unpkg/content || exit
23 done
25 for f in *.pkg; do
26 unpkg $f ${f%.pkg}
27 if [[ $f == "CORE_OS_PACKAGE.pkg" ]]; then
28 cosunpkg CORE_OS_PACKAGE/content CORE_OS_PACKAGE/
30 done
32 cd ..
33 for f in $(find . -type f -print0); do
34 if readself $f &> /dev/null; then
35 print -n "Unselfing $f... "
36 if unself $f ${f}.elf &> /dev/null; then
37 print "OK!"
38 else
39 print "failed!"
42 done