Created
January 18, 2025 18:07
-
-
Save ksatirli/57a1552b03b345b97ba9b361aabdfdb7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# 定义要显示的文本 | |
GREEN='\033[0;32m' | |
NC='\033[0m' # | |
text="🌿 Seeed Studio reComputer Flashing System Bate! " | |
text1="Tip: This version is a test version. If any issues occur during the flashing process, you can troubleshoot based on the error messages. If the issue persists, please refer to the Seeed Studio Wiki for Flash system instructions." | |
DIR="./flash_scripts/package" | |
# Check if the directory exists, if not, create it | |
if [ ! -d "$DIR" ]; then | |
mkdir -p "$DIR" | |
echo "Directory $DIR created." | |
else | |
echo "Directory $DIR already exists." | |
fi | |
while true; do | |
# 清屏 | |
clear | |
# 上方装饰图案 | |
echo -e "${GREEN}╔════════════════════════════════════════════════════════════════════════╗" | |
echo "║ ║" | |
echo "║ ✨🌿✨🌿✨🌿✨🌿 Welcome to Seeed Studio 🌿✨🌿✨🌿✨🌿✨ ║" | |
echo "║ ║" | |
echo "╚════════════════════════════════════════════════════════════════════════╝ " | |
echo -e "${NC}" | |
# 循环逐个显示字符 | |
for ((i=0; i<${#text}; i++)); do | |
# 输出当前字符并保持光标在同一行 | |
echo -n "${text:$i:1}" | |
# 延时以达到逐步显示的效果 | |
sleep 0.02 | |
done | |
echo \ | |
# 循环逐个显示字符 | |
for ((i=0; i<${#text1}; i++)); do | |
# 输出当前字符并保持光标在同一行,正确引用颜色变量 | |
echo -ne "${GREEN}${text1:$i:1}${NC}" | |
# 延时以达到逐步显示的效果 | |
sleep 0.005 | |
done | |
# 输出换行符以美化显示 | |
echo | |
# 用户设备选择提示 | |
echo "Please select the device you want to flash:" | |
echo "1. reComputer J30x/J40x" | |
echo "2. reComputer J30x/J40x Mini" | |
echo "3. reComputer J50x (developing)" | |
echo "4. reComputer Industrial J30x (developing)" | |
echo "5. reComputer Industrial J40x (developing)" | |
echo "6. reServer Industrial J30x (developing)" | |
echo "7. reServer Industrial J40x (developing) " | |
echo "0. exit" | |
# 读取用户输入 | |
read -r -p "Enter the number of your choice (1-7): " choice | |
# 根据用户输入的设备执行相应操作 | |
case $choice in | |
1) | |
echo "You selected reComputer J30x/J40x." | |
jetpack_versions=("JetPack 5.1.1" "JetPack 5.1.2" "JetPack 6.0") | |
;; | |
2) | |
echo "You selected reComputer J30x/J40x Mini." | |
jetpack_versions=("JetPack 6.0") | |
;; | |
3) | |
echo "You selected reComputer J50x." | |
jetpack_versions=("JetPack 5.1.1" "JetPack 5.1.2" "JetPack 6.0") | |
;; | |
4) | |
echo "You selected reComputer Industrial J30x." | |
jetpack_versions=("JetPack 5.1.1" "JetPack 6.0") | |
;; | |
5) | |
echo "You selected reComputer Industrial J40x." | |
jetpack_versions=("JetPack 5.1.1" "JetPack 6.0") | |
;; | |
6) | |
echo "You selected reServer Industrial J30x." | |
jetpack_versions=("JetPack 5.1.1" "JetPack 6.0") | |
;; | |
7) | |
echo "You selected reServer Industrial J40x." | |
jetpack_versions=("JetPack 5.1.1" "JetPack 6.0") | |
;; | |
0) | |
exit;; | |
*) | |
echo "Invalid choice, please select a valid number (1-7)." | |
read -r -p "Press any key to return to the main menu... " -n1 -s | |
continue | |
;; | |
esac | |
while true; do | |
# 清屏 | |
clear | |
# 提示选择 JetPack 版本 | |
echo "Please select the JetPack version you want to flash for your selected device:" | |
for i in "${!jetpack_versions[@]}"; do | |
echo "$((i+1)). ${jetpack_versions[i]}" | |
done | |
echo "$(( ${#jetpack_versions[@]} + 1 )). Return to device selection" | |
read -r -p "Enter the number of your choice (1-$(( ${#jetpack_versions[@]} + 1 ))): " jetpack_version | |
if [[ $jetpack_version -ge 1 && $jetpack_version -le ${#jetpack_versions[@]} ]]; then | |
echo "You selected ${jetpack_versions[$((jetpack_version-1))]}" | |
break | |
elif [[ $jetpack_version -eq $(( ${#jetpack_versions[@]} + 1 )) ]]; then | |
clear | |
continue 2 | |
else | |
echo "Invalid choice for JetPack version. Please select a valid number (1-$(( ${#jetpack_versions[@]} + 1 )))." | |
read -r -p "Press any key to return to the JetPack selection... " -n1 -s | |
continue | |
fi | |
done | |
break | |
done | |
clear | |
echo "╔════════════════════════════════════════════════════════════════════════╗" | |
echo "║ 🌟🌟🌟 Please put the device into recovery mode. 🌟🌟🌟 ║" | |
echo "║ 🌟🌟🌟 Then power on the device. 🌟🌟🌟 ║" | |
echo "║ 🌟🌟🌟 Connect the device to the computer using a data cable.🌟🌟🌟 ║" | |
echo "╚════════════════════════════════════════════════════════════════════════╝" | |
# 提示用户操作完成后继续 | |
read -r -p "Now please follow the instructions above. Press any key to continue once done... " -n1 -s | |
# 显示用户的选择 | |
clear | |
echo "You have chosen the following options:" | |
echo "Device:" | |
case $choice in | |
1) | |
echo "- reComputer J30x/J40x" | |
;; | |
2) | |
echo "- reComputer J30x/J40x Mini" | |
;; | |
3) | |
echo "- reComputer J50x" | |
;; | |
4) | |
echo "- reComputer Industrial J30x" | |
;; | |
5) | |
echo "- reComputer Industrial J40x" | |
;; | |
6) | |
echo "- reServer Industrial J30x" | |
;; | |
7) | |
echo "- reServer Industrial J40x" | |
;; | |
esac | |
echo "JetPack Version:" | |
echo "- ${jetpack_versions[$((jetpack_version-1))]}" | |
# 根据用户选择的设备和JetPack版本,选择对应的脚本 | |
case $choice in | |
1) | |
case $jetpack_version in | |
1) wget -O ./flash_scripts/flash_reComputer_J3040x_JP_5.1.1.sh https://dlink.host/sharepoint/aHR0cHM6Ly9zZWVlZHN0dWRpbzg4LW15LnNoYXJlcG9pbnQuY29tLzp1Oi9nL3BlcnNvbmFsL3lvdWppYW5nX3l1X3NlZWVkc3R1ZGlvODhfb25taWNyb3NvZnRfY29tL0VYNTNOeEhPN0lWSmxKZFpQajktTTZrQjRLdXJxWTVFT2Vqa1c5ejhFbG54VWc_ZT1Ya1o0YTE.sh | |
chmod +x ./flash_scripts/flash_reComputer_J3040x_JP_5.1.1.sh | |
./flash_scripts/flash_reComputer_J3040x_JP_5.1.1.sh ;; | |
2) wget -O ./flash_scripts/flash_reComputer_J3040x_JP_5.1.2.sh https://dlink.host/sharepoint/aHR0cHM6Ly9zZWVlZHN0dWRpbzg4LW15LnNoYXJlcG9pbnQuY29tLzp1Oi9nL3BlcnNvbmFsL3lvdWppYW5nX3l1X3NlZWVkc3R1ZGlvODhfb25taWNyb3NvZnRfY29tL0VRajRVeEpyd09WT2ttMEkzTXdzNU5VQkNOUEZDOWRnT096V1BpdFU2TnIyWWc_ZT03bGxac0s.sh | |
chmod +x ./flash_scripts/flash_reComputer_J3040x_JP_5.1.2.sh | |
./flash_scripts/flash_reComputer_J3040x_JP_5.1.2.sh ;; | |
3) wget -O ./flash_scripts/flash_reComputer_J3040x_JP_6.0.sh https://dlink.host/sharepoint/aHR0cHM6Ly9zZWVlZHN0dWRpbzg4LW15LnNoYXJlcG9pbnQuY29tLzp1Oi9nL3BlcnNvbmFsL3lvdWppYW5nX3l1X3NlZWVkc3R1ZGlvODhfb25taWNyb3NvZnRfY29tL0VmXzEtQk1vREJKTHR1WXlSQmNWdXRjQk9mNkNQdlVlMkRZUnFxRktzdHJxMFE_ZT0wY2dZMVA.sh | |
chmod +x ./flash_scripts/flash_reComputer_J3040x_JP_6.0.sh | |
./flash_scripts/flash_reComputer_J3040x_JP_6.0.sh ;; | |
esac | |
;; | |
2) | |
case $jetpack_version in | |
1) wget -O ./flash_scripts/flash_reComputer_Mini_J3040x_JP_6.0.sh https://dlink.host/sharepoint/aHR0cHM6Ly9zZWVlZHN0dWRpbzg4LW15LnNoYXJlcG9pbnQuY29tLzp1Oi9nL3BlcnNvbmFsL3lvdWppYW5nX3l1X3NlZWVkc3R1ZGlvODhfb25taWNyb3NvZnRfY29tL0VXWXdUOXlENUcxTnVnc3lrdnZ6OVhVQkxnRlFoZGswdkNSWm45eVVRaG1uN0E_ZT00elRzSzQ.sh | |
chmod +x ./flash_scripts/flash_reComputer_Mini_J3040x_JP_6.0.sh | |
./flash_scripts/flash_reComputer_Mini_J3040x_JP_6.0.sh ;; | |
esac | |
;; | |
3) | |
case $jetpack_version in | |
1) wget -O ./flash_scripts/flash_reComputer_J50x_JP_5.1.1.sh https://dlink.host/sharepoint/aHR0cHM6Ly9zZWVlZHN0dWRpbzg4LW15LnNoYXJlcG9pbnQuY29tLzp1Oi9nL3BlcnNvbmFsL3lvdWppYW5nX3l1X3NlZWVkc3R1ZGlvODhfb25taWNyb3NvZnRfY29tL0VlNGdYN01CVjU1QnFlM01vOHBfOEVRQmtMWDMxdkg5U0hQWUpybkJUS2hZaEE_ZT0wWHhGVk0.sh | |
chmod +x ./flash_scripts/flash_reComputer_J50x_JP_5.1.1.sh | |
./flash_scripts/flash_reComputer_J50x_JP_5.1.1.sh ;; | |
2) wget -O ./flash_scripts/flash_reComputer_J50x_JP_5.1.2.sh https://dlink.host/sharepoint/aHR0cHM6Ly9zZWVlZHN0dWRpbzg4LW15LnNoYXJlcG9pbnQuY29tLzp1Oi9nL3BlcnNvbmFsL3lvdWppYW5nX3l1X3NlZWVkc3R1ZGlvODhfb25taWNyb3NvZnRfY29tL0VVQUlrTzJGLVNwS25IcjMwRFMzdTRNQnZHV3pBbm5IekpJZ1pWZ0FMTzJQeUE_ZT1PRnVUaVU.sh | |
chmod +x ./flash_scripts/flash_reComputer_J50x_JP_5.1.2.sh | |
./flash_scripts/flash_reComputer_J50x_JP_5.1.2.sh ;; | |
3) wget -O ./flash_scripts/flash_reComputer_J50x_JP_6.0.sh https://dlink.host/sharepoint/aHR0cHM6Ly9zZWVlZHN0dWRpbzg4LW15LnNoYXJlcG9pbnQuY29tLzp1Oi9nL3BlcnNvbmFsL3lvdWppYW5nX3l1X3NlZWVkc3R1ZGlvODhfb25taWNyb3NvZnRfY29tL0VTdHhvWVdPYi1aQ3ZlMF95Z2g2SFBFQkJNOGpvSzYtaDdkU3JsdUFSLUMtVlE_ZT1zVjJBdnQ.sh | |
chmod +x ./flash_scripts/flash_reComputer_J50x_JP_6.0.sh | |
./flash_scripts/flash_reComputer_J50x_JP_6.0.sh ;; | |
esac | |
;; | |
4) | |
case $jetpack_version in | |
1) ./flash_scripts/flash_reComputer_Industrial_J30x_JP_5.1.1.sh ;; | |
2) ./flash_scripts/flash_reComputer_Industrial_J30x_JP_6.0.sh ;; | |
esac | |
;; | |
5) | |
case $jetpack_version in | |
1) ./flash_scripts/flash_reComputer_Industrial_J40x_JP_5.1.1.sh ;; | |
2) ./flash_scripts/flash_reComputer_Industrial_J40x_JP_6.0.sh ;; | |
esac | |
;; | |
6) | |
case $jetpack_version in | |
1) ./flash_scripts/flash_reServer_Industrial_J30x_JP_5.1.1.sh ;; | |
2) ./flash_scripts/flash_reServer_Industrial_J30x_JP_6.0.sh ;; | |
esac | |
;; | |
7) | |
case $jetpack_version in | |
1) ./flash_scripts/flash_reServer_Industrial_J40x_JP_5.1.1.sh ;; | |
2) ./flash_scripts/flash_reServer_Industrial_J40x_JP_6.0.sh ;; | |
esac | |
;; | |
esac | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment