Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Function to freeze and unfreeze board firmware #25

Merged
merged 7 commits into from
Aug 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
## Code of Conduct

We strive to create a welcoming and inclusive environment for everyone. To ensure this, please follow these guidelines:

- **Be Respectful and Considerate**: Remember that our community is global, and language and cultural differences may exist. Avoid using offensive or inappropriate language. Understand that what may be acceptable in one culture could be considered offensive in another.

- **Seek Clarification When Needed**: If you don't understand something, don't hesitate to ask questions. Similarly, if someone asks a question, be patient and provide a clear and helpful response. Avoid being offended by questions or requests for clarification.

- **Communication Challenges**: Recognize that not everyone finds communication easy. If you have difficulty expressing yourself, that's okay. We ask everyone to be patient and understanding, and to focus on the message rather than the way it is conveyed.

- **Be Patient and Understanding**: Recognize that contributors come from various backgrounds and levels of experience. If someone makes a mistake, offer constructive feedback rather than criticism.

- **Encourage Inclusivity**: Make an effort to include everyone in discussions, especially those who might be new or less experienced. Avoid jargon or acronyms without explanations, as these can be confusing for newcomers.

By following these guidelines, we can ensure a positive and productive environment for all contributors. If you encounter any issues or have concerns, please reach out to the project maintainers on GitHub, the Armbian forums, or Discord.
34 changes: 33 additions & 1 deletion lib/armbian-configng/config.ng.jobs.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
},
{
"id": "S03",
"description": "Edit the boot environment (WIP)",
"description": "Edit the boot environment",
"command": [
"get_user_continue \"This will open /boot/armbianEnv.txt file to edit\nCTRL+S to save\nCTLR+X to exit\nwould you like to continue?\" process_input",
"nano /boot/armbianEnv.txt"
Expand Down Expand Up @@ -203,6 +203,38 @@
"doc_link": "",
"src_reference": "",
"author": ""
},
{
"id": "N10",
"description": "Announce system in the network (Avahi) ",
"command": [
"get_user_continue \"This operation will install avahi-daemon and add configuration files.\nDo you wish to continue?\" process_input",
"check_if_installed avahi-daemon",
"debconf-apt-progress -- apt-get -y install avahi-daemon libnss-mdns",
"cp /usr/share/doc/avahi-daemon/examples/sftp-ssh.service /etc/avahi/services/",
"cp /usr/share/doc/avahi-daemon/examples/ssh.service /etc/avahi/services/",
"service avahi-daemon restart"
],
"show": true,
"status": "Active",
"doc_link": "",
"src_reference": "",
"author": ""
},
{
"id": "N11",
"description": "Disable system announce in the network (Avahi) ",
"command": [
"get_user_continue \"This operation will purge avahi-daemon \nDo you wish to continue?\" process_input",
"check_if_installed avahi-daemon",
"systemctl stop avahi-daemon avahi-daemon.socket",
"debconf-apt-progress -- apt-get -y purge avahi-daemon"
],
"show": true,
"status": "Active",
"doc_link": "",
"src_reference": "",
"author": ""
}
]
},
Expand Down
71 changes: 58 additions & 13 deletions lib/armbian-configng/config.ng.runtime.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,13 @@ set_colors 2 # Set the color to green

# Dynamically updates a JSON menu structure based on system checks.

#
# Initialize variables
system_info="$(uname -m)"
network_adapter="$DEFAULT_ADAPTER"
locale_setting="$LANG"
installed_software="$(see_current_apt)"
bluetooth_status=$(dpkg -s bluetooth &> /dev/null && echo true || echo false)
bluez_status=$(dpkg -s bluez &> /dev/null && echo true || echo false)
bluez_tools_status=$(dpkg -s bluez-tools &> /dev/null && echo true || echo false)
held_packages=$(apt-mark showhold)


module_options+=(
["update_json_data,author"]="Joey Turner"
Expand Down Expand Up @@ -70,19 +69,17 @@ toggle_menu_item() {
}


#
# Main menu updates
update_json_data "System" "$system_info"
update_json_data "Network" "$network_adapter"
update_json_data "Localisation" "$locale_setting"
update_json_data "Software" "$installed_software"


# Submenu updates based on network and software
update_submenu_data "Testing" "T2" "$network_adapter"
update_submenu_data "Testing" "T1" "$installed_software"
update_submenu_data "Install" "I0" "$installed_software"


#
# Check if network adapter is IPv6 or IPv4
network_adapter="$DEFAULT_ADAPTER"

# Conditional submenu updates based on network type
if [ "$network_adapter" = "IPv6" ]; then
Expand All @@ -91,6 +88,27 @@ else
update_submenu_data "Network" "N08" "IPV4"
fi


#
# Check for avahi-daemon installed
is_avahi_installed=$(check_if_installed avahi-daemon)

# Conditional submenu network service discovery and hostname resolution
if ! check_if_installed avahi-daemon ; then
toggle_menu_item "Network" "N10" "true"
toggle_menu_item "Network" "N11" "false"
else
toggle_menu_item "Network" "N10" "false"
toggle_menu_item "Network" "N11" "true"
fi


#
# Check Bluetooth installed
bluetooth_status=$(dpkg -s bluetooth &> /dev/null && echo true || echo false)
bluez_status=$(dpkg -s bluez &> /dev/null && echo true || echo false)
bluez_tools_status=$(dpkg -s bluez-tools &> /dev/null && echo true || echo false)

# Bluetooth menu item visibility
if [ "$bluetooth_status" = false ] || [ "$bluez_status" = false ] || [ "$bluez_tools_status" = false ]; then
toggle_menu_item "Network" "N00" "true"
Expand All @@ -100,9 +118,36 @@ else
toggle_menu_item "Network" "N02" "true"
fi

if [ "$system_info" ]; then
toggle_menu_item "System" "S01" "true"

#
# Check if packages are held
held_packages=$(apt-mark showhold)

# Toggle menu items for freeze and unfreeze
if [[ -z "$held_packages" ]]; then
toggle_menu_item "System" "S02" "true" # Show unfreeze
toggle_menu_item "System" "S01" "false" # Hide freeze
else
toggle_menu_item "System" "S02" "false" # Hide unfreeze
toggle_menu_item "System" "S01" "true" # Show freeze
fi


#
# Check if kernel headers are installed
if dpkg-query -W -f='${Status}' "linux-headers-${BRANCH}-${LINUXFAMILY}" 2>/dev/null | grep -q "install ok installed"; then
is_kernel_headers_installed=true
elif dpkg-query -W -f='${Status}' "linux-headers-$(uname -r | sed 's/'-$(dpkg --print-architecture)'//')" 2>/dev/null | grep -q "install ok installed"; then
is_kernel_headers_installed=true
else
toggle_menu_item "System" "S01" "false"
is_kernel_headers_installed=false
fi

# Toggle menu items for kernel headers
if [ "$is_kernel_headers_installed" = true ]; then
toggle_menu_item "System" "S05" "true" # Show kernel headers installed
toggle_menu_item "System" "S04" "false" # Hide install Linux headers
else
toggle_menu_item "System" "S05" "false" # Hide kernel headers installed
toggle_menu_item "System" "S04" "true" # Show install Linux headers
fi
Loading