Skip to content

Commit 2fe5cd9

Browse files
authored
Dev to Main (#359)
* New DTS file * Delete dtb/n4-n4pro-v1.1/rk3328-roc-cc.dtb * Delete dtb/n4-n4pro-v1.1/n4-n4pro-v1.1-dts.txt * Delete dtb/n4plus-n4max-v1.1-2.0/rk3328-roc-cc.dtb * Delete dtb/n4plus-n4max-v1.1-2.0/n4plus-n4max-v1.1-2.0-dts.txt * Add files via upload * Delete dtb/n4-n4pro-v1.0 directory * Upload new DTS * Remove redundant status 'disabled' entries * Update virtualmcu.config with hardware options Added various configuration options for hardware support. * Update mcu.config with STM32 settings Added various configuration options for STM32 and peripherals. * Enhance webcam setup script with dynamic detection Added dynamic detection for webcam devices and improved startup script creation. * Simplify numpy installation command in script * Comment out accelerometer configuration sections Comment out adxl345 and resonance_tester sections * Comment out ADXL345 and resonance tester configurations Comment out sections related to ADXL345 and resonance testing. * Comment out settings in configuration Comment out accelerometer configuration settings. * Comment out accelerometer and tester settings Comment out configurations for ADXL345 accelerometers and resonance tester. * Refactor base_image_configuration.sh for clarity and updates Updated the script to clarify its purpose and added support for NetworkManager. Enhanced error handling and removed unnecessary sections related to spidev fixes. * Add moonraker.asvc configuration file * Enhance configuration file handling and prompts Updated configuration file handling in OpenNept4une.sh to include moonraker.asvc and improve installation prompts. * Add dev-image-cleanup.sh for Armbian image cleanup This script performs a series of cleanup tasks for Armbian images, including resetting Git repositories, removing personal files, sanitizing network configurations, and cleaning up system caches.
1 parent 3e30f4b commit 2fe5cd9

18 files changed

Lines changed: 810 additions & 3261 deletions

OpenNept4une.sh

Lines changed: 160 additions & 102 deletions
Original file line numberDiff line numberDiff line change
@@ -691,134 +691,192 @@ install_configs() {
691691
printf '%b\n' "${C}${OPENNEPT4UNE_ART}${NC}"
692692
printf '\n'
693693

694+
# Menu label -> space-separated file list
694695
declare -A config_files=(
695696
["All"]=""
696697
["Fluidd web interface Conf"]="data.mdb"
697-
["Moonraker Conf"]="moonraker.conf"
698+
["Moonraker Conf"]="moonraker.conf moonraker.asvc"
698699
["KAMP Conf"]="KAMP_Settings.cfg"
699700
["Mainsail web interface Conf"]="mainsail.cfg"
700701
["Pico USB-C ADXL Conf"]="adxl.cfg"
701702
["Klipper DEBUG Addon"]="klipper_debug.cfg"
702703
)
703704

705+
# ----------------- Helpers -----------------
706+
707+
dest_path_for() {
708+
local f="$1"
709+
case "$f" in
710+
data.mdb) printf '%s\n' "${HOME}/printer_data/database/data.mdb" ;;
711+
moonraker.asvc) printf '%s\n' "${HOME}/printer_data/moonraker.asvc" ;;
712+
*) printf '%s\n' "${HOME}/printer_data/config/${f}" ;;
713+
esac
714+
}
715+
716+
install_one() {
717+
local f="$1"
718+
local src="${HOME}/OpenNept4une/img-config/printer-data/${f}"
719+
local dst; dst="$(dest_path_for "$f")"
720+
721+
if [[ ! -f "$src" ]]; then
722+
printf '%b\n' "${R}Source missing: ${src}${NC}"
723+
return 1
724+
fi
725+
726+
local dstdir; dstdir="$(dirname "$dst")"
727+
mkdir -p "$dstdir"
728+
729+
if [[ "$f" == "data.mdb" ]]; then
730+
mkdir -p "${HOME}/printer_data/config" "${HOME}/printer_data/database"
731+
local tmp="${HOME}/printer_data/config/data.mdb"
732+
cp -f "$src" "$tmp"
733+
mv -f "$tmp" "$dst"
734+
else
735+
cp -f "$src" "$dst"
736+
fi
737+
738+
printf '%s\n' "${G}${f} installed to ${dst}.${NC}"
739+
}
740+
741+
maybe_diff() {
742+
local f="$1"
743+
if [[ "$f" == "data.mdb" ]]; then
744+
printf '%s\n' "${Y}Skipping diff for binary file: ${f}.${NC}"
745+
return 2
746+
fi
747+
748+
local src="${HOME}/OpenNept4une/img-config/printer-data/${f}"
749+
local cur; cur="$(dest_path_for "$f")"
750+
751+
if [[ ! -f "$src" ]]; then
752+
printf '%b\n' "${R}Source missing for diff: ${src}${NC}"
753+
return 1
754+
fi
755+
if [[ ! -f "$cur" ]]; then
756+
printf '%s\n' "${Y}No current file found for ${f}; nothing to diff.${NC}"
757+
return 3
758+
fi
759+
760+
local out
761+
out="$(diff -y --suppress-common-lines --width=90 "$src" "$cur" 2>/dev/null || true)"
762+
if [[ -z "$out" ]]; then
763+
printf '%s\n' "${G}No differences for ${f}; up-to-date.${NC}"
764+
return 4
765+
fi
766+
767+
printf '%b\n' "${C}Differences for ${f}:${NC}"
768+
printf '%s\n' "$out"
769+
return 0
770+
}
771+
772+
# ----------------- Prompt / flow -----------------
773+
704774
local install_configs_var="$auto_yes"
705-
if [ "$auto_yes" != "true" ]; then
775+
if [[ "$auto_yes" != "true" ]]; then
706776
printf '%s\n\n' "The latest configurations include updated settings and features for your printer."
707-
printf '%s\n\n' "${Y}It's recommended to update configurations during initial installs or when resetting to default configurations.${NC}"
777+
printf '%s\n\n' "${Y}Recommended on fresh installs or when resetting to defaults.${NC}"
708778
printf '%b' "${M}Select latest configurations to install?${NC} (y/N): "
709-
read -r choice
779+
local choice; read -r choice
710780
[[ $choice =~ ^[Yy]$ ]] && install_configs_var="true"
711781
fi
712782

713-
if [ "$install_configs_var" = "true" ]; then
714-
PS3="Enter the number of the configuration to install (or 'Exit' to finish): "
715-
options=("All" "Fluidd web interface Conf" "Moonraker Conf" "KAMP Conf" "Mainsail web interface Conf" "Pico USB-C ADXL Conf" "Klipper DEBUG Addon" "Exit")
716-
717-
while true; do
718-
clear_screen
719-
printf '%b\n' "${C}${OPENNEPT4UNE_ART}${NC}"
720-
printf '\n%s\n' "Select configurations to install:"
721-
for i in "${!options[@]}"; do
722-
printf '%2d) %s\n' $((i+1)) "${options[$i]}"
723-
done
724-
725-
read -rp "$PS3" opt
726-
case $opt in
727-
1)
728-
printf '%s\n' "Installing all configurations..."
729-
for file in "${config_files[@]}"; do
730-
if [[ -n $file ]]; then
731-
cp "${HOME}/OpenNept4une/img-config/printer-data/$file" "${HOME}/printer_data/config/"
732-
if [[ $file == "data.mdb" ]]; then
733-
mv "${HOME}/printer_data/config/data.mdb" "${HOME}/printer_data/database/data.mdb"
734-
fi
735-
printf '%s\n' "${G}${file} installed successfully.${NC}"
736-
fi
737-
done
738-
printf '\n%s\n' "${G}All configurations installed successfully.${NC}"
739-
sleep 2
740-
return 0
741-
;;
742-
2|3|4|5|6|7)
743-
local opt_name="${options[$((opt-1))]}"
744-
printf '%s\n' "Installing ${opt_name}..."
745-
local file="${config_files[$opt_name]}"
746-
747-
printf '\n%s\n\n' "${G}Would you like to compare/diff your current ${opt_name} with the latest? (y/n).${NC}"
748-
read -r -p "$(printf '%b' "${M}Enter your choice ${NC}: ")" DIFF_CHOICE
749-
750-
if [[ "$DIFF_CHOICE" =~ ^[Yy]$ ]]; then
751-
clear_screen
752-
printf '\n'
753-
SPACES=$(printf '%*s' 32 '')
754-
printf '%b%s%b%s\n' "${C}" "Updated File:" "${NC}" "${SPACES}Current File:"
755-
printf '%b\n' "${C}==========================================================${NC}"
783+
if [[ "$install_configs_var" != "true" ]]; then
784+
printf '%b\n' "${Y}Installation of latest configurations skipped.${NC}"
785+
sleep 1
786+
return 0
787+
fi
756788

757-
if [[ $file == "data.mdb" ]]; then
758-
DIFF_OUTPUT=$(diff -y --suppress-common-lines --width=58 \
759-
"${HOME}/OpenNept4une/img-config/printer-data/$file" \
760-
"${HOME}/printer_data/database/$file" 2>/dev/null)
761-
else
762-
DIFF_OUTPUT=$(diff -y --suppress-common-lines --width=58 \
763-
"${HOME}/OpenNept4une/img-config/printer-data/$file" \
764-
"${HOME}/printer_data/config/$file" 2>/dev/null)
765-
fi
789+
PS3="Enter the number of the configuration to install (or 'Exit' to finish): "
790+
local options=("All" "Fluidd web interface Conf" "Moonraker Conf" "KAMP Conf" "Mainsail web interface Conf" "Pico USB-C ADXL Conf" "Klipper DEBUG Addon" "Exit")
766791

767-
if [[ -z "$DIFF_OUTPUT" ]]; then
768-
printf '\n%s\n' "${G}There are no differences, Already up-to-date! ${NC}"
769-
printf '\n%s\n\n' "${Y}Would you like to install another configuration? (y/n).${NC}"
770-
read -r -p "$(printf '%b' "${M}Enter your choice ${NC}: ")" CONTINUE_CHOICE
792+
while true; do
793+
clear_screen
794+
printf '%b\n' "${C}${OPENNEPT4UNE_ART}${NC}"
795+
printf '\n%s\n' "Select configurations to install:"
796+
for i in "${!options[@]}"; do
797+
printf '%2d) %s\n' $((i+1)) "${options[$i]}"
798+
done
771799

772-
if [[ "$CONTINUE_CHOICE" =~ ^[Nn]$ ]]; then
773-
printf '\n%s\n' "${Y}Exiting the update process.${NC}"
774-
sleep 1
775-
break
776-
else
777-
printf '\n%s\n' "${G}Returning to configuration selection.${NC}"
778-
sleep 1
779-
continue
780-
fi
781-
else
782-
printf '%s\n' "$DIFF_OUTPUT"
783-
printf '\n%s\n\n' "${Y}Would you like to continue with the update? (y/n).${NC}"
800+
local opt
801+
read -rp "$PS3" opt
802+
case "$opt" in
803+
1)
804+
printf '%s\n' "Installing all configurations..."
805+
for key in "${!config_files[@]}"; do
806+
[[ "$key" == "All" ]] && continue
807+
local files="${config_files[$key]}"
808+
[[ -z "$files" ]] && continue
809+
for file in $files; do
810+
install_one "$file" || printf '%b\n' "${R}Failed: ${file}${NC}"
811+
done
812+
done
813+
printf '\n%s\n' "${G}All configurations installed.${NC}"
814+
sleep 2
815+
return 0
816+
;;
817+
2|3|4|5|6|7)
818+
local opt_name="${options[$((opt-1))]}"
819+
printf '%s\n' "Installing ${opt_name}..."
820+
local files="${config_files[$opt_name]}"
821+
822+
printf '\n%s\n' "${G}Compare/diff current ${opt_name} with latest? (y/n)${NC}"
823+
local DIFF_CHOICE
824+
read -r -p "$(printf '%b' "${M}Enter your choice ${NC}: ")" DIFF_CHOICE
825+
826+
if [[ "$DIFF_CHOICE" =~ ^[Yy]$ ]]; then
827+
clear_screen
828+
printf '\n'
829+
for file in $files; do
830+
printf '%b\n' "${C}==========================================================${NC}"
831+
local diff_rc=0
832+
maybe_diff "$file" || diff_rc=$?
833+
if [[ $diff_rc -eq 0 || $diff_rc -eq 2 || $diff_rc -eq 3 ]]; then
834+
printf '\n%s\n' "${Y}Continue with update for ${file}? (y/n)${NC}"
835+
local CONTINUE_CHOICE
784836
read -r -p "$(printf '%b' "${M}Enter your choice ${NC}: ")" CONTINUE_CHOICE
785-
786-
if [[ "$CONTINUE_CHOICE" =~ ^[Yy]$ ]]; then
787-
printf '\n%s\n' "${G}Continuing with ${opt_name} update.${NC}"
788-
sleep 1
789-
else
790-
printf '\n%s\n' "${Y}Exiting the update process.${NC}"
791-
sleep 1
837+
if [[ ! "$CONTINUE_CHOICE" =~ ^[Yy]$ ]]; then
838+
printf '%s\n' "${Y}Skipping ${file}.${NC}"
792839
continue
793840
fi
841+
else
842+
# up-to-date; skip install
843+
continue
794844
fi
795-
else
796-
printf '\n%s\n' "${G}Continuing with ${opt_name} update.${NC}"
845+
install_one "$file" || printf '%b\n' "${R}Failed: ${file}${NC}"
846+
done
847+
848+
printf '\n%s\n' "${Y}Install another configuration? (y/n)${NC}"
849+
local CONTINUE_CHOICE
850+
read -r -p "$(printf '%b' "${M}Enter your choice ${NC}: ")" CONTINUE_CHOICE
851+
if [[ "$CONTINUE_CHOICE" =~ ^[Nn]$ ]]; then
852+
printf '\n%s\n' "${Y}Exiting the update process.${NC}"
797853
sleep 1
854+
break
798855
fi
856+
printf '\n%s\n' "${G}Returning to configuration selection.${NC}"
857+
sleep 1
858+
else
859+
printf '\n%s\n' "${G}Continuing with ${opt_name} update.${NC}"
860+
sleep 1
861+
for file in $files; do
862+
install_one "$file" || printf '%b\n' "${R}Failed: ${file}${NC}"
863+
done
864+
fi
799865

800-
cp "${HOME}/OpenNept4une/img-config/printer-data/$file" "${HOME}/printer_data/config/"
801-
if [[ $file == "data.mdb" ]]; then
802-
mv "${HOME}/printer_data/config/data.mdb" "${HOME}/printer_data/database/data.mdb"
803-
fi
804-
printf '%s\n' "${G}${opt_name} installed successfully.${NC}"
805-
;;
806-
8)
807-
printf '%s\n' "${Y}Exiting the update process.${NC}"
808-
break
809-
;;
810-
*)
811-
printf '%b\n' "${R}Invalid selection. Please try again.${NC}"
812-
;;
813-
esac
814-
done
866+
printf '%s\n' "${G}${opt_name} installed successfully.${NC}"
867+
;;
868+
8)
869+
printf '%s\n' "${Y}Exiting the update process.${NC}"
870+
break
871+
;;
872+
*)
873+
printf '%b\n' "${R}Invalid selection. Please try again.${NC}"
874+
;;
875+
esac
876+
done
815877

816-
printf '%s\n\n' "${G}Selected configurations installed successfully.${NC}"
817-
sleep 1
818-
else
819-
printf '%b\n' "${Y}Installation of latest configurations skipped.${NC}"
820-
sleep 1
821-
fi
878+
printf '%s\n\n' "${G}Selected configurations installed successfully.${NC}"
879+
sleep 1
822880
}
823881

824882
wifi_config() {

0 commit comments

Comments
 (0)