Pārlūkot izejas kodu

Change the password of the new user

Bob Mottram 9 gadus atpakaļ
vecāks
revīzija
a860fb6129
2 mainītis faili ar 39 papildinājumiem un 13 dzēšanām
  1. 2
    1
      src/freedombone-config
  2. 37
    12
      src/freedombone-controlpanel

+ 2
- 1
src/freedombone-config Parādīt failu

690
                            if [ ${#possible_username} -gt 1 ]; then
690
                            if [ ${#possible_username} -gt 1 ]; then
691
                                if [[ $possible_username != $GENERIC_IMAGE_USERNAME ]]; then
691
                                if [[ $possible_username != $GENERIC_IMAGE_USERNAME ]]; then
692
                                    MY_USERNAME=$(cat $data)
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
                                    break
695
                                    break
695
                                fi
696
                                fi
696
                            fi
697
                            fi

+ 37
- 12
src/freedombone-controlpanel Parādīt failu

344
     if [ ! $SELECTED_USERNAME ]; then
344
     if [ ! $SELECTED_USERNAME ]; then
345
         return
345
         return
346
     fi
346
     fi
347
-	blockstr=$"Block/Unblock email going to"
347
+    blockstr=$"Block/Unblock email going to"
348
     data=$(tempfile 2>/dev/null)
348
     data=$(tempfile 2>/dev/null)
349
     trap "rm -f $data" 0 1 2 5 15
349
     trap "rm -f $data" 0 1 2 5 15
350
     dialog --backtitle $"Freedombone Control Panel" \
350
     dialog --backtitle $"Freedombone Control Panel" \
386
     if [ ! $SELECTED_USERNAME ]; then
386
     if [ ! $SELECTED_USERNAME ]; then
387
         return
387
         return
388
     fi
388
     fi
389
-	blockstr=$"Block/Unblock email going to"
389
+    blockstr=$"Block/Unblock email going to"
390
     data=$(tempfile 2>/dev/null)
390
     data=$(tempfile 2>/dev/null)
391
     trap "rm -f $data" 0 1 2 5 15
391
     trap "rm -f $data" 0 1 2 5 15
392
     dialog --backtitle $"Freedombone Control Panel" \
392
     dialog --backtitle $"Freedombone Control Panel" \
520
     if [ ! $SELECTED_USERNAME ]; then
520
     if [ ! $SELECTED_USERNAME ]; then
521
         return
521
         return
522
     fi
522
     fi
523
-	restorestr=$"Restore GPG key for user"
523
+    restorestr=$"Restore GPG key for user"
524
     dialog --title "$restorestr $SELECTED_USERNAME" \
524
     dialog --title "$restorestr $SELECTED_USERNAME" \
525
            --msgbox $"Plug in your USB keydrive" 6 40
525
            --msgbox $"Plug in your USB keydrive" 6 40
526
     clear
526
     clear
684
     reboot
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
 function menu_backup_restore {
710
 function menu_backup_restore {
688
     while true
711
     while true
689
     do
712
     do
811
         trap "rm -f $data" 0 1 2 5 15
834
         trap "rm -f $data" 0 1 2 5 15
812
         dialog --backtitle $"Freedombone Control Panel" \
835
         dialog --backtitle $"Freedombone Control Panel" \
813
                --title $"Control Panel" \
836
                --title $"Control Panel" \
814
-               --radiolist $"Choose an operation:" 19 70 12 \
837
+               --radiolist $"Choose an operation:" 20 70 13 \
815
                1 $"Backup and Restore" off \
838
                1 $"Backup and Restore" off \
816
                2 $"Show SIP Phone Extensions" off \
839
                2 $"Show SIP Phone Extensions" off \
817
                3 $"Reset Tripwire" off \
840
                3 $"Reset Tripwire" off \
820
                6 $"Email Filtering Rules" off \
843
                6 $"Email Filtering Rules" off \
821
                7 $"Security Settings" off \
844
                7 $"Security Settings" off \
822
                8 $"Hubzilla" off \
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
         sel=$?
851
         sel=$?
828
         case $sel in
852
         case $sel in
829
             1) exit 1;;
853
             1) exit 1;;
838
             6) menu_email;;
862
             6) menu_email;;
839
             7) security_settings;;
863
             7) security_settings;;
840
             8) menu_hubzilla;;
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
         esac
870
         esac
846
     done
871
     done
847
 }
872
 }