Support Fedora Atomic (#600), add custom bootargs option for just boot

and other changes ig
This commit is contained in:
LukeeGD 2024-10-19 19:54:09 +08:00
parent 146a80e389
commit 2f9f797bbf
2 changed files with 70 additions and 9 deletions

View File

@ -122,7 +122,7 @@
- [**Ubuntu**](https://ubuntu.com/) 22.04 and newer, and Ubuntu-based distros like [Linux Mint](https://www.linuxmint.com/) - [**Ubuntu**](https://ubuntu.com/) 22.04 and newer, and Ubuntu-based distros like [Linux Mint](https://www.linuxmint.com/)
- [**Arch Linux**](https://www.archlinux.org/) and Arch-based distros like [EndeavourOS](https://endeavouros.com/) - [**Arch Linux**](https://www.archlinux.org/) and Arch-based distros like [EndeavourOS](https://endeavouros.com/)
- [**Fedora**](https://getfedora.org/) 37 and newer - [**Fedora**](https://getfedora.org/) 37 and newer, Fedora Atomic (Silverblue, Kinoite, etc.) also supported
- [**Debian**](https://www.debian.org/) 12 Bookworm and newer, Sid, and Debian-based distros - [**Debian**](https://www.debian.org/) 12 Bookworm and newer, Sid, and Debian-based distros
- [**openSUSE**](https://www.opensuse.org/) Tumbleweed - [**openSUSE**](https://www.opensuse.org/) Tumbleweed
- [**Gentoo**](https://www.gentoo.org/) and Gentoo-based distros - [**Gentoo**](https://www.gentoo.org/) and Gentoo-based distros

View File

@ -37,7 +37,7 @@ pause() {
clean() { clean() {
kill $httpserver_pid $iproxy_pid $anisette_pid 2>/dev/null kill $httpserver_pid $iproxy_pid $anisette_pid 2>/dev/null
popd >/dev/null popd &>/dev/null
rm -rf "$(dirname "$0")/tmp$$/"* "$(dirname "$0")/iP"*/ "$(dirname "$0")/tmp$$/" 2>/dev/null rm -rf "$(dirname "$0")/tmp$$/"* "$(dirname "$0")/iP"*/ "$(dirname "$0")/tmp$$/" 2>/dev/null
if [[ $platform == "macos" && $(ls "$(dirname "$0")" | grep -v tmp$$ | grep -c tmp) == 0 ]]; then if [[ $platform == "macos" && $(ls "$(dirname "$0")" | grep -v tmp$$ | grep -c tmp) == 0 ]]; then
killall -CONT AMPDevicesAgent AMPDeviceDiscoveryAgent MobileDeviceUpdater killall -CONT AMPDevicesAgent AMPDeviceDiscoveryAgent MobileDeviceUpdater
@ -174,6 +174,9 @@ set_tool_paths() {
distro="debian" distro="debian"
elif (( fedora_ver >= 37 )); then elif (( fedora_ver >= 37 )); then
distro="fedora" distro="fedora"
if [[ $(command -v rpm-ostree) ]]; then
distro="fedora-atomic"
fi
elif [[ $ID == "opensuse-tumbleweed" ]]; then elif [[ $ID == "opensuse-tumbleweed" ]]; then
distro="opensuse" distro="opensuse"
elif [[ $ID == "gentoo" || $ID_LIKE == "gentoo" || $ID == "pentoo" ]]; then elif [[ $ID == "gentoo" || $ID_LIKE == "gentoo" || $ID == "pentoo" ]]; then
@ -362,7 +365,7 @@ install_depends() {
if [[ $platform == "linux" ]]; then if [[ $platform == "linux" ]]; then
print "* Legacy iOS Kit will be installing dependencies from your distribution's package manager" print "* Legacy iOS Kit will be installing dependencies from your distribution's package manager"
print "* Enter your user password when prompted" print "* Enter your user password when prompted"
if [[ $distro != "debian" ]]; then if [[ $distro != "debian" && $distro != "fedora-atomic" ]]; then
echo echo
warn "Before continuing, make sure that your system is fully updated first!" warn "Before continuing, make sure that your system is fully updated first!"
echo "${color_Y}* This operation can result in a partial upgrade and may cause breakage if your system is not updated${color_N}" echo "${color_Y}* This operation can result in a partial upgrade and may cause breakage if your system is not updated${color_N}"
@ -392,6 +395,10 @@ install_depends() {
sudo ln -sf /etc/pki/tls/certs/ca-bundle.crt /etc/pki/tls/certs/ca-certificates.crt sudo ln -sf /etc/pki/tls/certs/ca-bundle.crt /etc/pki/tls/certs/ca-certificates.crt
prepare_udev_rules root usbmuxd prepare_udev_rules root usbmuxd
elif [[ $distro == "fedora-atomic" ]]; then
rpm-ostree install patch vim-common zenity
print "* You may need to reboot to apply changes with rpm-ostree. Perform a reboot after this before running the script again."
elif [[ $distro == "opensuse" ]]; then elif [[ $distro == "opensuse" ]]; then
sudo zypper -n install ca-certificates curl git ifuse libimobiledevice-1_0-6 libopenssl-3-devel libxml2 libzstd1 openssl-3 patch pyenv python3 usbmuxd unzip vim zenity zip zlib-devel sudo zypper -n install ca-certificates curl git ifuse libimobiledevice-1_0-6 libopenssl-3-devel libxml2 libzstd1 openssl-3 patch pyenv python3 usbmuxd unzip vim zenity zip zlib-devel
sudo zypper -n install -t pattern devel_basis sudo zypper -n install -t pattern devel_basis
@ -410,7 +417,7 @@ install_depends() {
fi fi
echo "$platform_ver" > "../resources/firstrun" echo "$platform_ver" > "../resources/firstrun"
if [[ $platform == "linux" ]]; then if [[ $platform == "linux" && $distro != "fedora-atomic" ]]; then
# from linux_fix and libirecovery-rules by Cryptiiiic # from linux_fix and libirecovery-rules by Cryptiiiic
if [[ $(command -v systemctl 2>/dev/null) ]]; then if [[ $(command -v systemctl 2>/dev/null) ]]; then
sudo systemctl enable --now systemd-udevd usbmuxd 2>/dev/null sudo systemctl enable --now systemd-udevd usbmuxd 2>/dev/null
@ -1759,6 +1766,11 @@ device_ipwndfu() {
print "* Try installing pyenv and/or python2 manually:" print "* Try installing pyenv and/or python2 manually:"
print " pyenv: > curl https://pyenv.run | bash" print " pyenv: > curl https://pyenv.run | bash"
print " python2: > $pyenv install 2.7.18" print " python2: > $pyenv install 2.7.18"
if [[ $distro == "fedora-atomic" ]]; then
print "* For Fedora Atomic, you will also need to set up toolbox and build environment."
print "* Follow the commands here under Fedora Silverblue: https://github.com/pyenv/pyenv/wiki#suggested-build-environment"
print "* Run the pyenv install commands while in the toolbox container."
fi
error "Cannot detect python2 for ipwndfu, cannot continue." error "Cannot detect python2 for ipwndfu, cannot continue."
fi fi
fi fi
@ -5497,7 +5509,7 @@ device_ramdisk() {
"$dir/iBoot32Patcher" iBSS.raw iBSS.patched --rsa -b "-v amfi=0xff cs_enforcement_disable=1" "$dir/iBoot32Patcher" iBSS.raw iBSS.patched --rsa -b "-v amfi=0xff cs_enforcement_disable=1"
device_boot4=1 device_boot4=1
else else
"$dir/iBoot32Patcher" iBSS.raw iBSS.patched --rsa -b "-v" "$dir/iBoot32Patcher" iBSS.raw iBSS.patched --rsa -b "$device_justboot_bootargs"
fi fi
"$dir/xpwntool" iBSS.patched iBSS -t iBSS.dec "$dir/xpwntool" iBSS.patched iBSS -t iBSS.dec
if [[ $build_id == "7"* || $build_id == "8"* ]] && [[ $device_type != "iPad"* ]]; then if [[ $build_id == "7"* || $build_id == "8"* ]] && [[ $device_type != "iPad"* ]]; then
@ -5506,7 +5518,7 @@ device_ramdisk() {
log "Patch iBEC" log "Patch iBEC"
"$dir/xpwntool" iBEC.dec iBEC.raw "$dir/xpwntool" iBEC.dec iBEC.raw
if [[ $1 == "justboot" ]]; then if [[ $1 == "justboot" ]]; then
"$dir/iBoot32Patcher" iBEC.raw iBEC.patched --rsa -b "-v pio-error=0" "$dir/iBoot32Patcher" iBEC.raw iBEC.patched --rsa -b "$device_justboot_bootargs"
else else
"$dir/iBoot32Patcher" iBEC.raw iBEC.patched --rsa --debug -b "rd=md0 -v amfi=0xff amfi_get_out_of_my_way=1 cs_enforcement_disable=1 pio-error=0" "$dir/iBoot32Patcher" iBEC.raw iBEC.patched --rsa --debug -b "rd=md0 -v amfi=0xff amfi_get_out_of_my_way=1 cs_enforcement_disable=1 pio-error=0"
fi fi
@ -7932,7 +7944,7 @@ menu_other() {
"Activation Records" ) mode="actrec";; "Activation Records" ) mode="actrec";;
"Exit Recovery Mode" ) mode="exitrecovery";; "Exit Recovery Mode" ) mode="exitrecovery";;
"DFU Mode Helper" ) mode="enterdfu";; "DFU Mode Helper" ) mode="enterdfu";;
"Just Boot" ) mode="device_justboot";; "Just Boot" ) menu_justboot;;
"Get iOS Version" ) mode="getversion";; "Get iOS Version" ) mode="getversion";;
"Pair Device" ) device_pair;; "Pair Device" ) device_pair;;
"Power Options" ) menu_power;; "Power Options" ) menu_power;;
@ -8488,9 +8500,58 @@ device_enter_build() {
done done
} }
device_justboot() { menu_justboot() {
local menu_items
local selected
local back
local vers
while [[ -z "$mode" && -z "$back" ]]; do
menu_items=("Enter Build Version" "Custom Bootargs")
if [[ -n $vers ]]; then
menu_items+=("Just Boot")
fi
menu_items+=("Go Back")
menu_print_info
print " > Main Menu > Other Utilities > Just Boot"
print "* You are about to do a tethered boot." print "* You are about to do a tethered boot."
device_enter_build required print "* To know more about build version, go here: https://theapplewiki.com/wiki/Firmware"
echo
if [[ -n $vers ]]; then
print "* Build Version entered: $vers"
else
print "* Enter build version to continue"
fi
echo
if [[ -n $device_justboot_bootargs ]]; then
print "* Custom Bootargs: $device_justboot_bootargs"
else
print "* Default Bootargs: -v pio-error=0"
print "* You may enter custom bootargs (optional, advanced option)"
fi
echo
input "Select an option:"
select opt in "${menu_items[@]}"; do
selected="$opt"
break
done
case $selected in
"Enter Build Version" )
print "* Enter the build version of your device's current iOS version to boot."
device_enter_build
vers="$device_rd_build"
;;
"Custom Bootargs" ) read -p "$(input 'Enter custom bootargs: ')" device_justboot_bootargs;;
"Just Boot" ) mode="device_justboot";;
"Go Back" ) back=1;;
esac
done
}
device_justboot() {
if [[ -z $device_justboot_bootargs ]]; then
device_justboot_bootargs="-v pio-error=0"
fi
device_ramdisk justboot device_ramdisk justboot
} }