-
Notifications
You must be signed in to change notification settings - Fork 0
/
build
executable file
·58 lines (49 loc) · 2.04 KB
/
build
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
#!/bin/sh
REPO_LINK=https://github.com/ptt/pttbbs
CURRENT_COMMIT=194549c
export BBSHOME=$HOME
export BBSBUILD=$BBSHOME/pttbbs
export THIS_BUILD=$HOME/innptt
export THIS_BBSBUILD=$THIS_BUILD/pttbbs
detect_os()
{
test -e $THIS_BBSBUILD/pttbbs.conf && echo config\ exists\!
test `uname -m` = amd64 && echo amd64 && echo -e "\n#define TIMET64\n" >> $THIS_BBSBUILD/pttbbs.conf
test `uname -m` = amd64 && echo amd64 && test `uname` = Linux && echo Linux && echo "#define SHMALIGNEDSIZE (1048576*4)\n" >> $THIS_BBSBUILD/pttbbs.conf
test `uname -m` = x86\_64 && echo x86\_64 && echo -e "\n#define TIMET64\n" >> $THIS_BBSBUILD/pttbbs.conf
test `uname -m` = x86\_64 && echo x86\_64 && test `uname` = Linux && echo Linux && echo -e "#define SHMALIGNEDSIZE (1048576*4)\n" >> $THIS_BBSBUILD/pttbbs.conf
}
not_installed_git()
{
echo -e "please install \"git\""
exit 1
}
make_pttbbs()
{
test `uname` = FreeBSD && make all install clean || (command -v bmake >/dev/null 2>&1 && bmake -m /usr/local/share/mk all install clean || no_bmake_in_linux )
}
no_bmake_in_linux()
{
echo -e "please install or get more configuration info about \"bmake/pmake\""
exit 1
}
apply_wsproxy_lib()
{
echo -e "applying wsproxy library......\x1b[5m_\x1b[m"
cd $THIS_BBSBUILD/daemon/wsproxy && mkdir lib && cd lib && git clone https://github.com/toxicfrog/vstruct/
}
command -v git >/dev/null 2>&1 && echo 'git installed' || not_installed_git
test -e $BBSBUILD && mkdir -p $BBSHOME/tmp && mv $BBSBUILD $BBSHOME/tmp/pttbbs.`date +%s`
test -e $THIS_BBSBUILD && rm -rf $THIS_BBSBUILD
cd $THIS_BUILD && git clone $REPO_LINK
cd $THIS_BBSBUILD && git checkout $CURRENT_COMMIT && env && git apply $THIS_BUILD/0001-Revert-Remove-innbbsd.patch
test -e $THIS_BUILD/pttbbs.conf && cp $THIS_BUILD/pttbbs.conf $THIS_BBSBUILD/ || ( cp $THIS_BBSBUILD/sample/pttbbs_minimal.conf $THIS_BBSBUILD/pttbbs.conf && detect_os )
case "$1" in
wsproxy)
apply_wsproxy_lib
;;
*)
;;
esac
cp -rf $THIS_BBSBUILD $BBSHOME/
cd $BBSBUILD && make_pttbbs