Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- if [ -z "$1" ] || [ -z "$2" ]; then
- echo "Usage: ${0} [PS3|PS4|PS5] PUPFILE"
- echo "Example: ${0} PS4 PS4UPDATE.PUP"
- exit 1;
- fi
- PSSYS="$(echo "${1}" | tr '[:lower:]' '[:upper:]')"
- PUPFILE="${2}"
- if [ ! -f "${PUPFILE}" ]; then
- echo "${PUPFILE} not found."
- exit 1;
- fi
- case "${PSSYS}" in
- PS3)
- DEST_SIZE=256
- ;;
- PS4)
- DEST_SIZE=1024
- ;;
- PS5)
- DEST_SIZE=2048
- ;;
- *)
- echo "Unknown system: ${PSSYS}"
- exit 1;
- ;;
- esac
- ZERO_FILE_SIZE=$(((DEST_SIZE * 1024 * 1024) - $(ls -l ${PUPFILE} | cut -d' ' -f5)))
- echo "Need to pad ${ZERO_FILE_SIZE} null bytes (${PSSYS} Mode)..."
- echo -n "Searching for optimal blocksize... "
- # try larger blocksizes
- BLOCKSIZE=${ZERO_FILE_SIZE}
- ZERO_FILE_MULTIPLIER=1
- #while (( $ZERO_FILE_SIZE % $BLOCKSIZE != 0 )); do
- # ((BLOCKSIZE--))
- #done;
- #ZERO_FILE_MULTIPLIER=$(($ZERO_FILE_SIZE / $BLOCKSIZE))
- #echo "${BLOCKSIZE} bytes."
- TMPFILE="${PUPFILE}.TMP"
- echo "Creating null file..."
- dd if=/dev/zero of=${TMPFILE} bs=${BLOCKSIZE} count=${ZERO_FILE_MULTIPLIER} 2>/dev/null
- echo "Merging firmware and null file..."
- cat $PUPFILE $TMPFILE > "${PUPFILE}.disc"
- rm ${TMPFILE}
- echo "Done."
- echo "-----------------------------------------------"
- md5sum "${PUPFILE}.disc"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement