Skip to content
Snippets Groups Projects
Commit 0105c36e authored by Bob Mottram's avatar Bob Mottram
Browse files

Also change IRC password for users

parent 6f5bb61a
No related branches found
No related tags found
No related merge requests found
......@@ -646,11 +646,26 @@ function irc_set_global_password {
sel=$?
case $sel in
0)
EXISTING_IRC_PASSWORD=$(cat /etc/ngircd/ngircd.conf | grep "Password =" | head -n 1 | awk -F '=' '{print $2}')
NEW_IRC_PASSWORD=$(<$data)
sed -i "0,/RE/s/Password =.*/Password =$NEW_IRC_PASSWORD/" /etc/ngircd/ngircd.conf
# replace the password for all users
for d in /home/*/ ; do
IRC_USERNAME=$(echo "$d" | awk -F '/' '{print $3}')
if [[ $IRC_USERNAME != "git" && $IRC_USERNAME != "mirrors" ]]; then
if [ -f /home/$IRC_USERNAME/.irssi/config ]; then
sed -i "s|$EXISTING_IRC_PASSWORD|$NEW_IRC_PASSWORD|g" /home/$IRC_USERNAME/.irssi/config
chown -R $IRC_USERNAME:$IRC_USERNAME /home/$IRC_USERNAME/.irssi
fi
fi
fi
# restart the daemon for the new password to take effect
systemctl restart ngircd
dialog --title $"IRC Password" \
--msgbox $"The IRC password was changed" 6 40
systemctl restart ngircd
;;
esac
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment