freedombone-app-irc 19KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465
  1. #!/bin/bash
  2. #
  3. # .---. . .
  4. # | | |
  5. # |--- .--. .-. .-. .-.| .-. .--.--. |.-. .-. .--. .-.
  6. # | | (.-' (.-' ( | ( )| | | | )( )| | (.-'
  7. # ' ' --' --' -' - -' ' ' -' -' -' ' - --'
  8. #
  9. # Freedom in the Cloud
  10. #
  11. # IRC server application
  12. #
  13. # License
  14. # =======
  15. #
  16. # Copyright (C) 2014-2016 Bob Mottram <bob@robotics.uk.to>
  17. #
  18. # This program is free software: you can redistribute it and/or modify
  19. # it under the terms of the GNU Affero General Public License as published by
  20. # the Free Software Foundation, either version 3 of the License, or
  21. # (at your option) any later version.
  22. #
  23. # This program is distributed in the hope that it will be useful,
  24. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  25. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  26. # GNU Affero General Public License for more details.
  27. #
  28. # You should have received a copy of the GNU Affero General Public License
  29. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  30. VARIANTS='full chat'
  31. IRC_PORT=6697
  32. IRC_ONION_PORT=6697
  33. # An optional password to log into IRC. This applies to all users
  34. IRC_PASSWORD=
  35. irc_variables=(MY_USERNAME
  36. MY_NAME
  37. IRC_PORT
  38. IRC_PASSWORD
  39. DEFAULT_DOMAIN_NAME
  40. INSTALLED_WITHIN_DOCKER
  41. ONION_ONLY)
  42. function remove_user_irc {
  43. remove_username="$1"
  44. if [ -d /home/${remove_username}/.irssi ]; then
  45. rm -rf /home/${remove_username}/.irssi
  46. fi
  47. if [ -d /home/${remove_username}/irclogs ]; then
  48. rm -rf /home/${remove_username}/irclogs
  49. fi
  50. }
  51. function add_user_irc {
  52. new_username="$1"
  53. new_user_password="$2"
  54. IRC_PASSWORD=$(cat /etc/ngircd/ngircd.conf | grep "Password =" | head -n 1 | awk -F '=' '{print $2}')
  55. if [ ${#IRC_PASSWORD} -lt 2 ]; then
  56. IRC_PASSWORD=
  57. fi
  58. if [ ! -d /home/${new_username}/.irssi ]; then
  59. mkdir /home/${new_username}/.irssi
  60. fi
  61. echo 'servers = (' > /home/${new_username}/.irssi/config
  62. echo ' {' >> /home/${new_username}/.irssi/config
  63. echo ' address = "chat.freenode.net";' >> /home/${new_username}/.irssi/config
  64. echo ' chatnet = "Freenode";' >> /home/${new_username}/.irssi/config
  65. echo ' port = "6667";' >> /home/${new_username}/.irssi/config
  66. echo ' autoconnect = "no";' >> /home/${new_username}/.irssi/config
  67. echo ' },' >> /home/${new_username}/.irssi/config
  68. echo ' {' >> /home/${new_username}/.irssi/config
  69. echo ' address = "irc.oftc.net";' >> /home/${new_username}/.irssi/config
  70. echo ' chatnet = "OFTC";' >> /home/${new_username}/.irssi/config
  71. echo ' port = "6667";' >> /home/${new_username}/.irssi/config
  72. echo ' autoconnect = "yes";' >> /home/${new_username}/.irssi/config
  73. echo ' },' >> /home/${new_username}/.irssi/config
  74. echo ' {' >> /home/${new_username}/.irssi/config
  75. echo " address = \"${HOSTNAME}\";" >> /home/${new_username}/.irssi/config
  76. echo ' chatnet = "Freedombone";' >> /home/${new_username}/.irssi/config
  77. echo " port = \"${IRC_PORT}\";" >> /home/${new_username}/.irssi/config
  78. echo ' use_ssl = "yes";' >> /home/${new_username}/.irssi/config
  79. echo ' ssl_verify = "no";' >> /home/${new_username}/.irssi/config
  80. echo ' autoconnect = "yes";' >> /home/${new_username}/.irssi/config
  81. echo ' }' >> /home/${new_username}/.irssi/config
  82. echo ');' >> /home/${new_username}/.irssi/config
  83. echo '' >> /home/${new_username}/.irssi/config
  84. echo 'chatnets = {' >> /home/${new_username}/.irssi/config
  85. echo ' Freedombone = {' >> /home/${new_username}/.irssi/config
  86. echo ' type = "IRC";' >> /home/${new_username}/.irssi/config
  87. echo ' max_kicks = "1";' >> /home/${new_username}/.irssi/config
  88. echo ' max_msgs = "4";' >> /home/${new_username}/.irssi/config
  89. echo ' max_whois = "1";' >> /home/${new_username}/.irssi/config
  90. echo ' };' >> /home/${new_username}/.irssi/config
  91. echo ' Freenode = {' >> /home/${new_username}/.irssi/config
  92. echo ' type = "IRC";' >> /home/${new_username}/.irssi/config
  93. echo ' max_kicks = "1";' >> /home/${new_username}/.irssi/config
  94. echo ' max_msgs = "4";' >> /home/${new_username}/.irssi/config
  95. echo ' max_whois = "1";' >> /home/${new_username}/.irssi/config
  96. echo ' };' >> /home/${new_username}/.irssi/config
  97. echo ' OFTC = {' >> /home/${new_username}/.irssi/config
  98. echo ' type = "IRC";' >> /home/${new_username}/.irssi/config
  99. echo ' max_kicks = "1";' >> /home/${new_username}/.irssi/config
  100. echo ' max_msgs = "1";' >> /home/${new_username}/.irssi/config
  101. echo ' max_whois = "1";' >> /home/${new_username}/.irssi/config
  102. echo ' };' >> /home/${new_username}/.irssi/config
  103. echo '};' >> /home/${new_username}/.irssi/config
  104. echo '' >> /home/${new_username}/.irssi/config
  105. echo 'channels = (' >> /home/${new_username}/.irssi/config
  106. echo ' { name = "#freedombone"; chatnet = "Freedombone"; autojoin = "Yes"; },' >> /home/${new_username}/.irssi/config
  107. echo ');' >> /home/${new_username}/.irssi/config
  108. echo '' >> /home/${new_username}/.irssi/config
  109. echo 'settings = {' >> /home/${new_username}/.irssi/config
  110. echo " core = { real_name = \"$MY_NAME\"; user_name = \"$new_username\"; nick = \"$new_username\"; };" >> /home/${new_username}/.irssi/config
  111. echo ' "fe-text" = { actlist_sort = "refnum"; };' >> /home/${new_username}/.irssi/config
  112. echo '};' >> /home/$new_username/.irssi/config
  113. echo 'ignores = ( { level = "CTCPS"; } );' >> /home/${new_username}/.irssi/config
  114. chown -R ${new_username}:${new_username} /home/${new_username}/.irssi
  115. echo '0'
  116. }
  117. function run_client_irc {
  118. irssi
  119. }
  120. function irc_show_password {
  121. IRC_PASSWORD=$(cat /etc/ngircd/ngircd.conf | grep "Password =" | head -n 1 | awk -F '=' '{print $2}')
  122. dialog --title $"IRC Password" \
  123. --msgbox "$IRC_PASSWORD" 6 40
  124. }
  125. function irc_set_global_password {
  126. dialog --title $"IRC Password" \
  127. --clear \
  128. --backtitle $"Freedombone Control Panel" \
  129. --passwordbox $"Password for all IRC users, or press Enter for no password" 10 50 2> $data
  130. sel=$?
  131. case $sel in
  132. 0)
  133. EXISTING_IRC_PASSWORD=$(cat /etc/ngircd/ngircd.conf | grep "Password =" | head -n 1 | awk -F '=' '{print $2}')
  134. NEW_IRC_PASSWORD=$(<$data)
  135. sed -i "0,/RE/s/Password =.*/Password =$NEW_IRC_PASSWORD/" /etc/ngircd/ngircd.conf
  136. # replace the password for all users
  137. for d in /home/*/ ; do
  138. IRC_USERNAME=$(echo "$d" | awk -F '/' '{print $3}')
  139. if [[ $(is_valid_user "$IRC_USERNAME") == "1" ]]; then
  140. if [ -f /home/${IRC_USERNAME}/.irssi/config ]; then
  141. sed -i "s|$EXISTING_IRC_PASSWORD|$NEW_IRC_PASSWORD|g" /home/${IRC_USERNAME}/.irssi/config
  142. chown -R ${IRC_USERNAME}:${IRC_USERNAME} /home/${IRC_USERNAME}/.irssi
  143. fi
  144. fi
  145. done
  146. # restart the daemon for the new password to take effect
  147. systemctl restart ngircd
  148. dialog --title $"IRC Password" \
  149. --msgbox $"The IRC password was changed" 6 40
  150. ;;
  151. esac
  152. }
  153. function configure_interactive_irc {
  154. if [ ! -d /etc/ngircd ]; then
  155. dialog --title $"IRC Menu" \
  156. --msgbox $"No IRC server is installed" 6 70
  157. return
  158. fi
  159. while true
  160. do
  161. data=$(tempfile 2>/dev/null)
  162. trap "rm -f $data" 0 1 2 5 15
  163. dialog --backtitle $"Freedombone Control Panel" \
  164. --title $"IRC Menu" \
  165. --radiolist $"Choose an operation:" 14 70 4 \
  166. 1 $"Set a password for all IRC users" off \
  167. 2 $"Show current IRC login password" off \
  168. 3 $"Exit" on 2> $data
  169. sel=$?
  170. case $sel in
  171. 1) break;;
  172. 255) break;;
  173. esac
  174. case $(cat $data) in
  175. 1) irc_set_global_password;;
  176. 2) irc_show_password;;
  177. 3) break;;
  178. esac
  179. done
  180. }
  181. function install_interactive_irc {
  182. echo -n ''
  183. APP_INSTALLED=1
  184. }
  185. function change_password_irc {
  186. echo -n ''
  187. }
  188. function reconfigure_irc {
  189. echo -n ''
  190. }
  191. function upgrade_irc {
  192. echo -n ''
  193. }
  194. function backup_local_irc {
  195. echo -n ''
  196. }
  197. function restore_local_irc {
  198. echo -n ''
  199. }
  200. function backup_remote_irc {
  201. echo -n ''
  202. }
  203. function restore_remote_irc {
  204. echo -n ''
  205. }
  206. function remove_irc {
  207. if [[ $(app_is_installed irc) == "0" ]]; then
  208. return
  209. fi
  210. remove_watchdog_daemon ngircd
  211. systemctl stop ngircd
  212. apt-get -y remove --purge ngircd
  213. apt-get -y remove --purge irssi
  214. if [ -d /etc/ngircd ]; then
  215. rm -rf /etc/ngircd
  216. fi
  217. iptables -D INPUT -p tcp --dport ${IRC_PORT} -j ACCEPT
  218. iptables -D INPUT -p tcp --dport 1024:65535 --sport ${IRC_PORT} -j ACCEPT
  219. function_check save_firewall_settings
  220. save_firewall_settings
  221. function_check remove_onion_service
  222. remove_onion_service irc ${IRC_ONION_PORT}
  223. sed -i '/install_irc/d' ${COMPLETION_FILE}
  224. sed -i '/IRC /d' ${COMPLETION_FILE}
  225. sed -i '/configure_firewall_for_irc/d' ${COMPLETION_FILE}
  226. }
  227. function configure_firewall_for_irc {
  228. if [ ! -d /etc/ngircd ]; then
  229. return
  230. fi
  231. if grep -Fxq "configure_firewall_for_irc" ${COMPLETION_FILE}; then
  232. return
  233. fi
  234. if [[ ${INSTALLED_WITHIN_DOCKER} == "yes" ]]; then
  235. # docker does its own firewalling
  236. return
  237. fi
  238. if [[ ${ONION_ONLY} != "no" ]]; then
  239. return
  240. fi
  241. iptables -A INPUT -p tcp --dport ${IRC_PORT} -j ACCEPT
  242. iptables -I INPUT -p tcp --dport 1024:65535 --sport ${IRC_PORT} -j ACCEPT
  243. function_check save_firewall_settings
  244. save_firewall_settings
  245. OPEN_PORTS+=("IRC $IRC_PORT")
  246. echo 'configure_firewall_for_irc' >> ${COMPLETION_FILE}
  247. }
  248. function install_irc_server {
  249. if [[ $(app_is_installed irc_server) == "1" ]]; then
  250. return
  251. fi
  252. apt-get -y install ngircd
  253. if [ ! -d /etc/ngircd ]; then
  254. echo $"ERROR: ngircd does not appear to have installed. $CHECK_MESSAGE"
  255. exit 53
  256. fi
  257. if [ ! -f /etc/ssl/certs/ngircd.dhparam ]; then
  258. ${PROJECT_NAME}-addcert -h ngircd --dhkey ${DH_KEYLENGTH}
  259. function_check check_certificates
  260. check_certificates ngircd
  261. fi
  262. DEFAULTDOMAIN=${DEFAULT_DOMAIN_NAME}
  263. # create a login password if needed
  264. if [ ! ${IRC_PASSWORD} ]; then
  265. IRC_PASSWORD="$(create_password ${MINIMUM_PASSWORD_LENGTH})"
  266. fi
  267. echo '**************************************************' > /etc/ngircd/motd
  268. echo $'* F R E E D O M B O N E I R C *' >> /etc/ngircd/motd
  269. echo '* *' >> /etc/ngircd/motd
  270. echo $'* Freedom in the Cloud *' >> /etc/ngircd/motd
  271. echo '**************************************************' >> /etc/ngircd/motd
  272. sed -i 's|MotdFile = /etc/ngircd/ngircd.motd|MotdFile = /etc/ngircd/motd|g' /etc/ngircd/ngircd.conf
  273. sed -i "s/irc@irc.example.com/$MY_EMAIL_ADDRESS/g" /etc/ngircd/ngircd.conf
  274. sed -i "s/irc.example.net/$DEFAULTDOMAIN/g" /etc/ngircd/ngircd.conf
  275. sed -i "s|Yet another IRC Server running on Debian GNU/Linux|IRC Server of $DEFAULTDOMAIN|g" /etc/ngircd/ngircd.conf
  276. sed -i 's/;Password = wealllikedebian/Password =/g' /etc/ngircd/ngircd.conf
  277. sed -i 's|;CertFile = /etc/ssl/certs/server.crt|CertFile = /etc/ssl/certs/ngircd.crt|g' /etc/ngircd/ngircd.conf
  278. sed -i 's|;DHFile = /etc/ngircd/dhparams.pem|DHFile = /etc/ssl/certs/ngircd.dhparam|g' /etc/ngircd/ngircd.conf
  279. sed -i 's|;KeyFile = /etc/ssl/private/server.key|KeyFile = /etc/ssl/private/ngircd.key|g' /etc/ngircd/ngircd.conf
  280. sed -i "s/;Ports =.*/Ports = ${IRC_PORT}/1" /etc/ngircd/ngircd.conf
  281. sed -i "s/;Ports =.*/Ports = ${IRC_PORT}/2" /etc/ngircd/ngircd.conf
  282. sed -i "s/;Name = #ngircd/Name = #${PROJECT_NAME}/g" /etc/ngircd/ngircd.conf
  283. sed -i "s/;Topic = Our ngircd testing channel/Topic = ${PROJECT_NAME} chat channel/g" /etc/ngircd/ngircd.conf
  284. sed -i 's/;MaxUsers = 23/MaxUsers = 23/g' /etc/ngircd/ngircd.conf
  285. sed -i "s|;KeyFile = /etc/ngircd/#chan.key|KeyFile = /etc/ngircd/#${PROJECT_NAME}.key|g" /etc/ngircd/ngircd.conf
  286. sed -i "s/;CloakHost = cloaked.host/CloakHost = ${PROJECT_NAME}/g" /etc/ngircd/ngircd.conf
  287. IRC_SALT="$(create_password 30)"
  288. if [ -f ${IMAGE_PASSWORD_FILE} ]; then
  289. IRC_OPERATOR_PASSWORD="$(printf `cat $IMAGE_PASSWORD_FILE`)"
  290. else
  291. IRC_OPERATOR_PASSWORD="$(create_password ${MINIMUM_PASSWORD_LENGTH})"
  292. fi
  293. sed -i "s|;CloakHostSalt = abcdefghijklmnopqrstuvwxyz|CloakHostSalt = $IRC_SALT|g" /etc/ngircd/ngircd.conf
  294. sed -i 's/;ConnectIPv4 = yes/ConnectIPv4 = yes/g' /etc/ngircd/ngircd.conf
  295. sed -i 's/;MorePrivacy = no/MorePrivacy = yes/g' /etc/ngircd/ngircd.conf
  296. sed -i 's/;RequireAuthPing = no/RequireAuthPing = no/g' /etc/ngircd/ngircd.conf
  297. sed -i "s/;Name = TheOper/Name = $MY_USERNAME/g" /etc/ngircd/ngircd.conf
  298. sed -i "s/;Password = ThePwd/Password = $IRC_OPERATOR_PASSWORD/g" /etc/ngircd/ngircd.conf
  299. sed -i 's|;Listen =.*|Listen = 0.0.0.0,0.0.0.0:9050,127.0.0.1,127.0.0.1:9050|g' /etc/ngircd/ngircd.conf
  300. if [ ${IRC_PASSWORD} ]; then
  301. sed -i "0,/RE/s/Password =.*/Password =$IRC_PASSWORD/" /etc/ngircd/ngircd.conf
  302. fi
  303. # upgrade a cypher
  304. sed -i 's|SECURE128|SECURE256|g' /etc/ngircd/ngircd.conf
  305. mkdir /var/run/ircd
  306. chown -R irc:irc /var/run/ircd
  307. mkdir /var/run/ngircd
  308. touch /var/run/ngircd/ngircd.pid
  309. chown -R irc:irc /var/run/ngircd
  310. IRC_ONION_HOSTNAME=$(add_onion_service irc ${IRC_PORT} ${IRC_ONION_PORT})
  311. systemctl restart ngircd
  312. add_watchdog_daemon ngircd
  313. if ! grep -q $"IRC Server" /home/${MY_USERNAME}/README; then
  314. echo '' >> /home/${MY_USERNAME}/README
  315. echo '' >> /home/${MY_USERNAME}/README
  316. echo $'IRC Server' >> /home/${MY_USERNAME}/README
  317. echo '==========' >> /home/${MY_USERNAME}/README
  318. echo $'To connect to your IRC server in irssi:' >> /home/${MY_USERNAME}/README
  319. echo '' >> /home/${MY_USERNAME}/README
  320. if [[ ${ONION_ONLY} != 'yes' ]]; then
  321. echo " irssi" >> /home/${MY_USERNAME}/README
  322. echo " /server add -auto -ssl $DEFAULTDOMAIN $IRC_PORT" >> /home/${MY_USERNAME}/README
  323. echo " /connect $DEFAULT_DOMAIN_NAME" >> /home/${MY_USERNAME}/README
  324. else
  325. echo " usetorwith irssi" >> /home/${MY_USERNAME}/README
  326. echo " /server add -auto $IRC_ONION_HOSTNAME $IRC_PORT" >> /home/${MY_USERNAME}/README
  327. echo " /connect $IRC_ONION_HOSTNAME" >> /home/${MY_USERNAME}/README
  328. fi
  329. echo " /join #${PROJECT_NAME}" >> /home/${MY_USERNAME}/README
  330. chown ${MY_USERNAME}:${MY_USERNAME} /home/${MY_USERNAME}/README
  331. chmod 600 /home/${MY_USERNAME}/README
  332. fi
  333. function_check configure_firewall_for_irc
  334. configure_firewall_for_irc
  335. install_completed irc_server
  336. }
  337. function install_irc_client {
  338. if [[ $(app_is_installed irc_client) == "1" ]]; then
  339. return
  340. fi
  341. apt-get -y install irssi
  342. if [ ! -d /home/${MY_USERNAME}/.irssi ]; then
  343. mkdir /home/${MY_USERNAME}/.irssi
  344. fi
  345. echo 'servers = (' > /home/${MY_USERNAME}/.irssi/config
  346. echo ' {' >> /home/${MY_USERNAME}/.irssi/config
  347. echo ' address = "chat.freenode.net";' >> /home/${MY_USERNAME}/.irssi/config
  348. echo ' chatnet = "Freenode";' >> /home/${MY_USERNAME}/.irssi/config
  349. echo ' port = "6667";' >> /home/${MY_USERNAME}/.irssi/config
  350. echo ' autoconnect = "no";' >> /home/${MY_USERNAME}/.irssi/config
  351. echo ' },' >> /home/${MY_USERNAME}/.irssi/config
  352. echo ' {' >> /home/${MY_USERNAME}/.irssi/config
  353. echo ' address = "irc.oftc.net";' >> /home/${MY_USERNAME}/.irssi/config
  354. echo ' chatnet = "OFTC";' >> /home/${MY_USERNAME}/.irssi/config
  355. echo ' port = "6667";' >> /home/${MY_USERNAME}/.irssi/config
  356. echo ' autoconnect = "yes";' >> /home/${MY_USERNAME}/.irssi/config
  357. echo ' },' >> /home/${MY_USERNAME}/.irssi/config
  358. echo ' {' >> /home/${MY_USERNAME}/.irssi/config
  359. echo " address = \"127.0.0.1\";" >> /home/${MY_USERNAME}/.irssi/config
  360. if [[ ${ONION_ONLY} == 'no' ]]; then
  361. echo " port = \"${IRC_PORT}\";" >> /home/${MY_USERNAME}/.irssi/config
  362. echo ' use_ssl = "yes";' >> /home/${MY_USERNAME}/.irssi/config
  363. else
  364. IRC_ONION_HOSTNAME=$(cat ${COMPLETION_FILE} | grep "irc onion domain" | awk -F ':' '{print $2}')
  365. echo " port = \"${IRC_ONION_PORT}\";" >> /home/${MY_USERNAME}/.irssi/config
  366. echo ' use_ssl = "no";' >> /home/${MY_USERNAME}/.irssi/config
  367. fi
  368. echo ' chatnet = "Freedombone";' >> /home/${MY_USERNAME}/.irssi/config
  369. echo ' ssl_verify = "no";' >> /home/${MY_USERNAME}/.irssi/config
  370. echo ' autoconnect = "yes";' >> /home/${MY_USERNAME}/.irssi/config
  371. if [ ${IRC_PASSWORD} ]; then
  372. echo " password = \"${IRC_PASSWORD}\";" >> /home/${MY_USERNAME}/.irssi/config
  373. fi
  374. echo ' }' >> /home/${MY_USERNAME}/.irssi/config
  375. echo ');' >> /home/${MY_USERNAME}/.irssi/config
  376. echo '' >> /home/${MY_USERNAME}/.irssi/config
  377. echo 'chatnets = {' >> /home/${MY_USERNAME}/.irssi/config
  378. echo ' Freedombone = {' >> /home/${MY_USERNAME}/.irssi/config
  379. echo ' type = "IRC";' >> /home/${MY_USERNAME}/.irssi/config
  380. echo ' max_kicks = "1";' >> /home/${MY_USERNAME}/.irssi/config
  381. echo ' max_msgs = "4";' >> /home/${MY_USERNAME}/.irssi/config
  382. echo ' max_whois = "1";' >> /home/${MY_USERNAME}/.irssi/config
  383. echo ' };' >> /home/${MY_USERNAME}/.irssi/config
  384. echo ' Freenode = {' >> /home/${MY_USERNAME}/.irssi/config
  385. echo ' type = "IRC";' >> /home/${MY_USERNAME}/.irssi/config
  386. echo ' max_kicks = "1";' >> /home/${MY_USERNAME}/.irssi/config
  387. echo ' max_msgs = "4";' >> /home/${MY_USERNAME}/.irssi/config
  388. echo ' max_whois = "1";' >> /home/${MY_USERNAME}/.irssi/config
  389. echo ' };' >> /home/${MY_USERNAME}/.irssi/config
  390. echo ' OFTC = {' >> /home/${MY_USERNAME}/.irssi/config
  391. echo ' type = "IRC";' >> /home/${MY_USERNAME}/.irssi/config
  392. echo ' max_kicks = "1";' >> /home/${MY_USERNAME}/.irssi/config
  393. echo ' max_msgs = "1";' >> /home/${MY_USERNAME}/.irssi/config
  394. echo ' max_whois = "1";' >> /home/${MY_USERNAME}/.irssi/config
  395. echo ' };' >> /home/${MY_USERNAME}/.irssi/config
  396. echo '};' >> /home/${MY_USERNAME}/.irssi/config
  397. echo '' >> /home/${MY_USERNAME}/.irssi/config
  398. echo 'channels = (' >> /home/${MY_USERNAME}/.irssi/config
  399. echo ' { name = "#freedombone"; chatnet = "Freedombone"; autojoin = "Yes"; },' >> /home/${MY_USERNAME}/.irssi/config
  400. echo ');' >> /home/${MY_USERNAME}/.irssi/config
  401. echo '' >> /home/${MY_USERNAME}/.irssi/config
  402. echo 'settings = {' >> /home/${MY_USERNAME}/.irssi/config
  403. echo " core = { real_name = \"$MY_NAME\"; user_name = \"$MY_USERNAME\"; nick = \"$MY_USERNAME\"; };" >> /home/${MY_USERNAME}/.irssi/config
  404. echo ' "fe-text" = { actlist_sort = "refnum"; };' >> /home/${MY_USERNAME}/.irssi/config
  405. echo '};' >> /home/${MY_USERNAME}/.irssi/config
  406. echo 'ignores = ( { level = "CTCPS"; } );' >> /home/${MY_USERNAME}/.irssi/config
  407. chown -R ${MY_USERNAME}:${MY_USERNAME} /home/${MY_USERNAME}/.irssi
  408. install_completed irc_client
  409. }
  410. function install_irc {
  411. install_irc_server
  412. install_irc_client
  413. APP_INSTALLED=1
  414. }
  415. # NOTE: deliberately no exit 0