summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorfrnmst/Franco Masotti2016-11-15 17:23:36 +0100
committerfrnmst/Franco Masotti2016-11-15 17:23:36 +0100
commit837bf13b0db0bef9ef6ce2f3825125d66c0b42eb (patch)
treef132d479fe42e55677e335c6481b3b09309b4bbb
parentf2e30c272d07932a1da9cdc26d10a19cff05aebe (diff)
downloadaur-837bf13b0db0bef9ef6ce2f3825125d66c0b42eb.tar.gz
Added install option. Lots of fixes.
-rw-r--r--.SRCINFO5
-rw-r--r--.install12
-rw-r--r--PKGBUILD7
-rwxr-xr-xrun.sh64
4 files changed, 47 insertions, 41 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 38e2ebb4cdf1..5ba66c21217d 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 = r1673.4e5dd96
- pkgrel = 3
+ pkgrel = 4
url = https://github.com/friguzzi/swish
install = .install
arch = x86_64
@@ -9,6 +9,9 @@ pkgbase = swish-cplint
makedepends = git
makedepends = bower
makedepends = sed
+ depends = libxinerama
+ depends = libxpm
+ depends = git
depends = swi-prolog-devel
depends = rserve-sandbox-docker
conflicts = swish
diff --git a/.install b/.install
index 98974d05a554..c4aeefd3c07c 100644
--- a/.install
+++ b/.install
@@ -11,11 +11,15 @@ post_install() {
chown -R swish:swish /usr/share/swish-cplint
- printf "\n\nYou can start and enable \
-swish-cplint.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 swish swish-cplint -i"
+ printf "%s\n\n" "You can then start and enable \
+swish-cplint.service to run the server."
+
}
post_remove() {
- printf "\n\nYou can remove /home/swish.\n"
- printf "You can also remove swish user and group.\n\n"
+ printf "\n\n%s\n" "You can remove /home/swish."
+ printf "%s\n\n" "You can also remove swish user and group."
}
diff --git a/PKGBUILD b/PKGBUILD
index 08ac755ce274..63fa27095150 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -2,12 +2,15 @@
# Contributor: Franco Masotti <franco dot masotti at student dot unife dot it>
pkgname=swish-cplint
pkgver=r1673.4e5dd96
-pkgrel=3
+pkgrel=4
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'
+depends=('libxinerama'
+ 'libxpm'
+ 'git'
+ 'swi-prolog-devel'
'rserve-sandbox-docker')
makedepends=('git'
'bower'
diff --git a/run.sh b/run.sh
index 7f3b99d65f1f..26c502d1e399 100755
--- a/run.sh
+++ b/run.sh
@@ -37,11 +37,9 @@ help()
swish-cplint [OPTION]
SWI-Prolog for SHaring: a SWI-Prolog web IDE integrated with the cplint suite
-The first time swish-cplint is executed, all SWI Prolog dependencies will be
-installed.
-
Only a single option is permitted.
-h print this help
+ -i install dependencies
-k kill swish-cplint
-s start swish-cplint
@@ -54,20 +52,27 @@ and at: <https://github.com/friguzzi/cplint>
EOF
}
-initialize()
+init()
{
- if [ -f "$installed_file" ]; then
- :
+ printf "%s\n" "This may take a while."
+ pushd "$pkg_dir"
+ $deps_installer
+ if [ $? -eq 0 ]; then
+ echo "# Don't touch this file" > "$installed_file"
+ echo "true" >> "$installed_file"
else
- printf "This may take a while.\n"
- $deps_installer
- if [ $? -eq 0 ]; then
- echo "# Don't touch this file" > "$installed_file"
- echo "true" >> "$installed_file"
- else
- printf "Install web dependencies error\n"
- exit 1
- fi
+ 1>&2 printf "%s\n" "Install web dependencies error"
+ exit 1
+ fi
+}
+
+installed()
+{
+ if [ ! -f "$installed_file" ]; then
+ 1>&2 printf "%s\n" "You need to run \
+'sudo -u swish swish-cplint -i' \
+first"
+ exit 1
fi
}
@@ -87,13 +92,15 @@ startd()
{
local pid=""
+ # The following means installed && { ... }
+ installed
{
(
cd "$pkg_dir"
- initialize && exec swipl --quiet -f "$pkg_dir"/run.pl
+ exec swipl --quiet -f "$pkg_dir"/run.pl
) &
pid="$!"
- } 1>/dev/null 2>/dev/null
+ } 1>&2
write_pid_file "$pid"
}
@@ -146,26 +153,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
}