From a860fb6129c31a3b35d969f8e4ed9f098f966d98 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Wed, 2 Dec 2015 17:30:44 +0000 Subject: [PATCH] Change the password of the new user --- src/freedombone-config | 3 ++- src/freedombone-controlpanel | 49 +++++++++++++++++++++++++++--------- 2 files changed, 39 insertions(+), 13 deletions(-) diff --git a/src/freedombone-config b/src/freedombone-config index bbb0fe29..0724d042 100755 --- a/src/freedombone-config +++ b/src/freedombone-config @@ -690,7 +690,8 @@ function interactive_configuration { if [ ${#possible_username} -gt 1 ]; then if [[ $possible_username != $GENERIC_IMAGE_USERNAME ]]; then MY_USERNAME=$(cat $data) - useradd -m -p "$IMAGE_PASSWORD_FILE" -s /bin/bash $MY_USERNAME + useradd -m -s /bin/bash $MY_USERNAME + echo "${MY_USERNAME}:$(printf `cat $IMAGE_PASSWORD_FILE`)" | chpasswd break fi fi diff --git a/src/freedombone-controlpanel b/src/freedombone-controlpanel index 3ab1efdd..fe426cd4 100755 --- a/src/freedombone-controlpanel +++ b/src/freedombone-controlpanel @@ -344,7 +344,7 @@ function block_unblock_email { if [ ! $SELECTED_USERNAME ]; then return fi - blockstr=$"Block/Unblock email going to" + blockstr=$"Block/Unblock email going to" data=$(tempfile 2>/dev/null) trap "rm -f $data" 0 1 2 5 15 dialog --backtitle $"Freedombone Control Panel" \ @@ -386,7 +386,7 @@ function block_unblock_subject { if [ ! $SELECTED_USERNAME ]; then return fi - blockstr=$"Block/Unblock email going to" + blockstr=$"Block/Unblock email going to" data=$(tempfile 2>/dev/null) trap "rm -f $data" 0 1 2 5 15 dialog --backtitle $"Freedombone Control Panel" \ @@ -520,7 +520,7 @@ function restore_gpg_key { if [ ! $SELECTED_USERNAME ]; then return fi - restorestr=$"Restore GPG key for user" + restorestr=$"Restore GPG key for user" dialog --title "$restorestr $SELECTED_USERNAME" \ --msgbox $"Plug in your USB keydrive" 6 40 clear @@ -684,6 +684,29 @@ function restart_system { reboot } +function change_system_name { + data=$(tempfile 2>/dev/null) + trap "rm -f $data" 0 1 2 5 15 + dialog --title $"Change the name of this system" \ + --backtitle $"Freedombone Control Panel" \ + --inputbox $'Enter a new name for this system on your local network\n\nIt will appear as newname.local' 10 60 2>$data + sel=$? + case $sel in + 0) NEW_SYSTEM_NAME=$(<$data) + if [ "$NEW_SYSTEM_NAME" ]; then + if [ ${#NEW_SYSTEM_NAME} -gt 1 ]; then + sed -i "s|host-name=.*|host-name=$NEW_SYSTEM_NAME|g" /etc/avahi/avahi-daemon.conf + systemctl restart avahi-daemon + if grep -q "host-name=$NEW_SYSTEM_NAME" /etc/avahi/avahi-daemon.conf; then + dialog --title $"New local network name" \ + --msgbox $"The name of this system on your local network was changed successfully" 6 70 + fi + fi + fi + ;; + esac +} + function menu_backup_restore { while true do @@ -811,7 +834,7 @@ function menu_top_level { trap "rm -f $data" 0 1 2 5 15 dialog --backtitle $"Freedombone Control Panel" \ --title $"Control Panel" \ - --radiolist $"Choose an operation:" 19 70 12 \ + --radiolist $"Choose an operation:" 20 70 13 \ 1 $"Backup and Restore" off \ 2 $"Show SIP Phone Extensions" off \ 3 $"Reset Tripwire" off \ @@ -820,10 +843,11 @@ function menu_top_level { 6 $"Email Filtering Rules" off \ 7 $"Security Settings" off \ 8 $"Hubzilla" off \ - 9 $"Check for updates" off \ - 10 $"Power off the system" off \ - 11 $"Restart the system" off \ - 12 $"Exit" on 2> $data + 9 $"Change the name of this system" off \ + 10 $"Check for updates" off \ + 11 $"Power off the system" off \ + 12 $"Restart the system" off \ + 13 $"Exit" on 2> $data sel=$? case $sel in 1) exit 1;; @@ -838,10 +862,11 @@ function menu_top_level { 6) menu_email;; 7) security_settings;; 8) menu_hubzilla;; - 9) check_for_updates;; - 10) shut_down_system;; - 11) restart_system;; - 12) break;; + 9) change_system_name;; + 10) check_for_updates;; + 11) shut_down_system;; + 12) restart_system;; + 13) break;; esac done }