Add slashes if directory for cp and mv commands

- also some changes for windows idevicere(re)store
This commit is contained in:
LukeZGD 2022-10-11 09:41:07 +08:00
parent f8c2bfcf11
commit 32d0987883
4 changed files with 32 additions and 28 deletions

View File

@ -132,7 +132,7 @@ SaveExternal() {
SaveFile $Link $Name.zip $SHA1 SaveFile $Link $Name.zip $SHA1
cd ../resources cd ../resources
unzip -q ../tmp/$Name.zip -d . unzip -q ../tmp/$Name.zip -d .
mv $Name* $Name mv $Name*/ $Name/
cd .. cd ..
} }
@ -151,7 +151,7 @@ InstallDepends() {
mkdir resources/lib tmp 2>/dev/null mkdir resources/lib tmp 2>/dev/null
cd resources cd resources
cp lib/*.so.1.1 ../tmp 2>/dev/null cp lib/*.so.1.1 ../tmp/ 2>/dev/null
rm -rf lib/* rm -rf lib/*
cp ../tmp/*.so.1.1 lib/ 2>/dev/null cp ../tmp/*.so.1.1 lib/ 2>/dev/null
cd ../tmp cd ../tmp

View File

@ -349,7 +349,7 @@ PatchiBSS() {
Log "Downloading iBSS..." Log "Downloading iBSS..."
$partialzip "$(cat $Firmware/$iBSSBuildVer/url)" Firmware/dfu/$iBSS.dfu $iBSS.dfu $partialzip "$(cat $Firmware/$iBSSBuildVer/url)" Firmware/dfu/$iBSS.dfu $iBSS.dfu
mkdir -p saved/$ProductType 2>/dev/null mkdir -p saved/$ProductType 2>/dev/null
mv $iBSS.dfu saved/$ProductType mv $iBSS.dfu saved/$ProductType/
fi fi
if [[ ! -e saved/$ProductType/$iBSS.dfu ]]; then if [[ ! -e saved/$ProductType/$iBSS.dfu ]]; then
@ -464,7 +464,7 @@ Remove4DL() {
$partialzip $Link Firmware/dfu/$1.${HWModel}ap.RELEASE.dfu $1 $partialzip $Link Firmware/dfu/$1.${HWModel}ap.RELEASE.dfu $1
mkdir -p saved/$ProductType 2>/dev/null mkdir -p saved/$ProductType 2>/dev/null
cp $1 saved/$ProductType/$1_p cp $1 saved/$ProductType/$1_p
mv $1 tmp mv $1 tmp/
else else
cp saved/$ProductType/$1_p tmp/$1 cp saved/$ProductType/$1_p tmp/$1
fi fi
@ -529,7 +529,7 @@ Ramdisk4() {
curl -L $JailbreakLink/support_files/7.1.2/Ramdisk/$file -o $file curl -L $JailbreakLink/support_files/7.1.2/Ramdisk/$file -o $file
done done
cd .. cd ..
cp -rf ramdisk ../resources cp -rf ramdisk/ ../resources/
cd .. cd ..
fi fi

View File

@ -5,7 +5,7 @@ FRBaseband() {
if [[ $DeviceProc == 7 ]]; then if [[ $DeviceProc == 7 ]]; then
mkdir -p saved/baseband 2>/dev/null mkdir -p saved/baseband 2>/dev/null
cp -f $IPSWRestore/Firmware/$Baseband saved/baseband cp -f $IPSWRestore/Firmware/$Baseband saved/baseband/
fi fi
if [[ ! -e saved/baseband/$Baseband ]]; then if [[ ! -e saved/baseband/$Baseband ]]; then
@ -13,8 +13,8 @@ FRBaseband() {
$partialzip $BasebandURL Firmware/$Baseband $Baseband $partialzip $BasebandURL Firmware/$Baseband $Baseband
$partialzip $BasebandURL BuildManifest.plist BuildManifest.plist $partialzip $BasebandURL BuildManifest.plist BuildManifest.plist
mkdir -p saved/$ProductType saved/baseband 2>/dev/null mkdir -p saved/$ProductType saved/baseband 2>/dev/null
mv $Baseband saved/baseband mv $Baseband saved/baseband/
mv BuildManifest.plist saved/$ProductType mv BuildManifest.plist saved/$ProductType/
BuildManifest="saved/$ProductType/BuildManifest.plist" BuildManifest="saved/$ProductType/BuildManifest.plist"
elif [[ $DeviceProc != 7 ]]; then elif [[ $DeviceProc != 7 ]]; then
BuildManifest="saved/$ProductType/BuildManifest.plist" BuildManifest="saved/$ProductType/BuildManifest.plist"
@ -123,7 +123,7 @@ DowngradeOther() {
if [[ $NoMove == 1 ]]; then if [[ $NoMove == 1 ]]; then
rm $FWKeys/index.html rm $FWKeys/index.html
elif [[ -s tmp/index.html ]]; then elif [[ -s tmp/index.html ]]; then
mv tmp/index.html $FWKeys mv tmp/index.html $FWKeys/
fi fi
fi fi
@ -140,18 +140,22 @@ iDeviceRestore() {
ExtraArgs="-e -w" ExtraArgs="-e -w"
if [[ $1 == "latest" ]]; then if [[ $1 == "latest" ]]; then
ExtraArgs="-e" ExtraArgs="-e"
elif [[ $Baseband == 0 ]]; then
Log "Device $ProductType has no baseband/disabled baseband update"
elif [[ $platform == "win" && $ProductType != "iPhone3"* ]]; then elif [[ $platform == "win" && $ProductType != "iPhone3"* ]]; then
ExtraArgs="-r" ExtraArgs="-r"
idevicerestore="$idevicererestore" idevicerestore="$idevicererestore"
if [[ $Baseband == 0 ]]; then re="re"
Log "Device $ProductType has no baseband/disabled baseband update"
else
FRBaseband FRBaseband
cp saved/baseband/$Baseband tmp/bbfw.tmp cp saved/baseband/$Baseband tmp/bbfw.tmp
cp $BuildManifest tmp/BuildManifest.plist cp $BuildManifest tmp/
BasebandSHA1L=$($sha1sum tmp/bbfw.tmp | awk '{print $1}')
if [[ $BasebandSHA1L != $BasebandSHA1 ]]; then
rm -f saved/baseband/$Baseband saved/$ProductType/BuildManifest.plist
Error "Downloading/verifying baseband failed. Please run the script again"
fi fi
fi fi
Log "Running idevicerestore with command: $idevicerestore $ExtraArgs \"$IPSWRestore.ipsw\"" Log "Running idevicere${re}store with command: $idevicerestore $ExtraArgs \"$IPSWRestore.ipsw\""
$idevicerestore $ExtraArgs "$IPSWRestore.ipsw" $idevicerestore $ExtraArgs "$IPSWRestore.ipsw"
echo echo
Log "Restoring done! Read the message below if any error has occurred:" Log "Restoring done! Read the message below if any error has occurred:"

View File

@ -124,7 +124,7 @@ JailbreakFiles() {
fi fi
cd tmp cd tmp
SaveFile $1 $2 $3 SaveFile $1 $2 $3
mv $2 ../resources/jailbreak mv $2 ../resources/jailbreak/
cd .. cd ..
} }
@ -152,7 +152,7 @@ IPSWFindVerify() {
Echo "* The script will now proceed to download it for you. If you want to download it yourself, here is the link: $(cat $Firmware/$BuildVerDL/url)" Echo "* The script will now proceed to download it for you. If you want to download it yourself, here is the link: $(cat $Firmware/$BuildVerDL/url)"
Log "Downloading IPSW... (Press Ctrl+C to cancel)" Log "Downloading IPSW... (Press Ctrl+C to cancel)"
curl -L $(cat $Firmware/$BuildVerDL/url) -o tmp/$IPSWDL.ipsw curl -L $(cat $Firmware/$BuildVerDL/url) -o tmp/$IPSWDL.ipsw
mv tmp/$IPSWDL.ipsw . mv tmp/$IPSWDL.ipsw ./
fi fi
Log "Verifying $IPSWDL.ipsw..." Log "Verifying $IPSWDL.ipsw..."
@ -241,9 +241,9 @@ IPSW32() {
Log "Preparing custom IPSW..." Log "Preparing custom IPSW..."
cd tmp cd tmp
if [[ $JBDaibutsu == 1 ]]; then if [[ $JBDaibutsu == 1 ]]; then
cp -R ../resources/firmware/${WinBundles}JailbreakBundles FirmwareBundles cp -R ../resources/firmware/${WinBundles}JailbreakBundles/ FirmwareBundles/
else else
cp -R ../resources/firmware/${WinBundles}FirmwareBundles FirmwareBundles cp -R ../resources/firmware/${WinBundles}FirmwareBundles/ ./
fi fi
$ipsw ./../$IPSW.ipsw ./../$IPSWCustom.ipsw $ExtraArgs $BBUpdate $JBMemory ${JBFiles[@]} $ipsw ./../$IPSW.ipsw ./../$IPSWCustom.ipsw $ExtraArgs $BBUpdate $JBMemory ${JBFiles[@]}
cd .. cd ..
@ -299,7 +299,7 @@ IPSW4() {
cd tmp cd tmp
if [[ $OSVer == "7.1.2" && ! -e $IPSWCustom.ipsw ]]; then if [[ $OSVer == "7.1.2" && ! -e $IPSWCustom.ipsw ]]; then
Log "Preparing custom IPSW..." Log "Preparing custom IPSW..."
cp -rf ../resources/firmware/FirmwareBundles . cp -rf ../resources/firmware/FirmwareBundles/ ./
$ipsw ../$IPSW.ipsw ../$IPSWCustom.ipsw $JBMemory -S 50 ${JBFiles[@]} $ipsw ../$IPSW.ipsw ../$IPSWCustom.ipsw $JBMemory -S 50 ${JBFiles[@]}
elif [[ ! -e $IPSWCustom.ipsw ]]; then elif [[ ! -e $IPSWCustom.ipsw ]]; then
echo echo
@ -315,8 +315,8 @@ IPSW4() {
fi fi
Log "Preparing custom IPSW with powdersn0w..." Log "Preparing custom IPSW with powdersn0w..."
cp -rf ../resources/firmware/powdersn0wBundles ./FirmwareBundles cp -rf ../resources/firmware/powdersn0wBundles/ ./FirmwareBundles/
cp -rf ../resources/firmware/src . cp -rf ../resources/firmware/src/ ./
if [[ $Jailbreak == 1 && $OSVer == "6."* ]]; then if [[ $Jailbreak == 1 && $OSVer == "6."* ]]; then
JBFiles=() JBFiles=()
rm FirmwareBundles/${config}.plist rm FirmwareBundles/${config}.plist
@ -389,9 +389,9 @@ IPSW4Cherry() {
cd tmp cd tmp
Log "Preparing custom IPSW with ch3rryflower..." Log "Preparing custom IPSW with ch3rryflower..."
cp -rf ../$cherrymac/FirmwareBundles ../$cherrymac/src . cp -rf ../$cherrymac/FirmwareBundles/ ../$cherrymac/src/ ./
unzip -j ../$IPSW.ipsw Firmware/all_flash/all_flash.${HWModel}ap.production/iBoot* unzip -j ../$IPSW.ipsw Firmware/all_flash/all_flash.${HWModel}ap.production/iBoot*
mv iBoot.${HWModel}ap.RELEASE.img3 tmp mv iBoot.${HWModel}ap.RELEASE.img3 tmp/
$xpwntool tmp ibot.dec -iv $IV -k $Key $xpwntool tmp ibot.dec -iv $IV -k $Key
../$cherry/bin/iBoot32Patcher ibot.dec ibot.pwned --rsa --boot-partition --boot-ramdisk $ExtraArgs ../$cherry/bin/iBoot32Patcher ibot.dec ibot.pwned --rsa --boot-partition --boot-ramdisk $ExtraArgs
$xpwntool ibot.pwned iBoot -t tmp $xpwntool ibot.pwned iBoot -t tmp
@ -434,7 +434,7 @@ IPSW4Powder() {
powderdir="../resources/powdersn0w/macosx_x86_64" powderdir="../resources/powdersn0w/macosx_x86_64"
cd tmp cd tmp
cp -rf $powderdir/FirmwareBundles $powderdir/src . cp -rf $powderdir/FirmwareBundles/ $powderdir/src/ ./
powdersn0w="$powderdir/ipsw" powdersn0w="$powderdir/ipsw"
if [[ $platform != "macos" ]]; then if [[ $platform != "macos" ]]; then
@ -477,12 +477,12 @@ IPSW64() {
Log "Preparing custom IPSW..." Log "Preparing custom IPSW..."
$bspatch $IPSW/Firmware/dfu/$iBSS.im4p $iBSS.im4p resources/patches/$iBSS.patch $bspatch $IPSW/Firmware/dfu/$iBSS.im4p $iBSS.im4p resources/patches/$iBSS.patch
$bspatch $IPSW/Firmware/dfu/$iBEC.im4p $iBEC.im4p resources/patches/$iBEC.patch $bspatch $IPSW/Firmware/dfu/$iBEC.im4p $iBEC.im4p resources/patches/$iBEC.patch
mv -f $iBSS.im4p $iBEC.im4p $IPSW/Firmware/dfu/
if [[ $ProductType == "iPad4"* ]]; then if [[ $ProductType == "iPad4"* ]]; then
$bspatch $IPSW/Firmware/dfu/$iBSSb.im4p $iBSSb.im4p resources/patches/$iBSSb.patch $bspatch $IPSW/Firmware/dfu/$iBSSb.im4p $iBSSb.im4p resources/patches/$iBSSb.patch
$bspatch $IPSW/Firmware/dfu/$iBECb.im4p $iBECb.im4p resources/patches/$iBECb.patch $bspatch $IPSW/Firmware/dfu/$iBECb.im4p $iBECb.im4p resources/patches/$iBECb.patch
mv -f $iBSSb.im4p $iBECb.im4p $IPSW/Firmware/dfu mv -f $iBSSb.im4p $iBECb.im4p $IPSW/Firmware/dfu/
fi fi
mv -f $iBSS.im4p $iBEC.im4p $IPSW/Firmware/dfu
cd $IPSW cd $IPSW
zip -rq0 ../$IPSWCustom.ipsw * zip -rq0 ../$IPSWCustom.ipsw *
cd .. cd ..