Some Shellcheck stuff

This commit is contained in:
LukeZGD 2021-11-17 14:37:02 +08:00
parent 5f27ef2db6
commit 83087e0fdc
5 changed files with 14 additions and 14 deletions

View File

@ -35,7 +35,7 @@ SaveOTABlobs() {
SHSHContinue=1
fi
if [[ ! -z $SHSH && $SHSHContinue != 1 ]]; then
if [[ -n $SHSH && $SHSHContinue != 1 ]]; then
mkdir -p saved/shsh 2>/dev/null
[[ ! $SHSHExisting ]] && cp "$SHSH" saved/shsh
Log "Successfully saved $OSVer blobs."

View File

@ -30,7 +30,7 @@ SetToolPaths() {
else
Detect=
fi
[[ ! -z $Detect ]] && Log "$Detect"
[[ -n $Detect ]] && Log "$Detect"
bspatch="/usr/bin/bspatch"
futurerestore="./resources/tools/futurerestore_macos_$(uname -m)"
[[ ! -e $futurerestore ]] && futurerestore="./resources/tools/futurerestore_macos_arm64"
@ -110,13 +110,13 @@ InstallDepends() {
if [[ $ID == "arch" || $ID_LIKE == "arch" || $ID == "artix" ]]; then
sudo pacman -Syu --noconfirm --needed base-devel bsdiff curl libimobiledevice openssh python2 unzip usbutils zenity
elif [[ ! -z $UBUNTU_CODENAME && $VERSION_ID == "2"* ]] ||
elif [[ -n $UBUNTU_CODENAME && $VERSION_ID == "2"* ]] ||
[[ $VERSION == "11 (bullseye)" || $PRETTY_NAME == "Debian"*"sid" ]]; then
[[ ! -z $UBUNTU_CODENAME ]] && sudo add-apt-repository -y universe
[[ -n $UBUNTU_CODENAME ]] && sudo add-apt-repository -y universe
sudo apt update
sudo apt install -y bsdiff curl git libimobiledevice6 openssh-client python2 unzip usbmuxd usbutils zenity
elif [[ $ID == "fedora" ]] && (( $VERSION_ID >= 33 )); then
elif [[ $ID == "fedora" ]] && (( VERSION_ID >= 33 )); then
ln -sf /usr/lib64/libbz2.so.1.* ../resources/lib/libbz2.so.1.0
sudo dnf install -y bsdiff git libimobiledevice perl-Digest-SHA python2 zenity

View File

@ -6,10 +6,10 @@ FindDevice() {
local Timeout=999
local USB
[[ $1 == "DFU" ]] && USB=1227 || USB=1281
[[ ! -z $2 ]] && Timeout=3
[[ -n $2 ]] && Timeout=3
Log "Finding device in $1 mode..."
while (( $i < $Timeout )); do
while (( i < Timeout )); do
if [[ $platform == "linux" ]]; then
DeviceIn=$(lsusb | grep -c "05ac:$USB")
else
@ -44,7 +44,7 @@ GetDeviceValues() {
elif [[ $1 == "NoDevice" ]]; then
Log "NoDevice argument detected. Skipping device detection"
DeviceState="NoDevice"
elif [[ ! -z $ideviceinfo2 ]]; then
elif [[ -n $ideviceinfo2 ]]; then
DeviceState="Normal"
fi
@ -71,7 +71,7 @@ GetDeviceValues() {
echo "${Color_Y}* Recovery or DFU mode is also applicable. For more details regarding alternative methods, read the \"Troubleshooting\" wiki page in GitHub ${Color_N}"
echo "${Color_Y}* To perform operations without an iOS device connected, add NoDevice as an argument. Example: ./restore.sh NoDevice ${Color_N}"
exit 1
elif [[ ! -z $DeviceState ]]; then
elif [[ -n $DeviceState ]]; then
if [[ ! $ProductType ]]; then
read -p "$(Input 'Enter ProductType (eg. iPad2,1):')" ProductType
fi
@ -291,7 +291,7 @@ kDFU() {
if [[ ! -e saved/$ProductType/$iBSS.dfu ]]; then
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
mv $iBSS.dfu saved/$ProductType
fi

View File

@ -55,7 +55,7 @@ IPSW32() {
cd tmp
for i in {0..2}; do
local URL="https://github.com/dora2-iOS/daibutsuCFW/raw/main/build/src/"
(( $i > 0 )) && URL+="daibutsu/${JBFiles2[$i]}" || URL+="${JBFiles2[$i]}"
(( i > 0 )) && URL+="daibutsu/${JBFiles2[$i]}" || URL+="${JBFiles2[$i]}"
if [[ ! -e ../resources/jailbreak/${JBFiles2[$i]} ]]; then
Log "Downloading ${JBFiles2[$i]}..."
SaveFile $URL ${JBFiles2[$i]} ${JBSHA1[$i]}
@ -100,7 +100,7 @@ IPSW32() {
else
cp -R firmware/FirmwareBundles FirmwareBundles
fi
$ipsw ./../$IPSW.ipsw ./../$IPSWCustom.ipsw $ExtraArgs ${JBFiles[@]}
$ipsw ./../$IPSW.ipsw ./../$IPSWCustom.ipsw $ExtraArgs "${JBFiles[@]}"
cd ..
fi
if [[ ! -e $IPSWCustom.ipsw ]]; then

View File

@ -30,7 +30,7 @@ Echo() {
Error() {
echo -e "\n${Color_R}[Error] $1 ${Color_N}"
[[ ! -z $2 ]] && echo "${Color_R}* $2 ${Color_N}"
[[ -n $2 ]] && echo "${Color_R}* $2 ${Color_N}"
echo
exit 1
}
@ -99,7 +99,7 @@ Main() {
Clean
mkdir tmp
[[ ! -z $1 ]] && SkipMainMenu=1
[[ -n $1 ]] && SkipMainMenu=1
if [[ $SkipMainMenu == 1 && $1 != "NoColor" && $1 != "NoDevice" ]]; then
Mode="$1"