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 != $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

View File

@ -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
}