diff options
author | frnmst/Franco Masotti | 2016-11-15 17:23:36 +0100 |
---|---|---|
committer | frnmst/Franco Masotti | 2016-11-15 17:23:36 +0100 |
commit | 837bf13b0db0bef9ef6ce2f3825125d66c0b42eb (patch) | |
tree | f132d479fe42e55677e335c6481b3b09309b4bbb | |
parent | f2e30c272d07932a1da9cdc26d10a19cff05aebe (diff) | |
download | aur-837bf13b0db0bef9ef6ce2f3825125d66c0b42eb.tar.gz |
Added install option. Lots of fixes.
-rw-r--r-- | .SRCINFO | 5 | ||||
-rw-r--r-- | .install | 12 | ||||
-rw-r--r-- | PKGBUILD | 7 | ||||
-rwxr-xr-x | run.sh | 64 |
4 files changed, 47 insertions, 41 deletions
@@ -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 @@ -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." } @@ -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' @@ -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 } |