freedombone-app-irc 19KB

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