2021-05-29 13:26:08 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
IPSW32() {
|
2021-09-06 10:50:29 +02:00
|
|
|
local Bundle="resources/firmware/FirmwareBundles/Down_${ProductType}_${OSVer}_${BuildVer}.bundle"
|
2021-09-13 14:02:22 +02:00
|
|
|
local ExtraArgs
|
2021-05-29 13:26:08 +02:00
|
|
|
local JBFiles
|
|
|
|
local JBSHA1
|
2021-09-06 10:50:29 +02:00
|
|
|
|
2021-05-29 13:26:08 +02:00
|
|
|
if [[ $IPSWRestore == $IPSWCustom ]]; then
|
|
|
|
Log "Found existing Custom IPSW. Skipping IPSW creation."
|
|
|
|
return
|
|
|
|
fi
|
2021-09-06 10:50:29 +02:00
|
|
|
|
|
|
|
if [[ -e $Bundle/Info.plist.bak ]]; then
|
|
|
|
rm $Bundle/Info.plist
|
|
|
|
mv $Bundle/Info.plist.bak $Bundle/Info.plist
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ $JBDaibutsu == 1 ]]; then
|
2021-09-13 14:02:22 +02:00
|
|
|
ExtraArgs+="-daibutsu "
|
2021-09-06 10:50:29 +02:00
|
|
|
SaveExternal dora2-iOS daibutsuCFW
|
|
|
|
echo '#!/bin/bash' > tmp/reboot.sh
|
|
|
|
echo "mount_hfs /dev/disk0s1s1 /mnt1; mount_hfs /dev/disk0s1s2 /mnt2" >> tmp/reboot.sh
|
|
|
|
echo "nvram -d boot-partition; nvram -d boot-ramdisk" >> tmp/reboot.sh
|
|
|
|
echo "/usr/bin/haxx_overwrite -$HWModel" >> tmp/reboot.sh
|
|
|
|
|
|
|
|
elif [[ $Jailbreak == 1 ]]; then
|
|
|
|
cp $Bundle/Info.plist $Bundle/Info.plist.bak
|
|
|
|
sed -z -i "s|</dict>\n</plist>|\t<key>needPref</key>\n\t<true/>\n</dict>\n</plist>|g" $Bundle/Info.plist
|
2021-09-13 14:02:22 +02:00
|
|
|
if [[ $OSVer == "8.4.1" ]]; then
|
2021-06-20 11:45:53 +02:00
|
|
|
JBFiles=("fstab.tar" "etasonJB-untether.tar" "Cydia8.tar")
|
|
|
|
JBSHA1="6459dbcbfe871056e6244d23b33c9b99aaeca970"
|
2021-09-13 14:02:22 +02:00
|
|
|
ExtraArgs+="-s 2305 "
|
|
|
|
elif [[ $OSVer == "6.1.3" ]]; then
|
2021-06-20 11:45:53 +02:00
|
|
|
JBFiles=("fstab_rw.tar" "p0sixspwn.tar" "Cydia6.tar")
|
|
|
|
JBSHA1="1d5a351016d2546aa9558bc86ce39186054dc281"
|
2021-09-13 14:02:22 +02:00
|
|
|
ExtraArgs+="-s 1260 "
|
2021-09-06 10:50:29 +02:00
|
|
|
else
|
|
|
|
Error "No OSVer selected?"
|
2021-06-20 11:45:53 +02:00
|
|
|
fi
|
|
|
|
if [[ ! -e resources/jailbreak/${JBFiles[2]} ]]; then
|
|
|
|
cd tmp
|
|
|
|
Log "Downloading jailbreak files..."
|
|
|
|
SaveFile https://github.com/LukeZGD/iOS-OTA-Downgrader-Keys/releases/download/jailbreak/${JBFiles[2]} ${JBFiles[2]} $JBSHA1
|
|
|
|
mv ${JBFiles[2]} ../resources/jailbreak
|
|
|
|
cd ..
|
|
|
|
fi
|
|
|
|
for i in {0..2}; do
|
|
|
|
JBFiles[$i]=jailbreak/${JBFiles[$i]}
|
|
|
|
done
|
2021-05-29 13:26:08 +02:00
|
|
|
fi
|
2021-09-13 14:02:22 +02:00
|
|
|
ExtraArgs+="-bbupdate"
|
2021-09-06 10:50:29 +02:00
|
|
|
|
2021-05-29 13:26:08 +02:00
|
|
|
if [[ ! -e $IPSWCustom.ipsw ]]; then
|
|
|
|
Echo "* By default, memory option is set to Y, you may select N later if you encounter problems"
|
|
|
|
Echo "* If it doesn't work with both, you might not have enough RAM and/or tmp storage"
|
|
|
|
read -p "$(Input 'Memory option? (press Enter/Return if unsure) (Y/n):')" JBMemory
|
2021-09-13 14:02:22 +02:00
|
|
|
[[ $JBMemory != 'N' && $JBMemory != 'n' ]] && ExtraArgs+=" -memory"
|
2021-05-29 13:26:08 +02:00
|
|
|
Log "Preparing custom IPSW..."
|
|
|
|
cd resources
|
2021-09-06 10:50:29 +02:00
|
|
|
rm -rf FirmwareBundles
|
|
|
|
if [[ $JBDaibutsu == 1 ]]; then
|
|
|
|
ln -sf firmware/JailbreakBundles FirmwareBundles
|
|
|
|
else
|
|
|
|
ln -sf firmware/FirmwareBundles FirmwareBundles
|
|
|
|
fi
|
2021-09-13 14:02:22 +02:00
|
|
|
$ipsw ./../$IPSW.ipsw ./../$IPSWCustom.ipsw $ExtraArgs ${JBFiles[@]}
|
2021-05-29 13:26:08 +02:00
|
|
|
cd ..
|
|
|
|
fi
|
|
|
|
if [[ ! -e $IPSWCustom.ipsw ]]; then
|
|
|
|
Error "Failed to find custom IPSW. Please run the script again" \
|
|
|
|
"You may try selecting N for memory option"
|
|
|
|
fi
|
2021-09-06 10:50:29 +02:00
|
|
|
|
2021-05-29 13:26:08 +02:00
|
|
|
Log "Setting restore IPSW to: $IPSWCustom.ipsw"
|
|
|
|
IPSWRestore=$IPSWCustom
|
|
|
|
}
|
|
|
|
|
|
|
|
IPSW64() {
|
|
|
|
if [[ $IPSWRestore == $IPSWCustom ]]; then
|
|
|
|
Log "Found existing Custom IPSW. Skipping IPSW creation."
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
|
|
|
|
Log "Preparing custom IPSW..."
|
|
|
|
$bspatch $IPSW/Firmware/dfu/$iBSS.im4p $iBSS.im4p resources/patches/$iBSS.patch
|
|
|
|
$bspatch $IPSW/Firmware/dfu/$iBEC.im4p $iBEC.im4p resources/patches/$iBEC.patch
|
|
|
|
if [[ $ProductType == "iPad4"* ]]; then
|
|
|
|
$bspatch $IPSW/Firmware/dfu/$iBSSb.im4p $iBSSb.im4p resources/patches/$iBSSb.patch
|
|
|
|
$bspatch $IPSW/Firmware/dfu/$iBECb.im4p $iBECb.im4p resources/patches/$iBECb.patch
|
|
|
|
mv -f $iBSSb.im4p $iBECb.im4p $IPSW/Firmware/dfu
|
|
|
|
fi
|
|
|
|
mv -f $iBSS.im4p $iBEC.im4p $IPSW/Firmware/dfu
|
|
|
|
cd $IPSW
|
2021-09-06 10:50:29 +02:00
|
|
|
zip -rq0 ../$IPSWCustom.ipsw *
|
2021-05-29 13:26:08 +02:00
|
|
|
cd ..
|
|
|
|
mv $IPSW $IPSWCustom
|
2021-05-30 05:03:39 +02:00
|
|
|
if [[ ! -e $IPSWCustom.ipsw ]]; then
|
|
|
|
Error "Failed to find custom IPSW. Please run the script again"
|
|
|
|
fi
|
2021-09-06 10:50:29 +02:00
|
|
|
|
2021-05-29 13:26:08 +02:00
|
|
|
Log "Setting restore IPSW to: $IPSWCustom.ipsw"
|
|
|
|
IPSWRestore=$IPSWCustom
|
|
|
|
}
|