Change the password of the new user

This commit is contained in:
Bob Mottram 2015-12-02 17:30:44 +00:00
parent c271512ef4
commit a860fb6129
2 changed files with 39 additions and 13 deletions

View File

@ -690,7 +690,8 @@ function interactive_configuration {
if [ ${#possible_username} -gt 1 ]; then if [ ${#possible_username} -gt 1 ]; then
if [[ $possible_username != $GENERIC_IMAGE_USERNAME ]]; then if [[ $possible_username != $GENERIC_IMAGE_USERNAME ]]; then
MY_USERNAME=$(cat $data) 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 break
fi fi
fi fi

View File

@ -344,7 +344,7 @@ function block_unblock_email {
if [ ! $SELECTED_USERNAME ]; then if [ ! $SELECTED_USERNAME ]; then
return return
fi fi
blockstr=$"Block/Unblock email going to" blockstr=$"Block/Unblock email going to"
data=$(tempfile 2>/dev/null) data=$(tempfile 2>/dev/null)
trap "rm -f $data" 0 1 2 5 15 trap "rm -f $data" 0 1 2 5 15
dialog --backtitle $"Freedombone Control Panel" \ dialog --backtitle $"Freedombone Control Panel" \
@ -386,7 +386,7 @@ function block_unblock_subject {
if [ ! $SELECTED_USERNAME ]; then if [ ! $SELECTED_USERNAME ]; then
return return
fi fi
blockstr=$"Block/Unblock email going to" blockstr=$"Block/Unblock email going to"
data=$(tempfile 2>/dev/null) data=$(tempfile 2>/dev/null)
trap "rm -f $data" 0 1 2 5 15 trap "rm -f $data" 0 1 2 5 15
dialog --backtitle $"Freedombone Control Panel" \ dialog --backtitle $"Freedombone Control Panel" \
@ -520,7 +520,7 @@ function restore_gpg_key {
if [ ! $SELECTED_USERNAME ]; then if [ ! $SELECTED_USERNAME ]; then
return return
fi fi
restorestr=$"Restore GPG key for user" restorestr=$"Restore GPG key for user"
dialog --title "$restorestr $SELECTED_USERNAME" \ dialog --title "$restorestr $SELECTED_USERNAME" \
--msgbox $"Plug in your USB keydrive" 6 40 --msgbox $"Plug in your USB keydrive" 6 40
clear clear
@ -684,6 +684,29 @@ function restart_system {
reboot 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 { function menu_backup_restore {
while true while true
do do
@ -811,7 +834,7 @@ function menu_top_level {
trap "rm -f $data" 0 1 2 5 15 trap "rm -f $data" 0 1 2 5 15
dialog --backtitle $"Freedombone Control Panel" \ dialog --backtitle $"Freedombone Control Panel" \
--title $"Control Panel" \ --title $"Control Panel" \
--radiolist $"Choose an operation:" 19 70 12 \ --radiolist $"Choose an operation:" 20 70 13 \
1 $"Backup and Restore" off \ 1 $"Backup and Restore" off \
2 $"Show SIP Phone Extensions" off \ 2 $"Show SIP Phone Extensions" off \
3 $"Reset Tripwire" off \ 3 $"Reset Tripwire" off \
@ -820,10 +843,11 @@ function menu_top_level {
6 $"Email Filtering Rules" off \ 6 $"Email Filtering Rules" off \
7 $"Security Settings" off \ 7 $"Security Settings" off \
8 $"Hubzilla" off \ 8 $"Hubzilla" off \
9 $"Check for updates" off \ 9 $"Change the name of this system" off \
10 $"Power off the system" off \ 10 $"Check for updates" off \
11 $"Restart the system" off \ 11 $"Power off the system" off \
12 $"Exit" on 2> $data 12 $"Restart the system" off \
13 $"Exit" on 2> $data
sel=$? sel=$?
case $sel in case $sel in
1) exit 1;; 1) exit 1;;
@ -838,10 +862,11 @@ function menu_top_level {
6) menu_email;; 6) menu_email;;
7) security_settings;; 7) security_settings;;
8) menu_hubzilla;; 8) menu_hubzilla;;
9) check_for_updates;; 9) change_system_name;;
10) shut_down_system;; 10) check_for_updates;;
11) restart_system;; 11) shut_down_system;;
12) break;; 12) restart_system;;
13) break;;
esac esac
done done
} }