Browse Source

Also change IRC password for users

Bob Mottram 9 years ago
parent
commit
0105c36e9b
1 changed files with 16 additions and 1 deletions
  1. 16
    1
      src/freedombone-controlpanel

+ 16
- 1
src/freedombone-controlpanel View File

646
     sel=$?
646
     sel=$?
647
     case $sel in
647
     case $sel in
648
         0)
648
         0)
649
+            EXISTING_IRC_PASSWORD=$(cat /etc/ngircd/ngircd.conf | grep "Password =" | head -n 1 | awk -F '=' '{print $2}')
649
             NEW_IRC_PASSWORD=$(<$data)
650
             NEW_IRC_PASSWORD=$(<$data)
650
             sed -i "0,/RE/s/Password =.*/Password =$NEW_IRC_PASSWORD/" /etc/ngircd/ngircd.conf
651
             sed -i "0,/RE/s/Password =.*/Password =$NEW_IRC_PASSWORD/" /etc/ngircd/ngircd.conf
652
+
653
+            # replace the password for all users
654
+            for d in /home/*/ ; do
655
+                IRC_USERNAME=$(echo "$d" | awk -F '/' '{print $3}')
656
+                if [[ $IRC_USERNAME != "git" && $IRC_USERNAME != "mirrors" ]]; then
657
+                    if [ -f /home/$IRC_USERNAME/.irssi/config ]; then
658
+                        sed -i "s|$EXISTING_IRC_PASSWORD|$NEW_IRC_PASSWORD|g" /home/$IRC_USERNAME/.irssi/config
659
+                        chown -R $IRC_USERNAME:$IRC_USERNAME /home/$IRC_USERNAME/.irssi
660
+                    fi                  
661
+                fi
662
+            fi
663
+
664
+            # restart the daemon for the new password to take effect
665
+            systemctl restart ngircd
666
+            
651
             dialog --title $"IRC Password" \
667
             dialog --title $"IRC Password" \
652
                    --msgbox $"The IRC password was changed" 6 40
668
                    --msgbox $"The IRC password was changed" 6 40
653
-            systemctl restart ngircd
654
             ;;
669
             ;;
655
     esac
670
     esac
656
 }
671
 }