forked from marcelvanherk/Conquest-DICOM-Server
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmaklinux
More file actions
173 lines (150 loc) · 6.08 KB
/
maklinux
File metadata and controls
173 lines (150 loc) · 6.08 KB
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
#!/bin/bash
# mvh 20160425 for 1.4.19beta
# mvh 20160516 use ln -s for shared server/webserver configs
# mvh 20161117 back to cp, added chmod for src/dgate/jpeg-6c/configure
# mvh 20161122 Fixed order of newweb copy
# mvh 20170211 Fix include paths in mysql option
# mvh 20170504 Set rights for web folder; document mariadb lib link (but commented out)
# mvh 20181117 Added luasocket to compile
# mvh 20181125 make /usr/local/man.man1, add luasocket to mysql compile
# mvh 20200109 Fixed to linux line endings
# mvh 20200215 Config for external lua5.1 library (see LUA=)
# mvh 20200216 No overwite dicom.ini/acrnema.map; external luasocket
# mvh 20200226 Check lua.o etc exist before rm
# mvh 20200304 Added precompiled option, also create .exe in web;
# mvh 20200308 Write temp folder and conquest folders where needed;
# mvh 20200310 Do overwrite dicom.ini, but make backup first
# mvh 20200311 Lost mariadb change, use mariadb and mysql include folders for ubuntu14 compatibility
export CONQUEST=$(pwd)
export CONQUESTTEMP=$CONQUEST/temp
[ ! -d $CONQUESTTEMP ] && mkdir $CONQUESTTEMP
chmod 777 $CONQUESTTEMP
export IP=$(hostname -I | xargs)
SRC=./src/dgate;
CONF=./linux/conf;
LINUX=./linux;
#LUA="$SRC/lua.o $SRC/luasocket/luasocket.a";
LUA=-llua5.1;
#LUA="-llua5.1 $SRC/luasocket/luasocket.a";
FLAGS="-std=c++11 -DUNIX -DNATIVE_ENDIAN=1 -DHAVE_LIBJPEG -DHAVE_LIBCHARLS -DHAVE_LIBOPENJPEG2 -Wno-write-strings -Wno-multichar -Wno-format-overflow -Wno-deprecated-declarations";
INCS="-I$SRC/dicomlib -ljpeg -lpthread -ldl -I$SRC/src -I$SRC/jpeg-6c -L$SRC/jpeg-6c -I$SRC/lua_5.1.5 -I$SRC/openjpeg -I$SRC/charls";
OBS="$SRC/charls.o $SRC/openjpeg.o";
#sudo mkdir /usr/local/man.man1
chmod 777 src/dgate/jpeg-6c/configure
cd src/dgate/jpeg-6c
./configure
make
echo Please ignore the errors below
sudo make install
echo Please ignore the errors above
cd ../../..
#chmod 777 src/dgate/luasocket/amake.sh;
#cd src/dgate/luasocket;
#./amake.sh;
#cd ../../..
echo "Please choose DB type";
options=("mariadb" "postgres" "sqlite" "dbase" "precompiled" "Quit")
select opt in "${options[@]}"
do
case $opt in
"mariadb")
# cd /usr/lib
# ln -s /usr/lib64/mysql .
# gcc -o $SRC/lua.o -c $SRC/lua_5.1.5/all.c -I$SRC/lua_5.1.5 -DLUA_USE_DLOPEN -DLUA_USE_POSIX;
g++ -std=c++11 -o $SRC/charls.o -c $SRC/charls/all.cpp -I$SRC/charls -Wno-deprecated-declarations
gcc -o $SRC/openjpeg.o -c $SRC/openjpeg/all.c -I$SRC/openjpeg
g++ $FLAGS -DUSEMYSQL $OBS -o dgate $SRC/src/total.cpp $LUA $INCS -I/usr/local/mariadb/include -I/usr/include/mariadb -I/usr/include/mysql -L/usr/local/mariadb/lib -L/usr/lib/mariadb -lmariadbclient;
break;
;;
"postgres")
export LD_LIBRARY_PATH="/usr/include/postgresql/";
# gcc -o $SRC/lua.o -c $SRC/lua_5.1.5/all.c -I$SRC/lua_5.1.5 -DLUA_USE_DLOPEN -DLUA_USE_POSIX;
g++ -std=c++11 -o $SRC/charls.o -c $SRC/charls/all.cpp -I$SRC/charls -Wno-deprecated-declarations
gcc -o $SRC/openjpeg.o -c $SRC/openjpeg/all.c -I$SRC/openjpeg
g++ $FLAGS -DPOSTGRES $OBS -o dgate $SRC/src/total.cpp $LUA $INCS -I/usr/include/postgresql/ -L/usr/local/pgsql/lib -lpq;
break;
;;
"sqlite")
# gcc -o $SRC/lua.o -c $SRC/lua_5.1.5/all.c -I$SRC/lua_5.1.5 -DLUA_USE_DLOPEN -DLUA_USE_POSIX;
gcc -c -DTHREADSAFE=1 -DHAVE_USLEEP $SRC/sqlite3/sqlite3.c -I$SRC/sqlite3 -o $SRC/sqlite3.o;
g++ -std=c++11 -o $SRC/charls.o -c $SRC/charls/all.cpp -I$SRC/charls -Wno-deprecated-declarations
gcc -o $SRC/openjpeg.o -c $SRC/openjpeg/all.c -I$SRC/openjpeg
g++ $FLAGS -DUSESQLITE $SRC/sqlite3.o $OBS -o dgate $SRC/src/total.cpp $LUA $INCS -I$SRC/sqlite3;
rm $SRC/sqlite3.o;
break;
;;
"precompiled")
cp linux/dgate dgate;
cp linux/dgate install/dgatesmall;
chmod 777 dgate;
chmod 777 install/dgatesmall;
break;
;;
"dbase")
# gcc -o $SRC/lua.o -c $SRC/lua_5.1.5/all.c -I$SRC/lua_5.1.5 -DLUA_USE_DLOPEN -DLUA_USE_POSIX;
g++ -std=c++11 -o $SRC/charls.o -c $SRC/charls/all.cpp -I$SRC/charls -Wno-deprecated-declarations
gcc -o $SRC/openjpeg.o -c $SRC/openjpeg/all.c -I$SRC/openjpeg
g++ $FLAGS $OBS -o dgate $SRC/src/total.cpp $LUA $INCS;
break;
;;
"Quit")
break
;;
*) echo invalid option;;
esac
done
if [ $opt != "Quit" ]
then
[ -f $SRC/lua.o ] && rm $SRC/lua.o;
[ -f $SRC/charls.o ] && rm $SRC/charls.o;
[ -f $SRC/openjpeg.o ] && rm $SRC/openjpeg.o;
pkill -9 dgate;
sleep 0.2s;
[ -f dicom.ini ] && cp dicom.ini dicom.ini.bak
envsubst < $CONF/dicom.ini.$opt > dicom.ini;
cp $CONF/dicom.sql.$opt dicom.sql;
[ ! -f acrnema.map ] && cp $LINUX/acrnema.map acrnema.map;
cp $LINUX/dgatesop.lst dgatesop.lst;
sudo cp ./dgate /usr/lib/cgi-bin/dgate ;
sudo cp ./dgate /usr/lib/cgi-bin/dgate.exe ;
sudo cp ./dicom.sql /usr/lib/cgi-bin/dicom.sql ;
sudo cp ./acrnema.map /usr/lib/cgi-bin/acrnema.map ;
[ ! -d /usr/lib/cgi-bin ] && sudo mkdir -p /usr/lib/cgi-bin ;
sudo chmod 777 /usr/lib/cgi-bin ;
sudo cp -r ./webserver/cgi-bin/* /usr/lib/cgi-bin;
sudo cp -r ./webserver/cgi-bin/.lua /usr/lib/cgi-bin;
sudo cp -r ./webserver/cgi-bin/.lua.linux /usr/lib/cgi-bin;
envsubst < ./webserver/cgi-bin/dicom.ini.linux > t.t;
sudo cp t.t /usr/lib/cgi-bin/dicom.ini;
envsubst < ./webserver/cgi-bin/newweb/dicom.ini.linux > t.t;
sudo cp t.t /usr/lib/cgi-bin/newweb/dicom.ini;
sudo cp /usr/lib/cgi-bin/.lua.linux /usr/lib/cgi-bin/.lua;
rm t.t
sudo cp ./dgate /usr/lib/cgi-bin/newweb/dgate ;
sudo cp ./dgate /usr/lib/cgi-bin/newweb/dgate.exe ;
sudo cp -r ./webserver/htdocs/* /var/www;
sudo cp -r ./webserver/htdocs/* /var/www/html;
[ ! -d data/dbase ] && mkdir data/dbase
chmod 777 console.sh
chmod 777 webviewer.sh
chmod 777 install/linux.sh
read -p "Regenerate the database?" -r
echo $REPLY
if [[ $REPLY =~ ^[Yy]$ ]]
then
./dgate -v -r
fi
envsubst <conquest.service >t.t
read -p "Install as service?" -r
echo $REPLY
if [[ $REPLY =~ ^[Yy]$ ]]
then
sudo systemctl stop conquest.service
sudo cp t.t /etc/systemd/system/conquest.service
sudo systemctl daemon-reload
sudo systemctl start conquest.service
sudo systemctl enable conquest.service
sudo systemctl status conquest.service
fi
rm t.t
fi