ソースを参照

Optional IRC password

Bob Mottram 9 年 前
コミット
b2084b8dc7
共有1 個のファイルを変更した9 個の追加0 個の削除を含む
  1. 9
    0
      src/freedombone

+ 9
- 0
src/freedombone ファイルの表示

@@ -85,6 +85,9 @@ CONFIGURATION_FILE="freedombone.cfg"
85 85
 SSH_PORT=2222
86 86
 IRC_PORT=6697
87 87
 
88
+# An optional password to log into IRC. This applies to all users
89
+IRC_PASSWORD=
90
+
88 91
 # If this file exists it contains a global password used with
89 92
 # disk image installs. This simplifies password management for
90 93
 # deployment at scale
@@ -868,6 +871,9 @@ function read_configuration {
868 871
       if [[ $CONFIGURATION_FILE != '/root/freedombone.cfg' ]]; then
869 872
           cp $CONFIGURATION_FILE /root/freedombone.cfg
870 873
       fi
874
+      if grep -q "IRC_PASSWORD" $CONFIGURATION_FILE; then
875
+          IRC_PASSWORD=$(grep "IRC_PASSWORD" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
876
+      fi
871 877
       if grep -q "DEFAULT_LANGUAGE" $CONFIGURATION_FILE; then
872 878
           DEFAULT_LANGUAGE=$(grep "DEFAULT_LANGUAGE" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
873 879
       fi
@@ -6689,6 +6695,9 @@ function install_irc_server {
6689 6695
   sed -i 's/;RequireAuthPing = no/RequireAuthPing = no/g' /etc/ngircd/ngircd.conf
6690 6696
   sed -i "s/;Name = TheOper/Name = $MY_USERNAME/g" /etc/ngircd/ngircd.conf
6691 6697
   sed -i "s/;Password = ThePwd/Password = $IRC_OPERATOR_PASSWORD/g" /etc/ngircd/ngircd.conf
6698
+  if [ $IRC_PASSWORD ]; then
6699
+      sed -i "0,/RE/s/Password =.*/Password = $IRC_PASSWORD/" /etc/ngircd/ngircd.conf
6700
+  fi
6692 6701
   # If we are on a mesh then DNS is not available
6693 6702
   if [[ $SYSTEM_TYPE == "$VARIANT_MESH" ]]; then
6694 6703
       sed -i "s/;DNS =.*/DNS = no/g" /etc/ngircd/ngircd.conf