mirror of
https://github.com/MiyooCFW/buildroot.git
synced 2025-09-27 22:24:19 +03:00
BOARD: Add IPK package manager after firstboot (#133)
* BOARD: Add IPK package manager after firstboot * Use lazy loading package description
This commit is contained in:
105
board/miyoo/boot/firstboot
Executable file → Normal file
105
board/miyoo/boot/firstboot
Executable file → Normal file
@@ -1,6 +1,7 @@
|
||||
#!/bin/busybox sh
|
||||
|
||||
MOUNTDIR=/boot
|
||||
export TERM=linux
|
||||
|
||||
# expect to be run from /boot, where the boot partition is mounted (readonly)
|
||||
export LOG=$(mktemp)
|
||||
#LOG=/dev/null
|
||||
@@ -35,7 +36,7 @@ entirely at your own risk. We shall not be held \
|
||||
responsible for any damages, losses, or adverse \
|
||||
consequences arising from the use or misuse of this software.
|
||||
\n\n
|
||||
\ZuDo you acknowledge and agree to these terms?\Zn
|
||||
\Z5Do you acknowledge and agree to these terms?\Zn
|
||||
\n\n
|
||||
Select an option & press START"
|
||||
|
||||
@@ -161,8 +162,8 @@ default_console_func(){
|
||||
|
||||
#Test-prompt dialogs fo various scenarios
|
||||
test_image_func(){
|
||||
dialog --defaultno --ok-label NO --cancel-label Inverted --stdout --title " Test Image" \
|
||||
--colors --pause "\n\n \ZuAre your colors Inverted?\Zn\n\nSelect an option & press START" 12 34 10
|
||||
dialog --backtitle "MiyooCFW 2.0" --no-shadow --defaultno --ok-label NO --cancel-label Inverted --stdout --title " Test Image" \
|
||||
--colors --pause "\n\n \Z5Are your colors Inverted?\Zn\n\nSelect an option & press START" 12 34 10
|
||||
|
||||
echo $? > $TEMP
|
||||
## Read the user's last choice from the tmp file
|
||||
@@ -170,7 +171,7 @@ test_image_func(){
|
||||
# "NO" choice for Test_Image msgbox DIALOG_OK exit code
|
||||
## thus we have valid version and simply continue
|
||||
if test $CHOICE -eq 0; then
|
||||
dialog --timeout 2 --msgbox "Colors are correct, proceed with flashing" 0 0
|
||||
dialog --backtitle "MiyooCFW 2.0" --no-shadow --timeout 2 --msgbox "Colors are correct, proceed with flashing" 0 0
|
||||
# "INVERTED" choice for Test_Iamge msgbox DIALOG_CANCEL exit code and -1/255
|
||||
## thus correct "invert" colors parameter on video driver
|
||||
else
|
||||
@@ -181,8 +182,8 @@ test_image_func(){
|
||||
}
|
||||
|
||||
test_video_func(){
|
||||
dialog --defaultno --ok-label NO --cancel-label "Flipped!" --extra-button --extra-label YES --stdout --title " Test Video" \
|
||||
--colors --pause "\n\n \ZuCan you see this message?\Zn\n\nSelect an option & press START" 12 34 10
|
||||
dialog --backtitle "MiyooCFW 2.0" --no-shadow --defaultno --ok-label NO --cancel-label "Flipped!" --extra-button --extra-label YES --stdout --title " Test Video" \
|
||||
--colors --pause "\n\n \Z5Can you see this message?\Zn\n\nSelect an option & press START" 12 34 10
|
||||
|
||||
echo $? > $TEMP
|
||||
## Read the user's first choice from the tmp file
|
||||
@@ -203,14 +204,14 @@ test_video_func(){
|
||||
safe_reboot_func
|
||||
# Error (DIALOG_ERROR) or ESCAPE button pressed (DIALOG_ESCAPE) thus exit code -1/255
|
||||
else
|
||||
dialog --timeout 2 --msgbox "Invalid choice, please redo the test!" 0 0
|
||||
dialog --backtitle "MiyooCFW 2.0" --no-shadow --timeout 2 --msgbox "Invalid choice, please redo the test!" 0 0
|
||||
sleep 1.5
|
||||
fi
|
||||
}
|
||||
|
||||
test_video2_func(){
|
||||
dialog --defaultno --ok-label NO --cancel-label YES --stdout --title " Test Video'2" \
|
||||
--colors --pause "\n\n \ZuCan you see this message?\Zn\n\nSelect an option & press START" 12 34 10
|
||||
dialog --backtitle "MiyooCFW 2.0" --no-shadow --defaultno --ok-label NO --cancel-label YES --stdout --title " Test Video'2" \
|
||||
--colors --pause "\n\n \Z5Can you see this message?\Zn\n\nSelect an option & press START" 12 34 10
|
||||
|
||||
echo $? > $TEMP
|
||||
## Read the user's last choice from the tmp file
|
||||
@@ -228,8 +229,8 @@ test_video2_func(){
|
||||
}
|
||||
|
||||
test_keyboard_func(){
|
||||
dialog --ok-label NO --cancel-label YES --stdout --title " Test Keyboard" \
|
||||
--colors --pause "\n\n \ZuDoes D-pad works correctly?\Zn\n\nSelect an option & press START" 12 34 10
|
||||
dialog --backtitle "MiyooCFW 2.0" --no-shadow --ok-label NO --cancel-label YES --stdout --title " Test Keyboard" \
|
||||
--colors --pause "\n\n \Z5Does D-pad works correctly?\Zn\n\nSelect an option & press START" 12 34 10
|
||||
|
||||
echo $? > $TEMP
|
||||
## Read the user's last choice from the tmp file
|
||||
@@ -265,13 +266,13 @@ test_keyboard_func(){
|
||||
safe_reboot_func
|
||||
# Error (DIALOG_ERROR) or ESCAPE button pressed (DIALOG_ESCAPE) thus exit code -1/255
|
||||
else
|
||||
dialog --timeout 2 --msgbox "Invalid choice, please redo the test!" 0 0
|
||||
dialog --backtitle "MiyooCFW 2.0" --no-shadow --timeout 2 --msgbox "Invalid choice, please redo the test!" 0 0
|
||||
sleep 1.5
|
||||
fi
|
||||
}
|
||||
|
||||
test_variant_func(){
|
||||
dialog --defaultno --ok-label NO --cancel-label YES --stdout --title " Test Variant" \
|
||||
dialog --backtitle "MiyooCFW 2.0" --no-shadow --defaultno --ok-label NO --cancel-label YES --stdout --title " Test Variant" \
|
||||
--colors --pause "Does this device match yours?" 0 0 15
|
||||
|
||||
echo $? > $TEMP
|
||||
@@ -286,16 +287,16 @@ test_variant_func(){
|
||||
}
|
||||
|
||||
test_flip_func(){
|
||||
if (dialog --stdout --ok-label YES --cancel-label NO --title "Test Flip" --pause " \n Flipped? \n\nAre you sure?!" 12 15 10); then
|
||||
if (dialog --backtitle "MiyooCFW 2.0" --no-shadow --stdout --ok-label YES --cancel-label NO --title "Test Flip" --pause " \n Flipped? \n\nAre you sure?!" 12 15 10); then
|
||||
# Correct variant for bittboy3.5 (non forced) and display info about flipped image
|
||||
echo "CONSOLE_VARIANT=bittboy3" > ${MOUNTDIR}/console.cfg
|
||||
dialog --timeout 2 --msgbox "Image flipped! correct&reboot" 0 0
|
||||
dialog --backtitle "MiyooCFW 2.0" --no-shadow --timeout 2 --msgbox "Image flipped! correct&reboot" 0 0
|
||||
sleep 1.5
|
||||
#TODO: use special Unicode characters to draw text upside-down e.g.:
|
||||
## dialog --timeout 2 --msgbox "ƃuᴉʇooqǝɹ⅋uᴉʇɔǝɹɹoɔ 'pǝddᴉןɟ ǝƃɐɯᴉ \n\n image flipped, correcting&rebooting" 0 0
|
||||
## dialog --backtitle "MiyooCFW 2.0" --no-shadow --timeout 2 --msgbox "ƃuᴉʇooqǝɹ⅋uᴉʇɔǝɹɹoɔ 'pǝddᴉןɟ ǝƃɐɯᴉ \n\n image flipped, correcting&rebooting" 0 0
|
||||
safe_reboot_func
|
||||
else
|
||||
dialog --timeout 2 --msgbox "Invalid choice, please redo the test!" 0 0
|
||||
dialog --backtitle "MiyooCFW 2.0" --no-shadow --timeout 2 --msgbox "Invalid choice, please redo the test!" 0 0
|
||||
sleep 1.5
|
||||
fi
|
||||
}
|
||||
@@ -310,7 +311,7 @@ fi
|
||||
detect_console_func
|
||||
if ! $FOUND_CONSOLE && ! $FOUND_CONSOLE_AUTO && $CONSOLE_DETECTED; then
|
||||
if (grep -q "$DETECTED_1" "${MOUNTDIR}/uEnv.txt"); then
|
||||
dialog --timeout 3 --msgbox "Auto-Detected $DETECTED_1" 0 0
|
||||
dialog --backtitle "MiyooCFW 2.0" --no-shadow --timeout 3 --msgbox "Auto-Detected $DETECTED_1" 0 0
|
||||
# Test_Video-prompt if proper miyoo video's version driver was loaded:
|
||||
## Loop Test_Video until correct selection has been performed (CHOICE=0/3)
|
||||
### former CHOICE=1 meant safe_reboot if correct and shouldn't reach to this point
|
||||
@@ -321,10 +322,10 @@ if ! $FOUND_CONSOLE && ! $FOUND_CONSOLE_AUTO && $CONSOLE_DETECTED; then
|
||||
fi
|
||||
done
|
||||
elif (grep -q "$DETECTED_2" "${MOUNTDIR}/uEnv.txt"); then
|
||||
dialog --timeout 3 --msgbox "Auto-Detected $DETECTED_2" 0 0
|
||||
dialog --backtitle "MiyooCFW 2.0" --no-shadow --timeout 3 --msgbox "Auto-Detected $DETECTED_2" 0 0
|
||||
echo "CONSOLE_VARIANT=m3" > ${MOUNTDIR}/console.cfg
|
||||
elif (grep -q "$DETECTED_3" "${MOUNTDIR}/uEnv.txt"); then
|
||||
dialog --timeout 3 --msgbox "Auto-Detected $DETECTED_3" 0 0
|
||||
dialog --backtitle "MiyooCFW 2.0" --no-shadow --timeout 3 --msgbox "Auto-Detected $DETECTED_3" 0 0
|
||||
echo "CONSOLE_VARIANT=m3_r61520" > ${MOUNTDIR}/console.cfg
|
||||
# Test_Image-prompt if proper "invert" colors parameter was loaded:
|
||||
INVERSION=0 #applied only if colors are inverted
|
||||
@@ -333,19 +334,19 @@ if ! $FOUND_CONSOLE && ! $FOUND_CONSOLE_AUTO && $CONSOLE_DETECTED; then
|
||||
## DETECTED_4 - bittboy
|
||||
## DETECTED_5 - bittboy3/2
|
||||
elif (grep -q "$DETECTED_6" "${MOUNTDIR}/uEnv.txt"); then
|
||||
dialog --timeout 3 --msgbox "Auto-Detected $DETECTED_6" 0 0
|
||||
dialog --backtitle "MiyooCFW 2.0" --no-shadow --timeout 3 --msgbox "Auto-Detected $DETECTED_6" 0 0
|
||||
echo "CONSOLE_VARIANT=m3_rm68090" > ${MOUNTDIR}/console.cfg
|
||||
elif (grep -q "$DETECTED_7" "${MOUNTDIR}/uEnv.txt"); then
|
||||
dialog --timeout 3 --msgbox "Auto-Detected $DETECTED_7" 0 0
|
||||
dialog --backtitle "MiyooCFW 2.0" --no-shadow --timeout 3 --msgbox "Auto-Detected $DETECTED_7" 0 0
|
||||
#echo "CONSOLE_VARIANT=r61520" > ${MOUNTDIR}/console.cfg
|
||||
elif (grep -q "$DETECTED_8" "${MOUNTDIR}/uEnv.txt"); then
|
||||
dialog --timeout 3 --msgbox "Auto-Detected $DETECTED_8" 0 0
|
||||
dialog --backtitle "MiyooCFW 2.0" --no-shadow --timeout 3 --msgbox "Auto-Detected $DETECTED_8" 0 0
|
||||
#echo "CONSOLE_VARIANT=r61505w" > ${MOUNTDIR}/console.cfg
|
||||
elif (grep -q "$DETECTED_9" "${MOUNTDIR}/uEnv.txt"); then
|
||||
dialog --timeout 3 --msgbox "Auto-Detected $DETECTED_9" 0 0
|
||||
dialog --backtitle "MiyooCFW 2.0" --no-shadow --timeout 3 --msgbox "Auto-Detected $DETECTED_9" 0 0
|
||||
echo "CONSOLE_VARIANT=m3_hx8347d" > ${MOUNTDIR}/console.cfg
|
||||
elif (grep -q "$DETECTED_10" "${MOUNTDIR}/uEnv.txt"); then
|
||||
dialog --timeout 3 --msgbox "Auto-Detected $DETECTED_10" 0 0
|
||||
dialog --backtitle "MiyooCFW 2.0" --no-shadow --timeout 3 --msgbox "Auto-Detected $DETECTED_10" 0 0
|
||||
#echo "CONSOLE_VARIANT=unknown-error" > ${MOUNTDIR}/console.cfg
|
||||
fi
|
||||
# Overwrite CONSOLE_VARIANT from new entry
|
||||
@@ -361,7 +362,7 @@ detect_console_func
|
||||
if ! $FOUND_CONSOLE && $FOUND_CONSOLE_AUTO && $CONSOLE_DETECTED; then
|
||||
# show selection menu for ST7789S devices
|
||||
if (test "$CONSOLE_VARIANT" == "st7789s" && grep -q "$DETECTED_1" "${MOUNTDIR}/uEnv.txt"); then
|
||||
dialog --clear --timeout 60 --title "Select your device:" --menu " " 15 40 5 \
|
||||
dialog --backtitle "MiyooCFW 2.0" --no-shadow --clear --timeout 60 --title "Select your device:" --menu " " 15 40 5 \
|
||||
1 "Powkiddy Q20" \
|
||||
2 "Powkiddy Q90" \
|
||||
3 "Powkiddy V90" \
|
||||
@@ -394,16 +395,16 @@ if ! $FOUND_CONSOLE && $FOUND_CONSOLE_AUTO && $CONSOLE_DETECTED; then
|
||||
cp ${MOUNTDIR}/suniv-f1c100s-miyoo-4bit.dtb ${MOUNTDIR}/suniv-f1c100s-miyoo.dtb
|
||||
;;
|
||||
*)
|
||||
dialog --timeout 4 --msgbox "Invalid choice. Exiting and selecting default device from autodetection." 0 0
|
||||
dialog --backtitle "MiyooCFW 2.0" --no-shadow --timeout 4 --msgbox "Invalid choice. Exiting and selecting default device from autodetection." 0 0
|
||||
default_console_func
|
||||
sleep 0.1
|
||||
;;
|
||||
esac
|
||||
elif (((test "$CONSOLE_VARIANT" == "bittboy2" || test "$CONSOLE_VARIANT" == "bittboy3") && grep -q "$DETECTED_5" "${MOUNTDIR}/uEnv.txt") || ((test "$CONSOLE_VARIANT" == "xyc" || test "$CONSOLE_VARIANT" == "m3") && grep -q "$DETECTED_2" "${MOUNTDIR}/uEnv.txt")); then
|
||||
if (grep -q "$DETECTED_5" "${MOUNTDIR}/uEnv.txt"); then
|
||||
dialog --timeout 3 --msgbox "Auto-Detected $DETECTED_5" 0 0
|
||||
dialog --backtitle "MiyooCFW 2.0" --no-shadow --timeout 3 --msgbox "Auto-Detected $DETECTED_5" 0 0
|
||||
elif (grep -q "$DETECTED_2" "${MOUNTDIR}/uEnv.txt"); then
|
||||
dialog --timeout 4 --msgbox "Correcting $DETECTED_2 - wait for further instructions" 0 0
|
||||
dialog --backtitle "MiyooCFW 2.0" --no-shadow --timeout 4 --msgbox "Correcting $DETECTED_2 - wait for further instructions" 0 0
|
||||
fi
|
||||
# Test_Keyboard-prompt if proper miyoo.kbd version was loaded:
|
||||
## Loop Test_Keyboard until correct selection has been performed (CHOICE=0/1)
|
||||
@@ -414,7 +415,7 @@ if ! $FOUND_CONSOLE && $FOUND_CONSOLE_AUTO && $CONSOLE_DETECTED; then
|
||||
fi
|
||||
done
|
||||
elif (test "$CONSOLE_VARIANT" == "bittboy" && grep -q "$DETECTED_4" "${MOUNTDIR}/uEnv.txt") ; then
|
||||
dialog --timeout 3 --msgbox "Auto-Detected $DETECTED_4" 0 0
|
||||
dialog --backtitle "MiyooCFW 2.0" --no-shadow --timeout 3 --msgbox "Auto-Detected $DETECTED_4" 0 0
|
||||
# Test_Video'2-prompt if proper miyoo video's version driver was loaded:
|
||||
test_video2_func
|
||||
fi
|
||||
@@ -428,69 +429,69 @@ if $FOUND_CONSOLE; then
|
||||
# Info_Box about selected/edited device in console.cfg
|
||||
case $CONSOLE_VARIANT in
|
||||
bittboy2x_v1)
|
||||
dialog --colors --timeout 2 --ok-label " Your device " --msgbox " BittBoy2x v1" 5 18
|
||||
dialog --backtitle "MiyooCFW 2.0" --no-shadow --colors --timeout 2 --ok-label " Your device " --msgbox " BittBoy2x v1" 5 18
|
||||
BITTBOY_CONFIG=true
|
||||
;;
|
||||
bittboy2x_v2)
|
||||
dialog --colors --timeout 2 --ok-label " Your device " --msgbox " BittBoy2x v2" 5 18
|
||||
dialog --backtitle "MiyooCFW 2.0" --no-shadow --colors --timeout 2 --ok-label " Your device " --msgbox " BittBoy2x v2" 5 18
|
||||
BITTBOY_CONFIG=true
|
||||
;;
|
||||
bittboy3.5)
|
||||
dialog --colors --timeout 2 --ok-label " Your device " --msgbox " BittBoy3.5" 5 18
|
||||
dialog --backtitle "MiyooCFW 2.0" --no-shadow --colors --timeout 2 --ok-label " Your device " --msgbox " BittBoy3.5" 5 18
|
||||
BITTBOY_CONFIG=true
|
||||
;;
|
||||
q20)
|
||||
dialog --colors --timeout 2 --ok-label " Your device " --msgbox " Powkiddy Q20" 5 18
|
||||
dialog --backtitle "MiyooCFW 2.0" --no-shadow --colors --timeout 2 --ok-label " Your device " --msgbox " Powkiddy Q20" 5 18
|
||||
MIYOO_CONFIG=true
|
||||
;;
|
||||
q90)
|
||||
dialog --colors --timeout 2 --ok-label " Your device " --msgbox " Powkiddy Q90" 5 18
|
||||
dialog --backtitle "MiyooCFW 2.0" --no-shadow --colors --timeout 2 --ok-label " Your device " --msgbox " Powkiddy Q90" 5 18
|
||||
MIYOO_CONFIG=true
|
||||
;;
|
||||
v90)
|
||||
dialog --colors --timeout 2 --ok-label " Your device " --msgbox " Powkiddy V90" 5 18
|
||||
dialog --backtitle "MiyooCFW 2.0" --no-shadow --colors --timeout 2 --ok-label " Your device " --msgbox " Powkiddy V90" 5 18
|
||||
MIYOO_CONFIG=true
|
||||
;;
|
||||
pocketgo)
|
||||
dialog --colors --timeout 2 --ok-label " Your device " --msgbox " PocketGo" 5 18
|
||||
dialog --backtitle "MiyooCFW 2.0" --no-shadow --colors --timeout 2 --ok-label " Your device " --msgbox " PocketGo" 5 18
|
||||
MIYOO_CONFIG=true
|
||||
;;
|
||||
pocketgo_TE)
|
||||
dialog --colors --timeout 2 --ok-label " Your device " --msgbox " PocketGo+TE" 5 18
|
||||
dialog --backtitle "MiyooCFW 2.0" --no-shadow --colors --timeout 2 --ok-label " Your device " --msgbox " PocketGo+TE" 5 18
|
||||
MIYOO_CONFIG=true
|
||||
;;
|
||||
xyc_gc9306)
|
||||
dialog --colors --timeout 2 --ok-label " Your device " --msgbox " XYC Q8" 5 18
|
||||
dialog --backtitle "MiyooCFW 2.0" --no-shadow --colors --timeout 2 --ok-label " Your device " --msgbox " XYC Q8" 5 18
|
||||
MIYOO_CONFIG=true
|
||||
;;
|
||||
m3_r61520)
|
||||
dialog --colors --timeout 2 --ok-label " Your device " --msgbox " SUP M3\n (controller of r61520fb)" 6 29
|
||||
dialog --backtitle "MiyooCFW 2.0" --no-shadow --colors --timeout 2 --ok-label " Your device " --msgbox " SUP M3\n (controller of r61520fb)" 6 29
|
||||
MIYOO_CONFIG=true
|
||||
;;
|
||||
m3_rm68090)
|
||||
dialog --colors --timeout 2 --ok-label " Your device " --msgbox " SUP M3\n(RM68090 controller)" 6 24
|
||||
dialog --backtitle "MiyooCFW 2.0" --no-shadow --colors --timeout 2 --ok-label " Your device " --msgbox " SUP M3\n(RM68090 controller)" 6 24
|
||||
MIYOO_CONFIG=true
|
||||
;;
|
||||
m3_hx8347d)
|
||||
dialog --colors --timeout 2 --ok-label " Your device " --msgbox " SUP M3\n(HX8347D controller)" 6 24
|
||||
dialog --backtitle "MiyooCFW 2.0" --no-shadow --colors --timeout 2 --ok-label " Your device " --msgbox " SUP M3\n(HX8347D controller)" 6 24
|
||||
MIYOO_CONFIG=true
|
||||
;;
|
||||
m3_gc9306)
|
||||
dialog --colors --timeout 2 --ok-label " Your device " --msgbox " SUP M3\n(GC9306 controller)" 6 24
|
||||
dialog --backtitle "MiyooCFW 2.0" --no-shadow --colors --timeout 2 --ok-label " Your device " --msgbox " SUP M3\n(GC9306 controller)" 6 24
|
||||
MIYOO_CONFIG=true
|
||||
;;
|
||||
*)
|
||||
dialog --colors --timeout 2 --ok-label " Your device " --msgbox "\Zb\Z1 Unknown-Error\Zn" 5 18
|
||||
dialog --backtitle "MiyooCFW 2.0" --no-shadow --colors --timeout 2 --ok-label " Your device " --msgbox "\Zb\Z1 Unknown-Error\Zn" 5 18
|
||||
esac
|
||||
# Test_Variant-prompt if correct CONSOLE_VARIANT has been written to console.cfg
|
||||
test_variant_func
|
||||
else
|
||||
dialog --colors --timeout 2 --ok-label " Your device " --msgbox "\Zb\Z1 Unknown\Zn" 5 18
|
||||
dialog --backtitle "MiyooCFW 2.0" --no-shadow --colors --timeout 2 --ok-label " Your device " --msgbox "\Zb\Z1 Unknown\Zn" 5 18
|
||||
console_unknown_func
|
||||
fi
|
||||
|
||||
# License_agreement-prompt
|
||||
if (dialog --clear --ok-label NO --cancel-label YES --stdout --title " License agreement" \
|
||||
if (dialog --backtitle "MiyooCFW 2.0" --no-shadow --clear --ok-label NO --cancel-label YES --stdout --title " License agreement" \
|
||||
--colors --pause "\n \ZbMiyooCFW\Zn\n$LICENSE" 22 60 30 || test $? -eq 255); then
|
||||
echo -en " We understand. Have a nice day!\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"
|
||||
sleep 1
|
||||
@@ -526,8 +527,8 @@ SD_MAX_AVAIL_SIZE_IN_KiB=$((SD_MAX_AVAIL_SIZE * 512 / 1024))
|
||||
|
||||
# Expand_MAIN_Partition-prompt for fatresize the p4 partition if requested
|
||||
RESIZE_COMMENCED=false
|
||||
if (dialog --clear --stdout --ok-label YES --cancel-label NO --title " AUTO-RESIZE" \
|
||||
--colors --pause "\n\n \ZuExpand MAIN partition?\Zn\n\n Select an option & press START
|
||||
if (dialog --backtitle "MiyooCFW 2.0" --no-shadow --clear --stdout --ok-label YES --cancel-label NO --title " AUTO-RESIZE" \
|
||||
--colors --pause "\n\n \Z5Expand MAIN partition?\Zn\n\n Select an option & press START
|
||||
\n\n \ZbWARNING:\Zn\n After 10s auto-resize\n of BTRFS partition will begin." 15 60 10); then
|
||||
clear
|
||||
SD_MAX_AVAIL_SIZE_IN_GiB=$(echo "scale=1; ${SD_MAX_AVAIL_SIZE_IN_KiB} / 1024 / 1024" | bc) #only to inform user about end point for resize
|
||||
@@ -579,6 +580,12 @@ echo "firstboot script finished." | tee -a ${LOG}
|
||||
touch ${HOME}/firstboot.completed
|
||||
echo
|
||||
|
||||
#install IPK packages
|
||||
if ( $RESIZE_COMMENCED ); then
|
||||
echo "starting ipk install manager..." | tee -a ${LOG}
|
||||
${BASEDIR}/ipk_install.sh | tee -a ${LOG}
|
||||
fi
|
||||
|
||||
# Reboot device if CONSOLE_VARIANT was overwritten from $CHOICE so that it could be applied in u-boot by readID
|
||||
## or resizing BTRFS partition has completed / found firstboot custom script
|
||||
if ($CONSOLE_OVERWRITE || $RESIZE_COMMENCED || test -r "${BASEDIR}/firstboot.custom.sh"); then
|
||||
|
||||
80
board/miyoo/boot/ipk_install.sh
Executable file
80
board/miyoo/boot/ipk_install.sh
Executable file
@@ -0,0 +1,80 @@
|
||||
#!/bin/bash
|
||||
|
||||
export TERM=linux
|
||||
WARN="
|
||||
MiyooCFW team is not responsible for any issues \
|
||||
arising from the use of third-party applications \
|
||||
with current software. Support, bug fixes, or \
|
||||
improvements for 3rd-party apps are not provided \
|
||||
by our team members unless explicitly stated otherwise \
|
||||
(contact Maintainer of the app).
|
||||
\n\n
|
||||
\Z5 Do you still wish to CONTINUE with install?\Zn
|
||||
\n\n
|
||||
Select an option & press START"
|
||||
ipk_directory="/mnt/pkgs"
|
||||
package_list=()
|
||||
help_messages=()
|
||||
index=1
|
||||
for ipk_file in "$ipk_directory"/*.ipk; do
|
||||
if [[ -f "$ipk_file" ]]; then
|
||||
ipk_name=$(basename -s .ipk "$ipk_file")
|
||||
package_list+=("$index" "$ipk_name" "off")
|
||||
help_messages[$((2 * index))]="$index"
|
||||
help_messages[$((2 * index + 1))]="$ipk_file"
|
||||
((index++))
|
||||
fi
|
||||
done
|
||||
if [[ ${#package_list[@]} -eq 0 ]]; then
|
||||
echo "No packages to install."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
dialog --backtitle "MiyooCFW 2.0" --timeout 10 --title "IPK package manager" --colors --no-shadow --msgbox "\nSelect pkg with \Zb\Z3Y\Zn button on the list." 8 28
|
||||
until selected_packages=$(dialog --backtitle "MiyooCFW 2.0" --title "IPK package manager" --colors --no-shadow --help-button --help-status --checklist "Press \Zb\Z3Y\Zn to select packages to install:" 20 60 15 "${package_list[@]}" 3>&1 1>&2 2>&3); do
|
||||
case $? in
|
||||
(1) btn=Cancel && break;;
|
||||
(2)
|
||||
set -- $selected_packages
|
||||
shift
|
||||
index=$1
|
||||
package_info=$(opkg info "${help_messages[$((2 * index + 1))]}")
|
||||
package_name=$(echo "$package_info" | grep "^Package:" | cut -d' ' -f2)
|
||||
package_description=$(echo "$package_info" | grep "^Description:" | cut -d' ' -f2-)
|
||||
package_version=$(echo "$package_info" | grep "^Version:" | cut -d' ' -f2-)
|
||||
package_source=$(echo "$package_info" | grep "^Source:" | cut -d' ' -f2-)
|
||||
package_maintainer=$(echo "$package_info" | grep "^Maintainer:" | cut -d' ' -f2-)
|
||||
dialog --backtitle "MiyooCFW 2.0" --no-shadow --msgbox "$package_name\n\n$package_description\n\nVersion: $package_version\nMaintainer: $package_maintainer\nSource: $package_source" 0 0
|
||||
for ((i = 2; i < ${#package_list[@]}; i += 3)); do
|
||||
package_list[$i]="off"
|
||||
done
|
||||
shift
|
||||
for selected in "$@"; do
|
||||
package_list[$((3 * selected - 1))]="on"
|
||||
done
|
||||
esac
|
||||
done
|
||||
|
||||
clear
|
||||
if [[ $? -ne 0 || -z "$selected_packages" ]]; then
|
||||
echo "No packages were selected."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if (dialog --backtitle "MiyooCFW 2.0" --no-shadow --clear --stdout --title "WARNING" \
|
||||
--colors --pause "\n \ZbMiyooCFW\Zn\n$WARN" 22 60 30 || test $? -eq 255); then
|
||||
clear
|
||||
for package in $selected_packages; do
|
||||
ipk_package="${help_messages[$((2 * package + 1))]}"
|
||||
echo "Installing $ipk_package..."
|
||||
if opkg install "$ipk_package" 2>/dev/null; then
|
||||
echo "$ipk_package installed successfully."
|
||||
else
|
||||
echo "Failed to install $ipk_package."
|
||||
fi
|
||||
done
|
||||
echo "Installation complete."
|
||||
else
|
||||
clear
|
||||
echo "Installation complete."
|
||||
fi
|
||||
Reference in New Issue
Block a user