summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorfrnmst/Franco Masotti2016-11-15 17:20:54 +0100
committerfrnmst/Franco Masotti2016-11-15 17:20:54 +0100
commit486cd1011db67dfe820646bf9b75b877eb9b2022 (patch)
tree2c882dc87075192f49f4c3a89d1eadd7be7c656f
parentf54ef2a5aa63fd36026f5598fc46fbc23cbdd6b3 (diff)
downloadaur-486cd1011db67dfe820646bf9b75b877eb9b2022.tar.gz
Added install option. Lots of fixes.
-rw-r--r--.SRCINFO2
-rw-r--r--.install16
-rw-r--r--PKGBUILD2
-rwxr-xr-xrun.sh79
4 files changed, 45 insertions, 54 deletions
diff --git a/.SRCINFO b/.SRCINFO
index a9151b641821..f0202bf4fbad 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,7 +1,7 @@
pkgbase = rserve-sandbox-docker
pkgdesc = Docker spec for running Rserve in a sandbox
pkgver = r24.8499ca9
- pkgrel = 2
+ pkgrel = 3
url = https://github.com/frnmst/rserve-sandbox
install = .install
arch = x86_64
diff --git a/.install b/.install
index f7d1def0e2c6..d6914b0e2742 100644
--- a/.install
+++ b/.install
@@ -18,14 +18,18 @@ post_install() {
chown -R rsd:rsd /usr/share/rserve-sandbox-docker
- printf "\n\nYou can start and enable \
-rserve-sandbox-docker.service to run the server.\n\n"
+ printf "\n\n%s\n\n" "To initialize and download all the necessary \
+components you must run: \
+sudo -u rsd rserve-sandbox-docker -i"
+ printf "%s\n\n" "You can then start and enable \
+rserve-sandbox-docker.service to run the server."
}
post_remove() {
- printf "\n\nTo remove images and containters: rm -rf /var/lib/docker \
+ printf "\n\n%s\n" "To remove images and containters: \
+rm -rf /var/lib/docker \
as described in \
-https://docs.docker.com/engine/installation/linux/archlinux/#/uninstallation\n"
- printf "You can also remove /home/rserve\n"
- printf "as well as rserve and rsd users and groups.\n\n"
+<https://docs.docker.com/engine/installation/linux/archlinux/#/uninstallation>"
+ printf "%s\n\n" "You can also remove /home/rserve \
+as well as rserve and rsd users and groups."
}
diff --git a/PKGBUILD b/PKGBUILD
index 6d2ce2916c32..39ac339f56bb 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -2,7 +2,7 @@
# Contributor: Franco Masotti <franco dot masotti at student dot unife dot it>
pkgname=rserve-sandbox-docker
pkgver=r24.8499ca9
-pkgrel=2
+pkgrel=3
pkgdesc="Docker spec for running Rserve in a sandbox"
arch=('x86_64')
url="https://github.com/frnmst/rserve-sandbox"
diff --git a/run.sh b/run.sh
index 79f3ffe582f3..fcc09cf13d13 100755
--- a/run.sh
+++ b/run.sh
@@ -5,20 +5,20 @@
#
# Copyright (C) 2016 frnmst (Franco Masotti) <franco.masotti@student.unife.it>
#
-# This file is part of cplint-installer.
+# This file is part of swish-installer.
#
-# cplint-installer is free software: you can redistribute it and/or modify
+# swish-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,
+# swish-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/>.
+# along with swish-installer. If not, see <http://www.gnu.org/licenses/>.
#
#
@@ -34,13 +34,11 @@ help()
rsd [OPTION]
Docker spec for running Rserve in a sandbox
-The first time rserve-sandbox-docker is executed,
-a docker image will be downloaded. This operation might take a while.
-
Only a single option is permitted.
-h print this help
- -k kill rsd
- -s start rsd
+ -i install dependencies
+ -k kill rserve-sandbox-docker
+ -s start rserve-sandbox-docker
Exit status:
0 if OK,
@@ -50,28 +48,26 @@ Full documentation at: <https://github.com/frnmst/rserve-sandbox>
EOF
}
-# Kill ideas (deprecated).
- # This addresses only docker containers available to rsd:rsd.
- # Simple solution.
-
-
- # More complex solution requires deleting all containers (running and
- # stopped) matching rserve-sandbox-docker
- # If this is not done, the hard disk might get full quickly.
- # Something like the following might be useful.
- #
- # containers="$(docker ps -a -f status=exited \
-#--format \"{{.ID}}\\t{{.Image}}\" | grep rserve-sandbox-docker)"
- # echo "$containers" | awk '{print $1} | xargs docker rm
-
- # Or simply add rm option to the makefile
-
-initialize()
+init()
{
# Check if rserve image does not exist.
if [ -z "$(docker images -q "$docker_image_name")" ]; then
- printf "This might take a while\n"
+ printf "%s\n" "This might take a while"
+ pushd "$pkg_dir"
make image
+ else
+ 1>&2 printf "%s\n" "Docker image already installed"
+ exit 1
+ fi
+}
+
+installed()
+{
+ if [ -z "$(docker images -q "$docker_image_name")" ]; then
+ 1>&2 printf "%s\n" "You need to run \
+'sudo -u rsd rserve-sandbox-docker -i' \
+first"
+ exit 1
fi
}
@@ -92,13 +88,15 @@ startd()
{
local pid=""
+ # The following means installed && { ... }
+ installed
{
(
cd "$pkg_dir"
- initialize && make run
+ make run
) &
pid="$!"
- } 1>/dev/null 2>/dev/null
+ }
write_pid_file "$pid"
}
@@ -151,26 +149,15 @@ write_pid_file()
fi
}
-killd()
-{
- # 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 TERM $pid
- fi
- fi
-}
-
option_parser()
{
- getopts ":hks" opt "$@"
+ getopts ":hiks" opt "$@"
case "$opt" in
- h) help ;;
- k) killd ;;
- s) startd ;;
- ?) help; return 1 ;;
+ h ) help ;;
+ i ) init ;;
+ k ) killd ;;
+ s ) startd ;;
+ ? ) help; return 1 ;;
esac
}