Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
freedombone
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Context Sensitive Group
freedombone
Commits
ab707c85
Commit
ab707c85
authored
6 years ago
by
Bob Mottram
Browse files
Options
Downloads
Patches
Plain Diff
Move search functions into their own file
parent
3f48eabd
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/freedombone-app-searx
+0
-184
0 additions, 184 deletions
src/freedombone-app-searx
src/freedombone-utils-search
+778
-0
778 additions, 0 deletions
src/freedombone-utils-search
src/freedombone-utils-webadmin
+5
-0
5 additions, 0 deletions
src/freedombone-utils-webadmin
with
783 additions
and
184 deletions
src/freedombone-app-searx
+
0
−
184
View file @
ab707c85
...
...
@@ -861,190 +861,6 @@ function remove_searx {
sed
-i
'/searx /d'
"
$COMPLETION_FILE
"
}
function
webadmin_upgrade_search
{
CURR_SEARX_COMMIT
=
$(
grep
"SEARX_COMMIT="
"
$rootdir$CONFIGURATION_FILE
"
|
head
-n
1 |
awk
-F
'='
'{print $2}'
)
if
[[
"
$CURR_SEARX_COMMIT
"
==
"
$SEARX_COMMIT
"
]]
;
then
return
fi
settings_file
=
"
$rootdir
${
SEARX_PATH
}
/searx/searx/settings.yml"
background_image
=
"
$rootdir
/etc/searx/searx/static/themes/courgette/img/bg-body-index.jpg"
# save the background image
if
[
-f
"
${
background_image
}
"
]
;
then
cp
"
${
background_image
}
"
"
${
background_image
}
.prev"
fi
# save the settings
cp
"
${
settings_file
}
"
"
${
settings_file
}
.prev"
# do the upgrade
cat
>>
"
$rootdir
/tmp/upgrade_searx"
<<
EOF
cd
$SEARX_PATH
/searx || exit 1
git stash
git pull
EOF
chmod
+x
"
$rootdir
/tmp/upgrade_searx"
if
[
"
$rootdir
"
]
;
then
chroot
"
$rootdir
"
"
$rootdir
/tmp/upgrade_searx"
chroot
"
$rootdir
"
rm
"
$rootdir
/tmp/upgrade_searx"
else
/tmp/upgrade_searx
rm
/tmp/upgrade_searx
fi
# restore the background image
if
[
-f
"
${
background_image
}
.prev"
]
;
then
cp
"
${
background_image
}
.prev"
"
${
background_image
}
"
if
[
"
$rootdir
"
]
;
then
chroot
"
$rootdir
"
chown
-R
searx:searx
"
${
SEARX_PATH
}
/searx"
else
chown
-R
searx:searx
"
${
SEARX_PATH
}
/searx"
fi
fi
# restore the settings
if
[
-f
"
${
settings_file
}
.prev"
]
;
then
cp
"
${
settings_file
}
.prev"
"
${
settings_file
}
"
if
[
"
$rootdir
"
]
;
then
chroot
"
$rootdir
"
chown
-R
searx:searx
${
SEARX_PATH
}
/searx
else
chown
-R
searx:searx
${
SEARX_PATH
}
/searx
fi
fi
# remove the github ribbon icon
if
[
-f
"
$rootdir
/etc/searx/searx/static/themes/courgette/img/github_ribbon.png"
]
;
then
mv
"
$rootdir
/etc/searx/searx/static/themes/courgette/img/github_ribbon.png"
"
$rootdir
/etc/searx/searx/static/themes/courgette/img/github_ribbon.png.old"
fi
sed
-i
"s|SEARX_COMMIT=.*|SEARX_COMMIT=
$SEARX_COMMIT
|g"
"
$rootdir$CONFIGURATION_FILE
"
}
function
webadmin_install_search
{
if
grep
-q
"SEARX_COMMIT="
"
$rootdir$CONFIGURATION_FILE
"
;
then
webadmin_upgrade_search
return
fi
if
[
"
$rootdir
"
]
;
then
# shellcheck disable=SC2086
chroot
"
$rootdir
"
$INSTALL_PACKAGES
python-pip libyaml-dev python-werkzeug python-babel python-lxml
# shellcheck disable=SC2086
chroot
"
$rootdir
"
$INSTALL_PACKAGES
git build-essential libxslt-dev python-dev python-virtualenv zlib1g-dev uwsgi uwsgi-plugin-python imagemagick
# shellcheck disable=SC2086
chroot
"
$rootdir
"
$INSTALL_PACKAGES
apache2-utils python-setuptools
# shellcheck disable=SC2086
chroot
"
$rootdir
"
$INSTALL_PACKAGES
python-service-identity python-ndg-httpsclient
# shellcheck disable=SC2086
chroot
"
$rootdir
"
$REMOVE_PACKAGES_PURGE
apache2-bin
*
else
$INSTALL_PACKAGES
python-pip libyaml-dev python-werkzeug python-babel python-lxml
$INSTALL_PACKAGES
git build-essential libxslt-dev python-dev python-virtualenv zlib1g-dev uwsgi uwsgi-plugin-python imagemagick
$INSTALL_PACKAGES
apache2-utils python-setuptools
$INSTALL_PACKAGES
python-service-identity python-ndg-httpsclient
fi
cat
>>
"
$rootdir
/tmp/install_searx"
<<
EOF
pip2 install --upgrade pip
if ! pip2 install certifi; then
echo
$'
Failed to install certifi'
exit 737692
fi
if ! pip2 install pyyaml; then
echo
$'
Failed to install pyyaml'
exit 469242
fi
if ! pip2 install flask --upgrade; then
echo
$'
Failed to install flask'
exit 888575
fi
if ! pip2 install flask_restless --upgrade; then
echo
$'
Failed to install flask_restless'
exit 54835
fi
if ! pip2 install flask_babel --upgrade; then
echo
$'
Failed to install flask_babel'
exit 63738
fi
if ! pip2 install requests --upgrade; then
echo
$'
Failed to install requests'
exit 357282
fi
if ! pip2 install pygments --upgrade; then
echo
$'
Failed to install pygments'
exit 357282
fi
if [ ! -d
${
SEARX_PATH
}
]; then
mkdir -p
$SEARX_PATH
fi
if ! git_clone
$SEARX_REPO
${
SEARX_PATH
}
/searx; then
exit 35683
fi
cd
$SEARX_PATH
/searx || exit 26482
git checkout
$SEARX_COMMIT
-b
$SEARX_COMMIT
useradd -d
${
SEARX_PATH
}
/searx/ -s /bin/false searx
adduser searx debian-tor
EOF
chmod
+x
"
$rootdir
/tmp/install_searx"
if
[
"
$rootdir
"
]
;
then
chroot
"
$rootdir
"
/tmp/install_searx
chroot
"
$rootdir
"
rm
/tmp/install_searx
else
/tmp/install_searx
rm
/tmp/install_searx
fi
{
echo
'[Unit]'
;
echo
'Description=Searx (search engine)'
;
echo
'After=syslog.target'
;
echo
'After=network.target'
;
echo
''
;
echo
'[Service]'
;
echo
'Type=simple'
;
echo
'User=searx'
;
echo
'Group=searx'
;
echo
"WorkingDirectory=
${
SEARX_PATH
}
/searx"
;
echo
"ExecStart=/usr/bin/python
${
SEARX_PATH
}
/searx/searx/webapp.py"
;
echo
'Restart=always'
;
echo
'Environment="USER=searx"'
;
echo
''
;
echo
'[Install]'
;
echo
'WantedBy=multi-user.target'
;
}
>
"
$rootdir
/etc/systemd/system/searx.service"
create_searx_config
searx_set_default_background
if
[
"
$rootdir
"
]
;
then
chroot
"
$rootdir
"
chown
-R
searx:searx
${
SEARX_PATH
}
/searx
chroot
"
$rootdir
"
systemctl
enable
searx.service
chroot
"
$rootdir
"
systemctl daemon-reload
chroot
"
$rootdir
"
systemctl start searx.service
else
chown
-R
searx:searx
${
SEARX_PATH
}
/searx
systemctl
enable
searx.service
systemctl daemon-reload
systemctl start searx.service
fi
if
!
grep
-q
"SEARX_COMMIT="
"
$rootdir$CONFIGURATION_FILE
"
;
then
echo
"SEARX_COMMIT=
$SEARX_COMMIT
"
>>
"
$rootdir$CONFIGURATION_FILE
"
else
sed
-i
"s|SEARX_COMMIT=.*|SEARX_COMMIT=
$SEARX_COMMIT
|g"
"
$rootdir$CONFIGURATION_FILE
"
fi
}
function
install_searx
{
if
[
!
-d
/etc/nginx
]
;
then
echo
$'Webserver is not installed'
...
...
This diff is collapsed.
Click to expand it.
src/freedombone-utils-search
0 → 100644
+
778
−
0
View file @
ab707c85
This diff is collapsed.
Click to expand it.
src/freedombone-utils-webadmin
+
5
−
0
View file @
ab707c85
...
...
@@ -992,6 +992,11 @@ function image_install_web_admin {
echo ' }';
echo ' }';
echo '';
echo ' location ^~ /search {';
echo " proxy_pass http://localhost:${SEARX_PORT};";
echo ' proxy_set_header X-Script-Name /search;';
echo ' }';
echo '';
echo ' location ^~ /mail {';
echo ' client_max_body_size 200m;';
echo " root /var/www/${local_hostname}/htdocs;";
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment