forked from bmybbs/bmybbs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Install.sh
executable file
·188 lines (161 loc) · 5.79 KB
/
Install.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
#! /bin/sh
BBS_HOME=/home/bbs
BBSUID=999
BBSGRP=999
TARGET=/home/bbs
HTMPATH=/home/apache/htdocs/bbs
CGIPATH=/home/apache/cgi-bin/bbs
LOCALIP=
# 蛻帛サコ逶ョ蠖
echo -e "\033[1;32m譛ャ閼壽悽莨壼惠 ${BBS_HOME} 荳句�蟒コ蝓コ譛ャ逶ョ蠖慕サ捺桷�御サ・蜿雁�莉夜怙隕∫噪譁�サカ螟ケ蜥碁�鄂ョ譁�サカ"
echo -n "Press <Enter> to continue ..."
read ans
if [ -d ${BBS_HOME} ] ; then
echo -e "\033[1;31m隴ヲ蜻奇シ${BBS_HOME} 蟾イ蟄伜惠�―033[0m"
echo -n "隕�尠 [N]?"
read ans
ans=${ans:-N}
case $ans in
[Yy]) echo "蛻帛サコ逶ョ蠖募芦 ${BBS_HOME}" ;;
*) echo "謾セ蠑 ..." ; exit ;;
esac
else
echo -e "\033[1;32mMaking dir ${BBS_HOME}\033[0m"
mkdir ${BBS_HOME}
chmod -R 770 ${BBS_HOME}
fi
echo -e "\033[1;32mSetup bbs directory tree .....\033[0m"
(cd ${BBS_HOME};mkdir vote tmp reclog bm bin traced newtrace)
(cd ${BBS_HOME};for i in home mail;do for j in `perl -e "print join(' ',A..Z)"`;do mkdir -p $i/$j;done;done)
(cd ${BBS_HOME};for i in bbslists sysop syssecurity notepad newcomers junk vote .tmp .backnumbers;do mkdir -p boards/$i;done)
(cd ${BBS_HOME};for i in sysop bbslists vote newcomers;do mkdir -p 0Announce/groups/GROUP_0/$i;done)
(cd ${BBS_HOME};mkdir -p 0Announce/groups/GROUP_7/notepad)
( cd bbshome ; tar cf - * ) | ( cd ${BBS_HOME} ; tar xf - )
mv ${BBS_HOME}/BOARDS ${BBS_HOME}/.BOARDS
mv ${BBS_HOME}/badname ${BBS_HOME}/.badname
mv ${BBS_HOME}/bad_email ${BBS_HOME}/.bad_email
touch ${BBS_HOME}/.hushlogin
mkdir ${BBS_HOME}/bbstmpfs
ln ${BBS_HOME}/bbstmpfs/tmp ${BBS_HOME}/tmpfast -s
ln ${BBS_HOME}/bbstmpfs/dynamic ${BBS_HOME}/dynamic -s
( cd ${BBS_HOME}/0Announce/bbslist/; for i in day month year week; do ln -s ${BBS_HOME}/etc/posts/$i $i; done )
mkdir -p ${CGIPATH}
mkdir -p ${HTMPATH}
cat > ${BBS_HOME}/etc/sysconf.ini << EOF
#---------------------------------------------------------------
# Here is where you adjust the BBS System Configuration
# Delete ../sysconf.img to make the change after modification
#---------------------------------------------------------------
BBSHOME = "/home/bbs"
BBSID = "BMY"
BBSNAME = "ア氿クBBS"
BBSDOMAIN = "${LOCALIP}"
BBSIP = "${LOCALIP}"
KEEP_DELETED_HEADER = 0
#---------------------------------------------------------------
# EMAILFILE - Toggle the E-Mail Registration Feature
# NEWREGFILE - Toggle the 3 days no-post feature for new comers
#---------------------------------------------------------------
EMAILFILE = "etc/mailcheck"
#NEWREGFILE = "etc/newregister"
#---------------------------------------------------------------
# Do not modify anything below unless you know what you are doing...
#---------------------------------------------------------------
PERM_BASIC = 0x00001
PERM_CHAT = 0x00002
PERM_PAGE = 0x00004
PERM_POST = 0x00008
PERM_LOGINOK = 0x00010
PERM_DENYSIG = 0x00020
PERM_CLOAK = 0x00040
PERM_SEECLOAK = 0x00080
PERM_XEMPT = 0x00100
PERM_WELCOME = 0x00200
PERM_BOARDS = 0x00400
PERM_ACCOUNTS = 0x00800
PERM_CHATCLOAK = 0x01000
PERM_OVOTE = 0x02000
PERM_SYSOP = 0x04000
PERM_POSTMASK = 0x08000
PERM_ANNOUNCE = 0x10000
PERM_OBOARDS = 0x20000
PERM_ACBOARD = 0x40000
PERM_NOZAP = 0x80000
PERM_FORCEPAGE = 0x100000
PERM_EXT_IDLE = 0x200000
PERM_SPECIAL1 = 0x400000
PERM_SPECIAL2 = 0x800000
PERM_SPECIAL3 = 0x1000000
PERM_SPECIAL4 = 0x2000000
PERM_SPECIAL5 = 0x4000000
PERM_SPECIAL6 = 0x8000000
PERM_SPECIAL7 = 0x10000000
PERM_SPECIAL8 = 0x20000000
AUTOSET_PERM = PERM_CHAT, PERM_PAGE, PERM_POST, PERM_LOGINOK
PERM_ESYSFILE = PERM_SYSOP,PERM_WELCOME,PERM_ACBOARD
PERM_ADMINMENU = PERM_ACCOUNTS,PERM_OVOTE,PERM_SYSOP,PERM_OBOARDS,PERM_WELCOME,PERM_ACBOARD
PERM_BLEVELS = PERM_SYSOP,PERM_OBOARDS
PERM_UCLEAN = PERM_SYSOP,PERM_ACCOUNTS
PERM_MAILALL = PERM_SYSOP,PERM_SPECIAL4
#include "etc/menu.ini"
EOF
# 蛻帛サコ bbs-start 閼壽悽
cat > ${BBS_HOME}/bbs-start.sh << EOF
#!/bin/sh
mount tmpfs /home/bbs/bbstmpfs -t tmpfs -o size=32M
for i in brc tmp dynamic userattach; do mkdir /home/bbs/bbstmpfs/\$i; done
chown bbs:bbs /home/bbs/bbstmpfs -R
/home/bbs/bin/bbsd
EOF
chmod +x ${BBS_HOME}/bbs-start.sh
# 蛻帛サコ bbs-stop 閼壽悽
cat > ${BBS_HOME}/bbs-stop.sh << EOF
#!/bin/sh
killall bbsd
umount ${BBS_HOME}/bbstmpfs
EOF
chmod +x ${BBS_HOME}/bbs-stop.sh
# 蛻帛サコ apache2 驟咲スョ譁�サカ
if [ -f /etc/apache2/sites-available ]
then
cat > /etc/apache2/sites-available/bbs << EOF
NameVirtualHost ${LOCALIP}:80
<VirtualHost ${LOCALIP}:80>
ServerName ${LOCALIP}:80
ServerAdmin program_team@bmy
DocumentRoot ${HTMPATH}
AssignUserID bbs bbs
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory ${HTMPATH}>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
ScriptAlias /cgi-bin/ ${CGIPATH%%/bbs}
<Directory ${CGIPATH%%/bbs}>
AllowOverride None
Options None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
RewriteEngine on
RewriteRule ^/BMY(.*)$ /cgi-bin/bbs/www [PT]
RewriteRule ^/$ /cgi-bin/bbs/www [PT]
ErrorLog /var/log/apache2/error.log
LogLevel warn
</VirtualHost>
EOF
a2ensite bbs
fi
# 菫ョ謾ケ譁�サカ螟ケ譚�剞
chown -R ${BBSUID}.${BBSGRP} ${BBS_HOME}
chown -R ${BBSUID}.${BBSGRP} ${CGIPATH}
chown -R ${BBSUID}.${BBSGRP} ${HTMPATH}
echo -e "\033[1;32m驟咲スョ扈捺據....\033[0m"
echo -e "Check the configuration in \033[1;31m${BBS_HOME}/etc/sysconf.ini\033[0m"
echo -e "邇ー蝨ィ蜿ッ莉・謇ァ陦檎シ冶ッ題ソ�ィ具シ瑚ッヲ扈�ュ・鬪、隸キ蜿りソ033[1;31m縲械MYBBS譚�ィ∝ョ芽」�枚譯」縲欺033[0m"