Skip to content

Commit

Permalink
Move change hostname function from JSON file
Browse files Browse the repository at this point in the history
  • Loading branch information
igorpecovnik committed Oct 10, 2024
1 parent 9931f1c commit 01e4adb
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 8 deletions.
5 changes: 1 addition & 4 deletions lib/armbian-configng/config.ng.jobs.json
Original file line number Diff line number Diff line change
Expand Up @@ -562,10 +562,7 @@
{
"id": "L04",
"description": "Change System Hostname",
"command": [
"NEW_HOSTNAME=$($DIALOG --title \"Enter new hostnane\" --inputbox \"\" 7 50 3>&1 1>&2 2>&3)",
"[ $? -eq 0 ] && [ -n \"${NEW_HOSTNAME}\" ] && hostnamectl set-hostname \"${NEW_HOSTNAME}\""
],
"command": [ "change_system_hostname" ],
"status": "Preview",
"author": ""
}
Expand Down
16 changes: 16 additions & 0 deletions lib/armbian-configng/config.ng.system.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,22 @@ function apt_install_wrapper() {
fi
}

module_options+=(
["change_system_hostname,author"]="igorpecovnik"
["change_system_hostname,ref_link"]=""
["change_system_hostname,feature"]="Change hostname"
["change_system_hostname,desc"]="change_system_hostname"
["change_system_hostname,example"]="change_system_hostname"
["change_system_hostname,status"]="Active"
)
#
# @description Change system hostname
#
function change_system_hostname() {
local new_hostname=$($DIALOG --title "Enter new hostnane" --inputbox "" 7 50 3>&1 1>&2 2>&3)
[ $? -eq 0 ] && [ -n "${new_hostname}" ] && hostnamectl set-hostname "${new_hostname}"
}

module_options+=(
["release_upgrade,author"]="Igor Pecovnik"
["release_upgrade,ref_link"]=""
Expand Down
5 changes: 1 addition & 4 deletions tools/json/config.localisation.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,7 @@
{
"id": "L04",
"description": "Change System Hostname",
"command": [
"NEW_HOSTNAME=$(whiptail --title \"Enter new hostnane\" --inputbox \"\" 7 50 3>&1 1>&2 2>&3)",
"[ $? -eq 0 ] && [ -n \"${NEW_HOSTNAME}\" ] && hostnamectl set-hostname \"${NEW_HOSTNAME}\""
],
"command": [ "change_system_hostname" ],
"status": "Preview",
"author": ""
}
Expand Down

0 comments on commit 01e4adb

Please sign in to comment.