summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorfrnmst/Franco Masotti2016-10-19 14:52:12 +0200
committerfrnmst/Franco Masotti2016-10-19 14:52:12 +0200
commit00dbb734c3b3b55a81153eb41da66314662b2ecf (patch)
tree14d7c548e49c1411b5a66caea3ad67a8be3688fc
parentb4e10c9fee25fd6ac9c0bd8245124fa8b0437046 (diff)
downloadaur-00dbb734c3b3b55a81153eb41da66314662b2ecf.tar.gz
Updated to the new version.
-rw-r--r--.INSTALL10
-rw-r--r--.SRCINFO6
-rw-r--r--PKGBUILD6
-rw-r--r--install_r_deps.R2
-rw-r--r--run.pl2
-rwxr-xr-xrun.sh94
-rw-r--r--swish-cplint.service3
7 files changed, 87 insertions, 36 deletions
diff --git a/.INSTALL b/.INSTALL
index ebe4b16f5635..91b329d8c053 100644
--- a/.INSTALL
+++ b/.INSTALL
@@ -1,12 +1,16 @@
startdir=
post_install() {
- # Add user and group.
+ # Add swish user and group.
getent group swish &>/dev/null || groupadd -r swish >/dev/null
getent passwd swish &>/dev/null || useradd -m -d /home/swish \
-r -g swish swish >/dev/null
- # Copy install script.
+ # Add swish user to the rserve group. If this is not done, access to the
+ # socket would be forbidden.
+ gpasswd -a swish rserve >/dev/null
+
+ # Copy the install script.
install -D -m744 ${startdir}/install_web_iface_deps.pl /home/swish/install_web_iface_deps.pl
chown swish:swish /home/swish/install_web_iface_deps.pl
@@ -22,6 +26,8 @@ swish-cplint.service to run the server."
pre_remove() {
echo ""
echo ""
+ echo "UNIMPLEMENTED"
+ echo ""
rm -rf /home/swish/lib
echo ""
echo ""
diff --git a/.SRCINFO b/.SRCINFO
index a016980ca63c..00f9b2ae76e0 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,7 +1,7 @@
pkgbase = swish-cplint
pkgdesc = SWI-Prolog for SHaring: a SWI-Prolog web IDE integrated with the cplint suite
- pkgver = r8.13b29c6
- pkgrel = 4
+ pkgver = r1673.4e5dd96
+ pkgrel = 1
url = https://github.com/friguzzi/swish
install = .INSTALL
arch = x86_64
@@ -10,7 +10,7 @@ pkgbase = swish-cplint
makedepends = bower
makedepends = sed
depends = swi-prolog-devel
- depends = r
+ depends = rserve-sandbox-docker
conflicts = swish
source = git://github.com/friguzzi/swish#branch=master
md5sums = SKIP
diff --git a/PKGBUILD b/PKGBUILD
index 738bc96a632f..1b6ce979c93e 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,14 +1,14 @@
# Maintainer: Franco Masotti <franco dot masotti at student dot unife dot it>
# Contributor: Franco Masotti <franco dot masotti at student dot unife dot it>
pkgname=swish-cplint
-pkgver=r8.13b29c6
-pkgrel=4
+pkgver=r1673.4e5dd96
+pkgrel=1
pkgdesc="SWI-Prolog for SHaring: a SWI-Prolog web IDE integrated with the cplint suite"
arch=('x86_64')
url="https://github.com/friguzzi/swish"
license=('BSD')
depends=('swi-prolog-devel'
- 'r')
+ 'rserve-sandbox-docker')
makedepends=('git'
'bower'
'sed')
diff --git a/install_r_deps.R b/install_r_deps.R
deleted file mode 100644
index 0f00d9385513..000000000000
--- a/install_r_deps.R
+++ /dev/null
@@ -1,2 +0,0 @@
-install.packages(c("ggplot2"), repos="http://cran.us.r-project.org", dependencies=TRUE)
-install.packages("Rserve",,"http://rforge.net/",type="source")
diff --git a/run.pl b/run.pl
index 0c1263b0d5d8..63372c37d5ec 100644
--- a/run.pl
+++ b/run.pl
@@ -26,6 +26,8 @@
*/
:- use_module(server).
+:- use_module(lib/r_swish).
+:- use_module(library(r/r_sandbox)).
% Using `localhost:3050`, we only bind to localhost interface!
% Use plain `3050` (or any port number you like) to make the server
diff --git a/run.sh b/run.sh
index 703c075d1533..73fececf69ba 100755
--- a/run.sh
+++ b/run.sh
@@ -24,6 +24,7 @@
# This is the file called from the /usr/bin/swish-cplint symlink
+pkg_dir="/usr/share/swish-cplint"
pid_file="/run/swish-cplint.pid"
installed_file="/home/swish/installed"
deps_installer="/home/swish/install_web_iface_deps.pl"
@@ -53,18 +54,6 @@ and at: <https://github.com/friguzzi/cplint>
EOF
}
-kill()
-{
- # kill action only if process exists.
- if [ -f "$pid_file" ]; then
- pid=$(cat "$pid_file")
- ps -q $pid > /dev/null
- if [ $? -eq 0 ]; then
- kill -s SIGTERM $pid
- fi
- fi
-}
-
initialize()
{
if [ -f "$installed_file" ]; then
@@ -81,39 +70,92 @@ initialize()
fi
}
-start()
+startd()
{
+ local pid=""
+
{
- ( initialize && exec swipl --quiet -f /usr/share/swish-cplint/run.pl ) &
+ ( initialize && exec swipl --quiet -f "$pkg_dir"/run.pl ) &
pid="$!"
} 1>/dev/null 2>/dev/null
+ write_pid_file "$pid"
+}
+
+#
+# shared_functions.sh
+#
+# Copyright (C) 2016 frnmst (Franco Masotti) <franco.masotti@student.unife.it>
+#
+# This file is part of cplint-installer.
+#
+# cplint-installer is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# cplint-installer is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with cplint-installer. If not, see <http://www.gnu.org/licenses/>.
+#
+#
+
+# This file is used by the various run.sh.
+
+check_running_user_and_group()
+{
+ if [ "$(id -un)" = "$user" ] && [ "$(id -gn)" = "$group" ]; then
+ :
+ else
+ printf "User must be "$user"\n"
+ printf "Group must be "$group"\n"
+ return 1
+ fi
+}
+
+write_pid_file()
+{
+ local pid="$1"
+
if [ -n "$pid" ]; then
printf "Server running with pid $pid\n"
printf "$pid\n" > "$pid_file"
else
printf "Server error\n"
- exit 1
+ return 1
fi
-
}
-main()
+killd()
{
- if [ "$(id -un)" == "$user" ] && [ "$(id -gn)" == "$group" ]; then
- :
- else
- printf "User and group must be swish\n"
- exit 1
+ # kill action only if process exists.
+ if [ -f "$pid_file" ]; then
+ pid=$(cat "$pid_file")
+ ps -q $pid > /dev/null
+ if [ $? -eq 0 ]; then
+ kill -s SIGTERM $pid
+ fi
fi
+}
- getopts ":is" opt "$@"
+option_parser()
+{
+ getopts ":hks" opt "$@"
case "$opt" in
h) help ;;
- k) kill ;;
- s) start ;;
- ?) help ;;
+ k) killd ;;
+ s) startd ;;
+ ?) help; return 1 ;;
esac
}
+main()
+{
+ check_running_user_and_group && option_parser "$@"
+}
+
main "$@"
diff --git a/swish-cplint.service b/swish-cplint.service
index b58389668efc..04fe50802fba 100644
--- a/swish-cplint.service
+++ b/swish-cplint.service
@@ -25,6 +25,8 @@
[Unit]
Description=Cplint on SWISH
Documentation=http://github.com/friguzzi/cplint https://github.com/friguzzi/swish
+Requires=rserve-sandbox-docker.service
+After=rserve-sandbox-docker.service
[Service]
# Run ExecStartPre with root permissions.
@@ -38,5 +40,6 @@ User=swish
Group=swish
[Install]
+Also=rserve-sandbox-docker.service
WantedBy=default.target