|
@@ -251,6 +251,13 @@ FULLBLOG_COMMIT='bf5fe9486160be4da86d8987d3e5c977e1dc6d32'
|
251
|
251
|
MY_BLOG_TITLE="My Blog"
|
252
|
252
|
MY_BLOG_SUBTITLE="Another ${PROJECT_NAME} Blog"
|
253
|
253
|
|
|
254
|
+# search engine
|
|
255
|
+SEARCH_ENGINE_REPO="https://github.com/asciimoo/searx"
|
|
256
|
+SEARCH_ENGINE_COMMIT='fee556c9904637051a9ba874ba7e71cd9f10789f'
|
|
257
|
+SEARCH_ENGINE_PATH=/etc
|
|
258
|
+SEARCH_ENGINE_ONION_PORT=8094
|
|
259
|
+SEARCH_ENGINE_ONION_HOSTNAME=
|
|
260
|
+
|
254
|
261
|
GPG_KEYSERVER="hkp://keys.gnupg.net"
|
255
|
262
|
|
256
|
263
|
# whether to encrypt all incoming email with your public key
|
|
@@ -9152,6 +9159,124 @@ function install_gnu_social_markdown {
|
9152
|
9159
|
echo 'install_gnu_social_markdown' >> $COMPLETION_FILE
|
9153
|
9160
|
}
|
9154
|
9161
|
|
|
9162
|
+function install_search_engine {
|
|
9163
|
+ if [[ $SYSTEM_TYPE == "$VARIANT_MESH" ]]; then
|
|
9164
|
+ return
|
|
9165
|
+ fi
|
|
9166
|
+ if [ ! -d /etc/nginx ]; then
|
|
9167
|
+ echo $'Webserver is not installed'
|
|
9168
|
+ exit 62429
|
|
9169
|
+ fi
|
|
9170
|
+
|
|
9171
|
+ # update to a new commit if needed
|
|
9172
|
+ set_repo_commit $SEARCH_ENGINE_PATH/searx "Search engine commit" "$SEARCH_ENGINE_COMMIT" $SEARCH_ENGINE_REPO
|
|
9173
|
+
|
|
9174
|
+ if grep -Fxq "install_search_engine" $COMPLETION_FILE; then
|
|
9175
|
+ return
|
|
9176
|
+ fi
|
|
9177
|
+
|
|
9178
|
+ if [ ! -d $SEARCH_ENGINE_PATH ]; then
|
|
9179
|
+ mkdir -p $SEARCH_ENGINE_PATH
|
|
9180
|
+ fi
|
|
9181
|
+
|
|
9182
|
+ # clone the repo
|
|
9183
|
+ cd $SEARCH_ENGINE_PATH
|
|
9184
|
+ git_clone $SEARCH_ENGINE_REPO searx
|
|
9185
|
+ git checkout $SEARCH_ENGINE_COMMIT -b $SEARCH_ENGINE_COMMIT
|
|
9186
|
+ if ! grep -q "Search engine commit" $COMPLETION_FILE; then
|
|
9187
|
+ echo "Search engine commit:$SEARCH_ENGINE_COMMIT" >> $COMPLETION_FILE
|
|
9188
|
+ else
|
|
9189
|
+ sed -i "s/Search engine commit.*/Search engine commit:$SEARCH_ENGINE_COMMIT/g" $COMPLETION_FILE
|
|
9190
|
+ fi
|
|
9191
|
+
|
|
9192
|
+ # create an onion service
|
|
9193
|
+ SEARCH_ENGINE_ONION_HOSTNAME=$(add_onion_service searx 80 ${SEARCH_ENGINE_ONION_PORT})
|
|
9194
|
+ if ! grep "Search engine onion domain" $COMPLETION_FILE; then
|
|
9195
|
+ echo "Search engine onion domain:${SEARCH_ENGINE_ONION_HOSTNAME}" >> $COMPLETION_FILE
|
|
9196
|
+ else
|
|
9197
|
+ sed -i "s|Search engine onion domain.*|Search engine onion domain:${SEARCH_ENGINE_ONION_HOSTNAME}|g" $COMPLETION_FILE
|
|
9198
|
+ fi
|
|
9199
|
+
|
|
9200
|
+ # an unprivileged user to run as
|
|
9201
|
+ useradd -d ${SEARCH_ENGINE_PATH}/searx/ -s /bin/false searx
|
|
9202
|
+
|
|
9203
|
+ # daemon
|
|
9204
|
+ echo '[Unit]' > /etc/systemd/system/searx.service
|
|
9205
|
+ echo 'Description=Searx search engine' >> /etc/systemd/system/searx.service
|
|
9206
|
+ echo 'After=syslog.target' >> /etc/systemd/system/searx.service
|
|
9207
|
+ echo 'After=network.target' >> /etc/systemd/system/searx.service
|
|
9208
|
+ echo '[Service]' >> /etc/systemd/system/searx.service
|
|
9209
|
+ echo 'Type=simple' >> /etc/systemd/system/searx.service
|
|
9210
|
+ echo 'User=searx' >> /etc/systemd/system/searx.service
|
|
9211
|
+ echo 'Group=searx' >> /etc/systemd/system/searx.service
|
|
9212
|
+ echo "WorkingDirectory=${SEARCH_ENGINE_PATH}/searx" >> /etc/systemd/system/searx.service
|
|
9213
|
+ echo 'ExecStart=torify python searx/webapp.py' >> /etc/systemd/system/searx.service
|
|
9214
|
+ echo '' >> /etc/systemd/system/searx.service
|
|
9215
|
+ echo 'TimeoutSec=300' >> /etc/systemd/system/searx.service
|
|
9216
|
+ echo '' >> /etc/systemd/system/searx.service
|
|
9217
|
+ echo '[Install]' >> /etc/systemd/system/searx.service
|
|
9218
|
+ echo 'WantedBy=multi-user.target' >> /etc/systemd/system/searx.service
|
|
9219
|
+
|
|
9220
|
+ # create a webserver file
|
|
9221
|
+ echo 'server {' >> /etc/nginx/sites-available/searx
|
|
9222
|
+ echo " listen 127.0.0.1:${SEARCH_ENGINE_ONION_PORT} default_server;" >> /etc/nginx/sites-available/searx
|
|
9223
|
+ echo " root ${SEARCH_ENGINE_PATH}/searx;" >> /etc/nginx/sites-available/searx
|
|
9224
|
+ echo " server_name searx;" >> /etc/nginx/sites-available/searx
|
|
9225
|
+ echo ' access_log off;' >> /etc/nginx/sites-available/searx
|
|
9226
|
+ echo " error_log /var/log/searx_error.log $WEBSERVER_LOG_LEVEL;" >> /etc/nginx/sites-available/searx
|
|
9227
|
+ echo '' >> /etc/nginx/sites-available/searx
|
|
9228
|
+ nginx_limits searx '1M'
|
|
9229
|
+ nginx_disable_sniffing searx
|
|
9230
|
+ echo ' add_header Strict-Transport-Security max-age=0;' >> /etc/nginx/sites-available/searx
|
|
9231
|
+ echo '' >> /etc/nginx/sites-available/searx
|
|
9232
|
+ echo ' location / {' >> /etc/nginx/sites-available/searx
|
|
9233
|
+ echo ' proxy_pass http://localhost:8888;' >> /etc/nginx/sites-available/searx
|
|
9234
|
+ echo ' proxy_set_header Host $host;' >> /etc/nginx/sites-available/searx
|
|
9235
|
+ echo ' proxy_set_header X-Real-IP $remote_addr;' >> /etc/nginx/sites-available/searx
|
|
9236
|
+ echo ' proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;' >> /etc/nginx/sites-available/searx
|
|
9237
|
+ echo ' proxy_set_header X-Remote-Port $remote_port;' >> /etc/nginx/sites-available/searx
|
|
9238
|
+ echo ' proxy_set_header X-Forwarded-Proto $scheme;' >> /etc/nginx/sites-available/searx
|
|
9239
|
+ echo ' proxy_redirect off;' >> /etc/nginx/sites-available/searx
|
|
9240
|
+ echo ' }' >> /etc/nginx/sites-available/searx
|
|
9241
|
+ echo '' >> /etc/nginx/sites-available/searx
|
|
9242
|
+ echo ' fastcgi_buffers 64 4K;' >> /etc/nginx/sites-available/searx
|
|
9243
|
+ echo '' >> /etc/nginx/sites-available/searx
|
|
9244
|
+ echo ' error_page 403 /core/templates/403.php;' >> /etc/nginx/sites-available/searx
|
|
9245
|
+ echo ' error_page 404 /core/templates/404.php;' >> /etc/nginx/sites-available/searx
|
|
9246
|
+ echo '' >> /etc/nginx/sites-available/searx
|
|
9247
|
+ echo ' location = /robots.txt {' >> /etc/nginx/sites-available/searx
|
|
9248
|
+ echo ' allow all;' >> /etc/nginx/sites-available/searx
|
|
9249
|
+ echo ' log_not_found off;' >> /etc/nginx/sites-available/searx
|
|
9250
|
+ echo ' access_log off;' >> /etc/nginx/sites-available/searx
|
|
9251
|
+ echo ' }' >> /etc/nginx/sites-available/searx
|
|
9252
|
+ echo '}' >> /etc/nginx/sites-available/searx
|
|
9253
|
+
|
|
9254
|
+ # replace the secret key
|
|
9255
|
+ if ! grep "Search engine key" $COMPLETION_FILE; then
|
|
9256
|
+ SEARCH_ENGINE_SECRET_KEY="$(openssl rand -base64 32)"
|
|
9257
|
+ echo "Search engine key:${SEARCH_ENGINE_SECRET_KEY}" >> $COMPLETION_FILE
|
|
9258
|
+ else
|
|
9259
|
+ SEARCH_ENGINE_SECRET_KEY=$(cat $COMPLETION_FILE | grep "Search engine key" | awk -F ':' '{print $2}')
|
|
9260
|
+ fi
|
|
9261
|
+ sed -i "s|secret_key.*|secret_key : \"$SEARCH_ENGINE_SECRET_KEY\"|g" ${SEARCH_ENGINE_PATH}/searx/searx/settings.yml
|
|
9262
|
+
|
|
9263
|
+ chown -R searx:searx ${SEARCH_ENGINE_PATH}/searx
|
|
9264
|
+
|
|
9265
|
+ # enable the site
|
|
9266
|
+ nginx_ensite searx
|
|
9267
|
+
|
|
9268
|
+ # restart the web server
|
|
9269
|
+ systemctl restart php5-fpm
|
|
9270
|
+ systemctl restart nginx
|
|
9271
|
+
|
|
9272
|
+ # start the daemon
|
|
9273
|
+ systemctl enable searx.service
|
|
9274
|
+ systemctl daemon-reload
|
|
9275
|
+ systemctl start searx.service
|
|
9276
|
+
|
|
9277
|
+ echo 'install_search_engine' >> $COMPLETION_FILE
|
|
9278
|
+}
|
|
9279
|
+
|
9155
|
9280
|
function install_hubzilla {
|
9156
|
9281
|
if [[ $SYSTEM_TYPE == "$VARIANT_CLOUD" || $SYSTEM_TYPE == "$VARIANT_MAILBOX" || $SYSTEM_TYPE == "$VARIANT_CHAT" || $SYSTEM_TYPE == "$VARIANT_WRITER" || $SYSTEM_TYPE == "$VARIANT_MEDIA" || $SYSTEM_TYPE == "$VARIANT_DEVELOPER" || $SYSTEM_TYPE == "$VARIANT_MESH" ]]; then
|
9157
|
9282
|
return
|
|
@@ -10510,6 +10635,7 @@ install_gnu_social_markdown
|
10510
|
10635
|
install_rss_reader
|
10511
|
10636
|
install_rss_mobile_reader
|
10512
|
10637
|
install_hubzilla
|
|
10638
|
+#install_search_engine
|
10513
|
10639
|
install_dlna_server
|
10514
|
10640
|
configure_firewall_for_dlna
|
10515
|
10641
|
#install_mediagoblin
|