Detect if running on persistent storage

This commit is contained in:
LukeZGD 2023-02-18 11:56:52 +08:00
parent 4ded17bdc7
commit 0961392e48

View File

@ -164,13 +164,19 @@ set_tool_paths() {
# live cd/usb check # live cd/usb check
if [[ $(id -u $USER) == 999 ]]; then if [[ $(id -u $USER) == 999 ]]; then
live_cdusb=1
log "Linux Live CD/USB detected." log "Linux Live CD/USB detected."
if [[ $(pwd) == "/home"* ]]; then if [[ $(pwd) == "/home"* ]]; then
warn "Detected iOS-OTA-Downgrader running on temporary storage." if [[ $(lsblk -o label | grep -c "casper-rw") == 1 ]]; then
print "* You may run out of space and get errors during the downgrade process." log "Detected iOS-OTA-Downgrader running on persistent storage."
print "* Please move iOS-OTA-Downgrader to an external drive that is NOT used for the live USB." else
print "* This means using another external HDD/flash drive to store iOS-OTA-Downgrader on." warn "Detected iOS-OTA-Downgrader running on temporary storage."
pause print "* You may run out of space and get errors during the downgrade process."
print "* Please move iOS-OTA-Downgrader to an external drive that is NOT used for the live USB."
print "* This means using another external HDD/flash drive to store iOS-OTA-Downgrader on."
print "* To be able to use one USB drive only, make sure to enable Persistent Storage for the live USB."
pause
fi
fi fi
fi fi
@ -184,8 +190,8 @@ set_tool_paths() {
device_sudoloop=1 device_sudoloop=1
fi fi
fi fi
if [[ $(uname -m) == "a"* || $device_sudoloop == 1 || $(id -u $USER) == 999 ]]; then if [[ $(uname -m) == "a"* || $device_sudoloop == 1 || $live_cdusb == 1 ]]; then
if [[ $(id -u $USER) != 999 ]]; then if [[ $live_cdusb != 1 ]]; then
print "* Enter your user password when prompted" print "* Enter your user password when prompted"
fi fi
sudo -v sudo -v