Skip to content

Commit d957dbe

Browse files
Function to freeze and unfreeze board firmware (#25)
* Function to freeze and unfreeze board firmware * chore: Update network service discovery * chore: Toggle menu items based on held packages Freeze/unfreeze * chore: Update network service discovery fix: moved PR template to proper folder add: CODE_OF_CONDUCT.md * chore: Remove unused script for freezing system packages * chore: Update kernal header install remove --------- Co-authored-by: Joey Turner <[email protected]> Co-authored-by: Tearran <[email protected]>
1 parent 80e5936 commit d957dbe

File tree

4 files changed

+106
-14
lines changed

4 files changed

+106
-14
lines changed
File renamed without changes.

CODE_OF_CONDUCT.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
## Code of Conduct
2+
3+
We strive to create a welcoming and inclusive environment for everyone. To ensure this, please follow these guidelines:
4+
5+
- **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.
6+
7+
- **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.
8+
9+
- **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.
10+
11+
- **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.
12+
13+
- **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.
14+
15+
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.

lib/armbian-configng/config.ng.jobs.json

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
},
3232
{
3333
"id": "S03",
34-
"description": "Edit the boot environment (WIP)",
34+
"description": "Edit the boot environment",
3535
"command": [
3636
"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",
3737
"nano /boot/armbianEnv.txt"
@@ -203,6 +203,38 @@
203203
"doc_link": "",
204204
"src_reference": "",
205205
"author": ""
206+
},
207+
{
208+
"id": "N10",
209+
"description": "Announce system in the network (Avahi) ",
210+
"command": [
211+
"get_user_continue \"This operation will install avahi-daemon and add configuration files.\nDo you wish to continue?\" process_input",
212+
"check_if_installed avahi-daemon",
213+
"debconf-apt-progress -- apt-get -y install avahi-daemon libnss-mdns",
214+
"cp /usr/share/doc/avahi-daemon/examples/sftp-ssh.service /etc/avahi/services/",
215+
"cp /usr/share/doc/avahi-daemon/examples/ssh.service /etc/avahi/services/",
216+
"service avahi-daemon restart"
217+
],
218+
"show": true,
219+
"status": "Active",
220+
"doc_link": "",
221+
"src_reference": "",
222+
"author": ""
223+
},
224+
{
225+
"id": "N11",
226+
"description": "Disable system announce in the network (Avahi) ",
227+
"command": [
228+
"get_user_continue \"This operation will purge avahi-daemon \nDo you wish to continue?\" process_input",
229+
"check_if_installed avahi-daemon",
230+
"systemctl stop avahi-daemon avahi-daemon.socket",
231+
"debconf-apt-progress -- apt-get -y purge avahi-daemon"
232+
],
233+
"show": true,
234+
"status": "Active",
235+
"doc_link": "",
236+
"src_reference": "",
237+
"author": ""
206238
}
207239
]
208240
},

lib/armbian-configng/config.ng.runtime.sh

Lines changed: 58 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,13 @@ set_colors 2 # Set the color to green
99

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

12+
#
1213
# Initialize variables
1314
system_info="$(uname -m)"
14-
network_adapter="$DEFAULT_ADAPTER"
1515
locale_setting="$LANG"
1616
installed_software="$(see_current_apt)"
17-
bluetooth_status=$(dpkg -s bluetooth &> /dev/null && echo true || echo false)
18-
bluez_status=$(dpkg -s bluez &> /dev/null && echo true || echo false)
19-
bluez_tools_status=$(dpkg -s bluez-tools &> /dev/null && echo true || echo false)
17+
held_packages=$(apt-mark showhold)
18+
2019

2120
module_options+=(
2221
["update_json_data,author"]="Joey Turner"
@@ -70,19 +69,17 @@ toggle_menu_item() {
7069
}
7170

7271

72+
#
7373
# Main menu updates
7474
update_json_data "System" "$system_info"
7575
update_json_data "Network" "$network_adapter"
7676
update_json_data "Localisation" "$locale_setting"
7777
update_json_data "Software" "$installed_software"
7878

7979

80-
# Submenu updates based on network and software
81-
update_submenu_data "Testing" "T2" "$network_adapter"
82-
update_submenu_data "Testing" "T1" "$installed_software"
83-
update_submenu_data "Install" "I0" "$installed_software"
84-
85-
80+
#
81+
# Check if network adapter is IPv6 or IPv4
82+
network_adapter="$DEFAULT_ADAPTER"
8683

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

91+
92+
#
93+
# Check for avahi-daemon installed
94+
is_avahi_installed=$(check_if_installed avahi-daemon)
95+
96+
# Conditional submenu network service discovery and hostname resolution
97+
if ! check_if_installed avahi-daemon ; then
98+
toggle_menu_item "Network" "N10" "true"
99+
toggle_menu_item "Network" "N11" "false"
100+
else
101+
toggle_menu_item "Network" "N10" "false"
102+
toggle_menu_item "Network" "N11" "true"
103+
fi
104+
105+
106+
#
107+
# Check Bluetooth installed
108+
bluetooth_status=$(dpkg -s bluetooth &> /dev/null && echo true || echo false)
109+
bluez_status=$(dpkg -s bluez &> /dev/null && echo true || echo false)
110+
bluez_tools_status=$(dpkg -s bluez-tools &> /dev/null && echo true || echo false)
111+
94112
# Bluetooth menu item visibility
95113
if [ "$bluetooth_status" = false ] || [ "$bluez_status" = false ] || [ "$bluez_tools_status" = false ]; then
96114
toggle_menu_item "Network" "N00" "true"
@@ -100,9 +118,36 @@ else
100118
toggle_menu_item "Network" "N02" "true"
101119
fi
102120

103-
if [ "$system_info" ]; then
104-
toggle_menu_item "System" "S01" "true"
121+
122+
#
123+
# Check if packages are held
124+
held_packages=$(apt-mark showhold)
125+
126+
# Toggle menu items for freeze and unfreeze
127+
if [[ -z "$held_packages" ]]; then
128+
toggle_menu_item "System" "S02" "true" # Show unfreeze
129+
toggle_menu_item "System" "S01" "false" # Hide freeze
130+
else
131+
toggle_menu_item "System" "S02" "false" # Hide unfreeze
132+
toggle_menu_item "System" "S01" "true" # Show freeze
133+
fi
134+
135+
136+
#
137+
# Check if kernel headers are installed
138+
if dpkg-query -W -f='${Status}' "linux-headers-${BRANCH}-${LINUXFAMILY}" 2>/dev/null | grep -q "install ok installed"; then
139+
is_kernel_headers_installed=true
140+
elif dpkg-query -W -f='${Status}' "linux-headers-$(uname -r | sed 's/'-$(dpkg --print-architecture)'//')" 2>/dev/null | grep -q "install ok installed"; then
141+
is_kernel_headers_installed=true
105142
else
106-
toggle_menu_item "System" "S01" "false"
143+
is_kernel_headers_installed=false
107144
fi
108145

146+
# Toggle menu items for kernel headers
147+
if [ "$is_kernel_headers_installed" = true ]; then
148+
toggle_menu_item "System" "S05" "true" # Show kernel headers installed
149+
toggle_menu_item "System" "S04" "false" # Hide install Linux headers
150+
else
151+
toggle_menu_item "System" "S05" "false" # Hide kernel headers installed
152+
toggle_menu_item "System" "S04" "true" # Show install Linux headers
153+
fi

0 commit comments

Comments
 (0)