Skip to content

Commit ed35193

Browse files
committed
attempt versioning consistency, refresh some device info on pair, workaround for #932
1 parent ba32440 commit ed35193

File tree

2 files changed

+71
-34
lines changed

2 files changed

+71
-34
lines changed

.github/workflows/build.yml

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,14 @@ jobs:
1313

1414
- name: Create name version env
1515
run: |
16-
sudo timedatectl set-timezone Asia/Singapore
17-
echo "DATE=$(date +%y.%m)" >> $GITHUB_ENV
18-
echo "COUNT=$(git rev-list --count HEAD --since=$(date --date="$(date +%Y-%m-01) - 1 second" +%s) | xargs printf "%02d")" >> $GITHUB_ENV
16+
export TZ=UTC
17+
ts=$(git log -1 --format=%ct)
18+
yy=$(date -d "@$ts" +%y)
19+
mm=$(date -d "@$ts" +%m)
20+
month_start=$(date -d "20$yy-$mm-01 00:00:00" +%s)
21+
count=$(git rev-list --count HEAD --since="$month_start")
22+
version_current="v$yy.$mm.$(printf "%02d" "$count")"
23+
echo "VERSION_CURRENT=$version_current" >> $GITHUB_ENV
1924
2025
- name: Move binaries
2126
run: |
@@ -31,7 +36,7 @@ jobs:
3136
touch ./resources/new
3237
3338
- name: Zip files
34-
run: zip -r ${{ github.event.repository.name }}_v${{ env.DATE }}.${{ env.COUNT }}.zip bin/ LICENSE resources/ restore.sh README.md
39+
run: zip -r ${{ github.event.repository.name }}_${{ env.VERSION_CURRENT }}.zip bin/ LICENSE resources/ restore.sh README.md
3540

3641
- name: Remove all assets from latest release
3742
env:
@@ -54,9 +59,9 @@ jobs:
5459
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5560
run: |
5661
gh release upload latest \
57-
${{ github.event.repository.name }}_v${{ env.DATE }}.${{ env.COUNT }}.zip \
62+
${{ github.event.repository.name }}_${{ env.VERSION_CURRENT }}.zip \
5863
--clobber -R ${{ github.repository }}
5964
6065
gh release edit latest \
61-
--title "Latest-v${{ env.DATE }}.${{ env.COUNT }}" \
66+
--title "Latest-${{ env.VERSION_CURRENT }}" \
6267
--target ${{ github.sha }} -R ${{ github.repository }}

restore.sh

Lines changed: 60 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -773,16 +773,24 @@ version_get() {
773773
fi
774774
fi
775775
git_hash=$(git rev-parse HEAD | cut -c -7)
776-
local dm=$(git log -1 --format=%ci | cut -c 3- | cut -c -5)
777-
version_current=v${dm//-/.}.
778-
dm="20$dm"
779-
if [[ $(uname) == "Darwin" ]]; then
780-
dm="$(date -j -f "%Y-%m-%d %H:%M:%S" "${dm}-01 00:00:00" +%s)"
776+
777+
export TZ=UTC
778+
local ts=$(git log -1 --format=%ct)
779+
local yy
780+
local mm
781+
local month_start
782+
if [[ $(uname) == Darwin ]]; then
783+
yy=$(date -r "$ts" +%y)
784+
mm=$(date -r "$ts" +%m)
785+
month_start=$(date -j -f "%Y-%m-%d %H:%M:%S" "20$yy-$mm-01 00:00:00" +%s)
781786
else
782-
dm="$(date --date="${dm}-01" +%s)"
787+
yy=$(date -d "@$ts" +%y)
788+
mm=$(date -d "@$ts" +%m)
789+
month_start=$(date -d "20$yy-$mm-01 00:00:00" +%s)
783790
fi
784-
dm=$((dm-1))
785-
version_current+=$(git rev-list --count HEAD --since=$dm | xargs printf "%02d")
791+
local count=$(git rev-list --count HEAD --since="$month_start")
792+
version_current="v$yy.$mm.$(printf "%02d" "$count")"
793+
786794
elif [[ -e ./resources/git_hash ]]; then
787795
version_current="$(cat ./resources/version)"
788796
git_hash="$(cat ./resources/git_hash)"
@@ -832,17 +840,18 @@ device_entry() {
832840
# enable manual entry
833841
log "Manual device/ECID entry is enabled."
834842
until [[ -n $device_type && $device_type == "iP"* ]]; do
835-
read -p "$(input 'Enter device type (eg. iPad2,1): ')" device_type
843+
read -p "$(input 'Enter device type (eg. iPad2,1): ')" device_type_entry
844+
device_type="$device_type_entry"
836845
done
837846
if [[ $main_argmode == "device_justboot"* || $main_argmode == "device_enter_ramdisk"* ]]; then
838847
:
839-
elif [[ $device_type != "iPhone1,"* && $device_type != "iPod1,1" ]]; then
840-
until [[ -n $device_ecid ]] && [ "$device_ecid" -eq "$device_ecid" ]; do
841-
read -p "$(input 'Enter device ECID (must be decimal): ')" device_ecid
848+
elif [[ $device_type != "iPhone1,"* && $device_type != "iPod1,1" && $device_mode != "Normal" ]]; then
849+
until [[ -n $device_ecid_entry ]] && [ "$device_ecid_entry" -eq "$device_ecid_entry" ]; do
850+
read -p "$(input 'Enter device ECID (must be decimal): ')" device_ecid_entry
842851
done
843852
fi
844-
if [[ -n $device_ecid && $main_argmode == "device_justboot"* ]]; then
845-
cat "$device_rd_build" > "../saved/$device_type/justboot_${device_ecid}"
853+
if [[ -n $device_ecid_entry && $main_argmode == "device_justboot"* ]]; then
854+
cat "$device_rd_build" > "../saved/$device_type/justboot_${device_ecid_entry}"
846855
fi
847856
}
848857

@@ -1014,6 +1023,18 @@ device_get_name() {
10141023
fi
10151024
}
10161025

1026+
device_paired_info() {
1027+
device_serial="$($ideviceinfo -k SerialNumber | cut -c 3- | cut -c -3)"
1028+
device_unactivated=$($ideviceactivation state | grep -c "Unactivated")
1029+
device_imei=$($ideviceinfo -k InternationalMobileEquipmentIdentity)
1030+
device_platform=$($ideviceinfo -k HardwarePlatform)
1031+
# workaround attempt for https://github.com/LukeZGD/Legacy-iOS-Kit/issues/932#issuecomment-3794394200
1032+
if [[ $device_platform == "s5l8940x" && $device_model == "k93a" ]] || [[ $device_type_entry == "iPad2,1" ]]; then
1033+
device_type="iPad2,1"
1034+
device_model="k93"
1035+
fi
1036+
}
1037+
10171038
device_manufacturing() {
10181039
if (( device_proc > 10 )) || [[ $device_proc != 1 && $device_argmode == "none" ]]; then
10191040
return
@@ -1065,6 +1086,11 @@ device_manufacturing() {
10651086
esac
10661087
if [[ -n $year_half ]]; then
10671088
print "* Manufactured in $year_half"
1089+
elif (( device_proc >= 5 )); then
1090+
print "* Select Pair Device to get more device information"
1091+
if [[ -n $device_use_bb ]] && (( device_proc <= 6 )); then
1092+
print "* This will also check if your device is affected by the 9900 IMEI activation issue"
1093+
fi
10681094
fi
10691095
fi
10701096
case $device_newbr in
@@ -1228,8 +1254,8 @@ device_get_info() {
12281254
else
12291255
device_type=$($ideviceinfo -s -k ProductType)
12301256
[[ -z $device_type ]] && device_type=$($ideviceinfo -k ProductType)
1231-
device_ecid=$($ideviceinfo -s -k UniqueChipID)
12321257
fi
1258+
device_ecid=$($ideviceinfo -s -k UniqueChipID)
12331259
device_model=$($ideviceinfo -s -k HardwareModel)
12341260
if [[ $device_model == "N81AP" ]]; then
12351261
device_type="iPod4,1" # this is needed since touch 4 devices on ios 7 show as iphone3,1/3,3
@@ -1241,12 +1267,13 @@ device_get_info() {
12411267
device_build=$($ideviceinfo -s -k BuildVersion)
12421268
device_udid=$($ideviceinfo -s -k UniqueDeviceID)
12431269
[[ -z $device_udid ]] && device_udid=$($ideviceinfo -k UniqueDeviceID)
1244-
if [[ $device_type == "iPod2,1" ]]; then
1245-
device_newbr="$($ideviceinfo -k ModelNumber | grep -c 'C')"
1246-
fi
1247-
device_serial="$($ideviceinfo -k SerialNumber | cut -c 3- | cut -c -3)"
1248-
device_unactivated=$($ideviceactivation state | grep -c "Unactivated")
1249-
device_imei=$($ideviceinfo -k InternationalMobileEquipmentIdentity)
1270+
# forced pair for ipad2,1 on start because of possible issues with device type and model
1271+
# i'd like to force pair for all it but would prob get annoying quick especially on linux
1272+
case $device_type in
1273+
"iPod2,1" ) device_newbr="$($ideviceinfo -k ModelNumber | grep -c 'C')";;
1274+
"iPad2,1" ) [[ -z $device_type_entry ]] && device_pair;;
1275+
esac
1276+
device_paired_info
12501277
fi
12511278
;;
12521279
esac
@@ -7769,7 +7796,11 @@ menu_main() {
77697796
if [[ $device_mode != "none" ]]; then
77707797
menu_items+=("Useful Utilities")
77717798
fi
7772-
menu_items+=("Misc Utilities" "Exit")
7799+
menu_items+=("Misc Utilities")
7800+
if [[ $device_mode == "Normal" ]] && (( device_vers_maj >= 7 )); then
7801+
menu_items+=("Pair Device")
7802+
fi
7803+
menu_items+=("Exit")
77737804
select_option "${menu_items[@]}"
77747805
selected="${menu_items[$?]}"
77757806
case $selected in
@@ -7784,7 +7815,7 @@ menu_main() {
77847815
"Attempt Activation" ) device_activate;;
77857816
"Exit Recovery Mode" ) mode="exitrecovery";;
77867817
"Just Boot" ) menu_justboot;;
7787-
"Enter pwnDFU Mode" ) device_s5l8900xall;;
7818+
"Pair Device" ) device_pair;;
77887819
"Exit" ) mode="exit";;
77897820
esac
77907821
done
@@ -7845,7 +7876,7 @@ menu_datamanage() {
78457876
if (( device_vers_maj >= 9 )); then
78467877
menu_items+=("Erase All Content and Settings")
78477878
fi
7848-
menu_items+=("Pair Device" "Go Back")
7879+
menu_items+=("Go Back")
78497880
while [[ -z "$mode" && -z "$back" ]]; do
78507881
echo
78517882
print " > Main Menu > Data Management"
@@ -7893,7 +7924,6 @@ menu_datamanage() {
78937924
kill $iproxy_pid $sshfs_pid
78947925
;;
78957926
"Connect to SSH" ) device_ssh;;
7896-
"Pair Device" ) device_pair;;
78977927
esac
78987928
done
78997929
}
@@ -9777,7 +9807,7 @@ menu_miscutilities() {
97779807
case $device_type in
97789808
iPad2,[123] ) menu_items+=("FourThree Utility");;
97799809
esac
9780-
menu_items+=("Pair Device" "Export Device Info")
9810+
menu_items+=("Export Device Info")
97819811
if (( device_vers_maj < 5 )); then
97829812
warn "Device is on lower than iOS 5. Battery info is not available"
97839813
else
@@ -9834,7 +9864,6 @@ menu_miscutilities() {
98349864
fi
98359865
log "Battery Info exported to: $info"
98369866
;;
9837-
"Pair Device" ) device_pair;;
98389867
"Shutdown Device" ) mode="shutdown";;
98399868
"Restart Device" ) mode="restart";;
98409869
"Enter Recovery Mode" ) mode="enterrecovery";;
@@ -9971,11 +10000,14 @@ device_pair() {
997110000
"$dir/idevicepair" pair
997210001
if [[ $? != 0 ]]; then
997310002
log "Unlock and press \"Trust\" on the device before pressing Enter/Return."
10003+
print "* If you denied the trust dialog, unplug and replug the device."
997410004
pause
997510005
log "Attempting idevicepair"
997610006
fi
997710007
"$dir/idevicepair" pair
9978-
if [[ $? != 0 ]]; then
10008+
if [[ $? == 0 ]]; then
10009+
device_paired_info
10010+
else
997910011
warn "Unable to pair with device..?"
998010012
fi
998110013
}

0 commit comments

Comments
 (0)