Sfoglia il codice sorgente

Change the password of the new user

Bob Mottram 9 anni fa
parent
commit
a860fb6129
2 ha cambiato i file con 39 aggiunte e 13 eliminazioni
  1. 2
    1
      src/freedombone-config
  2. 37
    12
      src/freedombone-controlpanel

+ 2
- 1
src/freedombone-config Vedi File

@@ -690,7 +690,8 @@ function interactive_configuration {
690 690
                            if [ ${#possible_username} -gt 1 ]; then
691 691
                                if [[ $possible_username != $GENERIC_IMAGE_USERNAME ]]; then
692 692
                                    MY_USERNAME=$(cat $data)
693
-                                   useradd -m -p "$IMAGE_PASSWORD_FILE" -s /bin/bash $MY_USERNAME
693
+                                   useradd -m -s /bin/bash $MY_USERNAME
694
+                                   echo "${MY_USERNAME}:$(printf `cat $IMAGE_PASSWORD_FILE`)" | chpasswd
694 695
                                    break
695 696
                                fi
696 697
                            fi

+ 37
- 12
src/freedombone-controlpanel Vedi File

@@ -344,7 +344,7 @@ function block_unblock_email {
344 344
     if [ ! $SELECTED_USERNAME ]; then
345 345
         return
346 346
     fi
347
-	blockstr=$"Block/Unblock email going to"
347
+    blockstr=$"Block/Unblock email going to"
348 348
     data=$(tempfile 2>/dev/null)
349 349
     trap "rm -f $data" 0 1 2 5 15
350 350
     dialog --backtitle $"Freedombone Control Panel" \
@@ -386,7 +386,7 @@ function block_unblock_subject {
386 386
     if [ ! $SELECTED_USERNAME ]; then
387 387
         return
388 388
     fi
389
-	blockstr=$"Block/Unblock email going to"
389
+    blockstr=$"Block/Unblock email going to"
390 390
     data=$(tempfile 2>/dev/null)
391 391
     trap "rm -f $data" 0 1 2 5 15
392 392
     dialog --backtitle $"Freedombone Control Panel" \
@@ -520,7 +520,7 @@ function restore_gpg_key {
520 520
     if [ ! $SELECTED_USERNAME ]; then
521 521
         return
522 522
     fi
523
-	restorestr=$"Restore GPG key for user"
523
+    restorestr=$"Restore GPG key for user"
524 524
     dialog --title "$restorestr $SELECTED_USERNAME" \
525 525
            --msgbox $"Plug in your USB keydrive" 6 40
526 526
     clear
@@ -684,6 +684,29 @@ function restart_system {
684 684
     reboot
685 685
 }
686 686
 
687
+function change_system_name {
688
+    data=$(tempfile 2>/dev/null)
689
+    trap "rm -f $data" 0 1 2 5 15
690
+    dialog --title $"Change the name of this system" \
691
+           --backtitle $"Freedombone Control Panel" \
692
+           --inputbox $'Enter a new name for this system on your local network\n\nIt will appear as newname.local' 10 60 2>$data
693
+    sel=$?
694
+    case $sel in
695
+        0) NEW_SYSTEM_NAME=$(<$data)
696
+           if [ "$NEW_SYSTEM_NAME" ]; then
697
+               if [ ${#NEW_SYSTEM_NAME} -gt 1 ]; then
698
+                   sed -i "s|host-name=.*|host-name=$NEW_SYSTEM_NAME|g" /etc/avahi/avahi-daemon.conf
699
+                   systemctl restart avahi-daemon
700
+                   if grep -q "host-name=$NEW_SYSTEM_NAME" /etc/avahi/avahi-daemon.conf; then
701
+                       dialog --title $"New local network name" \
702
+                              --msgbox $"The name of this system on your local network was changed successfully" 6 70
703
+                   fi
704
+               fi
705
+           fi
706
+           ;;
707
+    esac
708
+}
709
+
687 710
 function menu_backup_restore {
688 711
     while true
689 712
     do
@@ -811,7 +834,7 @@ function menu_top_level {
811 834
         trap "rm -f $data" 0 1 2 5 15
812 835
         dialog --backtitle $"Freedombone Control Panel" \
813 836
                --title $"Control Panel" \
814
-               --radiolist $"Choose an operation:" 19 70 12 \
837
+               --radiolist $"Choose an operation:" 20 70 13 \
815 838
                1 $"Backup and Restore" off \
816 839
                2 $"Show SIP Phone Extensions" off \
817 840
                3 $"Reset Tripwire" off \
@@ -820,10 +843,11 @@ function menu_top_level {
820 843
                6 $"Email Filtering Rules" off \
821 844
                7 $"Security Settings" off \
822 845
                8 $"Hubzilla" off \
823
-               9 $"Check for updates" off \
824
-               10 $"Power off the system" off \
825
-               11 $"Restart the system" off \
826
-               12 $"Exit" on 2> $data
846
+               9 $"Change the name of this system" off \
847
+               10 $"Check for updates" off \
848
+               11 $"Power off the system" off \
849
+               12 $"Restart the system" off \
850
+               13 $"Exit" on 2> $data
827 851
         sel=$?
828 852
         case $sel in
829 853
             1) exit 1;;
@@ -838,10 +862,11 @@ function menu_top_level {
838 862
             6) menu_email;;
839 863
             7) security_settings;;
840 864
             8) menu_hubzilla;;
841
-            9) check_for_updates;;
842
-            10) shut_down_system;;
843
-            11) restart_system;;
844
-            12) break;;
865
+            9) change_system_name;;
866
+            10) check_for_updates;;
867
+            11) shut_down_system;;
868
+            12) restart_system;;
869
+            13) break;;
845 870
         esac
846 871
     done
847 872
 }