freedombone-app-irc 19KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462
  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 full-vim 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. remove_watchdog_daemon ngircd
  208. systemctl stop ngircd
  209. apt-get -y remove --purge ngircd
  210. apt-get -y remove --purge irssi
  211. if [ -d /etc/ngircd ]; then
  212. rm -rf /etc/ngircd
  213. fi
  214. iptables -D INPUT -p tcp --dport ${IRC_PORT} -j ACCEPT
  215. iptables -D INPUT -p tcp --dport 1024:65535 --sport ${IRC_PORT} -j ACCEPT
  216. function_check save_firewall_settings
  217. save_firewall_settings
  218. function_check remove_onion_service
  219. remove_onion_service irc ${IRC_ONION_PORT}
  220. remove_completion_param install_irc
  221. remove_completion_param configure_firewall_for_irc
  222. sed -i '/IRC /d' ${COMPLETION_FILE}
  223. }
  224. function configure_firewall_for_irc {
  225. if [ ! -d /etc/ngircd ]; then
  226. return
  227. fi
  228. if [[ $(is_completed $FUNCNAME) == "1" ]]; then
  229. return
  230. fi
  231. if [[ ${INSTALLED_WITHIN_DOCKER} == "yes" ]]; then
  232. # docker does its own firewalling
  233. return
  234. fi
  235. if [[ ${ONION_ONLY} != "no" ]]; then
  236. return
  237. fi
  238. iptables -A INPUT -p tcp --dport ${IRC_PORT} -j ACCEPT
  239. iptables -I INPUT -p tcp --dport 1024:65535 --sport ${IRC_PORT} -j ACCEPT
  240. function_check save_firewall_settings
  241. save_firewall_settings
  242. OPEN_PORTS+=("IRC $IRC_PORT")
  243. echo 'configure_firewall_for_irc' >> ${COMPLETION_FILE}
  244. }
  245. function install_irc_server {
  246. if [[ $(app_is_installed irc_server) == "1" ]]; then
  247. return
  248. fi
  249. apt-get -y install ngircd
  250. if [ ! -d /etc/ngircd ]; then
  251. echo $"ERROR: ngircd does not appear to have installed. $CHECK_MESSAGE"
  252. exit 53
  253. fi
  254. if [ ! -f /etc/ssl/certs/ngircd.dhparam ]; then
  255. ${PROJECT_NAME}-addcert -h ngircd --dhkey ${DH_KEYLENGTH}
  256. function_check check_certificates
  257. check_certificates ngircd
  258. fi
  259. DEFAULTDOMAIN=${DEFAULT_DOMAIN_NAME}
  260. # create a login password if needed
  261. if [ ! ${IRC_PASSWORD} ]; then
  262. IRC_PASSWORD="$(create_password ${MINIMUM_PASSWORD_LENGTH})"
  263. fi
  264. echo '**************************************************' > /etc/ngircd/motd
  265. echo $'* F R E E D O M B O N E I R C *' >> /etc/ngircd/motd
  266. echo '* *' >> /etc/ngircd/motd
  267. echo $'* Freedom in the Cloud *' >> /etc/ngircd/motd
  268. echo '**************************************************' >> /etc/ngircd/motd
  269. sed -i 's|MotdFile = /etc/ngircd/ngircd.motd|MotdFile = /etc/ngircd/motd|g' /etc/ngircd/ngircd.conf
  270. sed -i "s/irc@irc.example.com/$MY_EMAIL_ADDRESS/g" /etc/ngircd/ngircd.conf
  271. sed -i "s/irc.example.net/$DEFAULTDOMAIN/g" /etc/ngircd/ngircd.conf
  272. sed -i "s|Yet another IRC Server running on Debian GNU/Linux|IRC Server of $DEFAULTDOMAIN|g" /etc/ngircd/ngircd.conf
  273. sed -i 's/;Password = wealllikedebian/Password =/g' /etc/ngircd/ngircd.conf
  274. sed -i 's|;CertFile = /etc/ssl/certs/server.crt|CertFile = /etc/ssl/certs/ngircd.crt|g' /etc/ngircd/ngircd.conf
  275. sed -i 's|;DHFile = /etc/ngircd/dhparams.pem|DHFile = /etc/ssl/certs/ngircd.dhparam|g' /etc/ngircd/ngircd.conf
  276. sed -i 's|;KeyFile = /etc/ssl/private/server.key|KeyFile = /etc/ssl/private/ngircd.key|g' /etc/ngircd/ngircd.conf
  277. sed -i "s/;Ports =.*/Ports = ${IRC_PORT}/1" /etc/ngircd/ngircd.conf
  278. sed -i "s/;Ports =.*/Ports = ${IRC_PORT}/2" /etc/ngircd/ngircd.conf
  279. sed -i "s/;Name = #ngircd/Name = #${PROJECT_NAME}/g" /etc/ngircd/ngircd.conf
  280. sed -i "s/;Topic = Our ngircd testing channel/Topic = ${PROJECT_NAME} chat channel/g" /etc/ngircd/ngircd.conf
  281. sed -i 's/;MaxUsers = 23/MaxUsers = 23/g' /etc/ngircd/ngircd.conf
  282. sed -i "s|;KeyFile = /etc/ngircd/#chan.key|KeyFile = /etc/ngircd/#${PROJECT_NAME}.key|g" /etc/ngircd/ngircd.conf
  283. sed -i "s/;CloakHost = cloaked.host/CloakHost = ${PROJECT_NAME}/g" /etc/ngircd/ngircd.conf
  284. IRC_SALT="$(create_password 30)"
  285. if [ -f ${IMAGE_PASSWORD_FILE} ]; then
  286. IRC_OPERATOR_PASSWORD="$(printf `cat $IMAGE_PASSWORD_FILE`)"
  287. else
  288. IRC_OPERATOR_PASSWORD="$(create_password ${MINIMUM_PASSWORD_LENGTH})"
  289. fi
  290. sed -i "s|;CloakHostSalt = abcdefghijklmnopqrstuvwxyz|CloakHostSalt = $IRC_SALT|g" /etc/ngircd/ngircd.conf
  291. sed -i 's/;ConnectIPv4 = yes/ConnectIPv4 = yes/g' /etc/ngircd/ngircd.conf
  292. sed -i 's/;MorePrivacy = no/MorePrivacy = yes/g' /etc/ngircd/ngircd.conf
  293. sed -i 's/;RequireAuthPing = no/RequireAuthPing = no/g' /etc/ngircd/ngircd.conf
  294. sed -i "s/;Name = TheOper/Name = $MY_USERNAME/g" /etc/ngircd/ngircd.conf
  295. sed -i "s/;Password = ThePwd/Password = $IRC_OPERATOR_PASSWORD/g" /etc/ngircd/ngircd.conf
  296. 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
  297. if [ ${IRC_PASSWORD} ]; then
  298. sed -i "0,/RE/s/Password =.*/Password =$IRC_PASSWORD/" /etc/ngircd/ngircd.conf
  299. fi
  300. # upgrade a cypher
  301. sed -i 's|SECURE128|SECURE256|g' /etc/ngircd/ngircd.conf
  302. mkdir /var/run/ircd
  303. chown -R irc:irc /var/run/ircd
  304. mkdir /var/run/ngircd
  305. touch /var/run/ngircd/ngircd.pid
  306. chown -R irc:irc /var/run/ngircd
  307. IRC_ONION_HOSTNAME=$(add_onion_service irc ${IRC_PORT} ${IRC_ONION_PORT})
  308. systemctl restart ngircd
  309. add_watchdog_daemon ngircd
  310. if ! grep -q $"IRC Server" /home/${MY_USERNAME}/README; then
  311. echo '' >> /home/${MY_USERNAME}/README
  312. echo '' >> /home/${MY_USERNAME}/README
  313. echo $'IRC Server' >> /home/${MY_USERNAME}/README
  314. echo '==========' >> /home/${MY_USERNAME}/README
  315. echo $'To connect to your IRC server in irssi:' >> /home/${MY_USERNAME}/README
  316. echo '' >> /home/${MY_USERNAME}/README
  317. if [[ ${ONION_ONLY} != 'yes' ]]; then
  318. echo " irssi" >> /home/${MY_USERNAME}/README
  319. echo " /server add -auto -ssl $DEFAULTDOMAIN $IRC_PORT" >> /home/${MY_USERNAME}/README
  320. echo " /connect $DEFAULT_DOMAIN_NAME" >> /home/${MY_USERNAME}/README
  321. else
  322. echo " usetorwith irssi" >> /home/${MY_USERNAME}/README
  323. echo " /server add -auto $IRC_ONION_HOSTNAME $IRC_PORT" >> /home/${MY_USERNAME}/README
  324. echo " /connect $IRC_ONION_HOSTNAME" >> /home/${MY_USERNAME}/README
  325. fi
  326. echo " /join #${PROJECT_NAME}" >> /home/${MY_USERNAME}/README
  327. chown ${MY_USERNAME}:${MY_USERNAME} /home/${MY_USERNAME}/README
  328. chmod 600 /home/${MY_USERNAME}/README
  329. fi
  330. function_check configure_firewall_for_irc
  331. configure_firewall_for_irc
  332. install_completed irc_server
  333. }
  334. function install_irc_client {
  335. if [[ $(app_is_installed irc_client) == "1" ]]; then
  336. return
  337. fi
  338. apt-get -y install irssi
  339. if [ ! -d /home/${MY_USERNAME}/.irssi ]; then
  340. mkdir /home/${MY_USERNAME}/.irssi
  341. fi
  342. echo 'servers = (' > /home/${MY_USERNAME}/.irssi/config
  343. echo ' {' >> /home/${MY_USERNAME}/.irssi/config
  344. echo ' address = "chat.freenode.net";' >> /home/${MY_USERNAME}/.irssi/config
  345. echo ' chatnet = "Freenode";' >> /home/${MY_USERNAME}/.irssi/config
  346. echo ' port = "6667";' >> /home/${MY_USERNAME}/.irssi/config
  347. echo ' autoconnect = "no";' >> /home/${MY_USERNAME}/.irssi/config
  348. echo ' },' >> /home/${MY_USERNAME}/.irssi/config
  349. echo ' {' >> /home/${MY_USERNAME}/.irssi/config
  350. echo ' address = "irc.oftc.net";' >> /home/${MY_USERNAME}/.irssi/config
  351. echo ' chatnet = "OFTC";' >> /home/${MY_USERNAME}/.irssi/config
  352. echo ' port = "6667";' >> /home/${MY_USERNAME}/.irssi/config
  353. echo ' autoconnect = "yes";' >> /home/${MY_USERNAME}/.irssi/config
  354. echo ' },' >> /home/${MY_USERNAME}/.irssi/config
  355. echo ' {' >> /home/${MY_USERNAME}/.irssi/config
  356. echo " address = \"127.0.0.1\";" >> /home/${MY_USERNAME}/.irssi/config
  357. if [[ ${ONION_ONLY} == 'no' ]]; then
  358. echo " port = \"${IRC_PORT}\";" >> /home/${MY_USERNAME}/.irssi/config
  359. echo ' use_ssl = "yes";' >> /home/${MY_USERNAME}/.irssi/config
  360. else
  361. IRC_ONION_HOSTNAME=$(cat ${COMPLETION_FILE} | grep "irc onion domain" | head -n 1 | awk -F ':' '{print $2}')
  362. echo " port = \"${IRC_ONION_PORT}\";" >> /home/${MY_USERNAME}/.irssi/config
  363. echo ' use_ssl = "no";' >> /home/${MY_USERNAME}/.irssi/config
  364. fi
  365. echo ' chatnet = "Freedombone";' >> /home/${MY_USERNAME}/.irssi/config
  366. echo ' ssl_verify = "no";' >> /home/${MY_USERNAME}/.irssi/config
  367. echo ' autoconnect = "yes";' >> /home/${MY_USERNAME}/.irssi/config
  368. if [ ${IRC_PASSWORD} ]; then
  369. echo " password = \"${IRC_PASSWORD}\";" >> /home/${MY_USERNAME}/.irssi/config
  370. fi
  371. echo ' }' >> /home/${MY_USERNAME}/.irssi/config
  372. echo ');' >> /home/${MY_USERNAME}/.irssi/config
  373. echo '' >> /home/${MY_USERNAME}/.irssi/config
  374. echo 'chatnets = {' >> /home/${MY_USERNAME}/.irssi/config
  375. echo ' Freedombone = {' >> /home/${MY_USERNAME}/.irssi/config
  376. echo ' type = "IRC";' >> /home/${MY_USERNAME}/.irssi/config
  377. echo ' max_kicks = "1";' >> /home/${MY_USERNAME}/.irssi/config
  378. echo ' max_msgs = "4";' >> /home/${MY_USERNAME}/.irssi/config
  379. echo ' max_whois = "1";' >> /home/${MY_USERNAME}/.irssi/config
  380. echo ' };' >> /home/${MY_USERNAME}/.irssi/config
  381. echo ' Freenode = {' >> /home/${MY_USERNAME}/.irssi/config
  382. echo ' type = "IRC";' >> /home/${MY_USERNAME}/.irssi/config
  383. echo ' max_kicks = "1";' >> /home/${MY_USERNAME}/.irssi/config
  384. echo ' max_msgs = "4";' >> /home/${MY_USERNAME}/.irssi/config
  385. echo ' max_whois = "1";' >> /home/${MY_USERNAME}/.irssi/config
  386. echo ' };' >> /home/${MY_USERNAME}/.irssi/config
  387. echo ' OFTC = {' >> /home/${MY_USERNAME}/.irssi/config
  388. echo ' type = "IRC";' >> /home/${MY_USERNAME}/.irssi/config
  389. echo ' max_kicks = "1";' >> /home/${MY_USERNAME}/.irssi/config
  390. echo ' max_msgs = "1";' >> /home/${MY_USERNAME}/.irssi/config
  391. echo ' max_whois = "1";' >> /home/${MY_USERNAME}/.irssi/config
  392. echo ' };' >> /home/${MY_USERNAME}/.irssi/config
  393. echo '};' >> /home/${MY_USERNAME}/.irssi/config
  394. echo '' >> /home/${MY_USERNAME}/.irssi/config
  395. echo 'channels = (' >> /home/${MY_USERNAME}/.irssi/config
  396. echo ' { name = "#freedombone"; chatnet = "Freedombone"; autojoin = "Yes"; },' >> /home/${MY_USERNAME}/.irssi/config
  397. echo ');' >> /home/${MY_USERNAME}/.irssi/config
  398. echo '' >> /home/${MY_USERNAME}/.irssi/config
  399. echo 'settings = {' >> /home/${MY_USERNAME}/.irssi/config
  400. echo " core = { real_name = \"$MY_NAME\"; user_name = \"$MY_USERNAME\"; nick = \"$MY_USERNAME\"; };" >> /home/${MY_USERNAME}/.irssi/config
  401. echo ' "fe-text" = { actlist_sort = "refnum"; };' >> /home/${MY_USERNAME}/.irssi/config
  402. echo '};' >> /home/${MY_USERNAME}/.irssi/config
  403. echo 'ignores = ( { level = "CTCPS"; } );' >> /home/${MY_USERNAME}/.irssi/config
  404. chown -R ${MY_USERNAME}:${MY_USERNAME} /home/${MY_USERNAME}/.irssi
  405. install_completed irc_client
  406. }
  407. function install_irc {
  408. install_irc_server
  409. install_irc_client
  410. APP_INSTALLED=1
  411. }
  412. # NOTE: deliberately no exit 0