Browse Source

Updated to the new version.

master
frnmst/Franco Masotti 6 years ago
parent
commit
66a33ab3bc
  1. 34
      .INSTALL
  2. 6
      .SRCINFO
  3. 21
      .install
  4. 31
      PKGBUILD
  5. 40
      remove_web_iface_deps.pl
  6. 31
      run.sh
  7. 25
      swish-cplint.conf
  8. 6
      swish-cplint.service

34
.INSTALL

@ -1,34 +0,0 @@
startdir=
post_install() {
# 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
# 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
echo ""
echo ""
echo "You can start and enable \
swish-cplint.service to run the server."
echo ""
echo ""
}
# Trivial remove.
pre_remove() {
echo ""
echo ""
echo "UNIMPLEMENTED"
echo ""
rm -rf /home/swish/lib
echo ""
echo ""
}

6
.SRCINFO

@ -1,9 +1,9 @@
pkgbase = swish-cplint
pkgdesc = SWI-Prolog for SHaring: a SWI-Prolog web IDE integrated with the cplint suite
pkgver = r1673.4e5dd96
pkgrel = 1
pkgrel = 2
url = https://github.com/friguzzi/swish
install = .INSTALL
install = .install
arch = x86_64
license = BSD
makedepends = git
@ -12,7 +12,7 @@ pkgbase = swish-cplint
depends = swi-prolog-devel
depends = rserve-sandbox-docker
conflicts = swish
source = git://github.com/friguzzi/swish#branch=master
source = git+https://github.com/friguzzi/swish#branch=master
md5sums = SKIP
pkgname = swish-cplint

21
.install

@ -0,0 +1,21 @@
post_install() {
# Add swish user and group with a home directory (which will contain all
# the packs).
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
# Add swish user to the rserve group. If this is not done, access to the
# socket will be forbidden.
gpasswd -a swish rserve >/dev/null
chown -R swish:swish /usr/share/swish-cplint
printf "\n\nYou can start and enable \
swish-cplint.service to run the server.\n\n"
}
post_remove() {
printf "\n\nYou can remove /home/swish.\n"
printf "You can also remove swish user and group.\n\n"
}

31
PKGBUILD

@ -2,7 +2,7 @@
# Contributor: Franco Masotti <franco dot masotti at student dot unife dot it>
pkgname=swish-cplint
pkgver=r1673.4e5dd96
pkgrel=1
pkgrel=2
pkgdesc="SWI-Prolog for SHaring: a SWI-Prolog web IDE integrated with the cplint suite"
arch=('x86_64')
url="https://github.com/friguzzi/swish"
@ -13,24 +13,18 @@ makedepends=('git'
'bower'
'sed')
conflicts=('swish')
install=.INSTALL
source=('git://github.com/friguzzi/swish#branch=master')
install=.install
source=('git+https://github.com/friguzzi/swish#branch=master')
md5sums=('SKIP')
prepare() {
# Edit the .INSTALL script.
sed \
-e "s@startdir=.*@startdir="${startdir}"@" \
-i ${startdir}/.INSTALL
}
build() {
cd ${srcdir}/swish
bower --allow-root install
make src
# Patch
cp ${startdir}/run.pl .
cp ${startdir}/run.sh .
cp ../../run.pl .
cp ../../run.sh .
cp ../../install_web_iface_deps.pl .
}
pkgver () {
@ -43,11 +37,10 @@ pkgver () {
package() {
cd ${srcdir}
install -d ${pkgdir}/usr/share/${pkgname}
install -d ${pkgdir}/usr/bin
cp -r swish/* ${pkgdir}/usr/share/${pkgname}
install -D -m644 swish/LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
install -D -m644 ${startdir}/${pkgname}.service "${pkgdir}/usr/lib/systemd/system/${pkgname}.service"
install -D -m644 ${startdir}/${pkgname}.conf "${pkgdir}/usr/lib/tmpfiles.d/${pkgname}.conf"
ln -s /usr/share/${pkgname}/run.sh ${pkgdir}/usr/bin/${pkgname}
install -d "${pkgdir}"/usr/share/"${pkgname}"
install -d "${pkgdir}"/usr/bin
cp -r swish/* "${pkgdir}"/usr/share/"${pkgname}"
install -D -m644 swish/LICENSE "${pkgdir}"/usr/share/licenses/"${pkgname}"/LICENSE
install -D -m644 ../"${pkgname}".service ${pkgdir}/usr/lib/systemd/system/"${pkgname}".service
ln -s /usr/share/"${pkgname}"/run.sh "${pkgdir}"/usr/bin/"${pkgname}"
}

40
remove_web_iface_deps.pl

@ -1,40 +0,0 @@
#!/usr/bin/env swipl
/*
*
* remove_web_iface_deps.pl
*
* 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/>.
*
*/
:- initialization main.
remove:-
pack_remove(aleph),
pack_remove(auc),
pack_remove(real),
pack_remove(matrix),
pack_remove(cplint),
pack_remove('rserve_client').
main:-
catch(remove, E, (print_message(error, E), fail)),
halt.
main:-
halt(1).

31
run.sh

@ -25,9 +25,9 @@
# 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"
pid_file="/run/swish-cplint/swish-cplint.pid"
installed_file=""$pkg_dir"/installed"
deps_installer=""$pkg_dir"/install_web_iface_deps.pl"
user="swish"
group="swish"
@ -62,7 +62,8 @@ initialize()
printf "This may take a while.\n"
$deps_installer
if [ $? -eq 0 ]; then
echo "true" > "$installed_file"
echo "# Don't touch this file" > "$installed_file"
echo "true" >> "$installed_file"
else
printf "Install web dependencies error\n"
exit 1
@ -70,6 +71,18 @@ initialize()
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
}
startd()
{
local pid=""
@ -87,20 +100,20 @@ startd()
#
# 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/>.
#
#
@ -137,7 +150,7 @@ killd()
pid=$(cat "$pid_file")
ps -q $pid > /dev/null
if [ $? -eq 0 ]; then
kill -s SIGTERM $pid
kill -s TERM $pid
fi
fi
}

25
swish-cplint.conf

@ -1,25 +0,0 @@
#
# swish-cplint.conf
#
# 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/>.
#
#
# To be placed in /usr/lib/tmpfiles.d/swish-cplint.conf
f /run/swish-cplint.pid 0755 swish swish -

6
swish-cplint.service

@ -29,15 +29,13 @@ Requires=rserve-sandbox-docker.service
After=rserve-sandbox-docker.service
[Service]
# Run ExecStartPre with root permissions.
PermissionsStartOnly=true
ExecStartPre=/usr/bin/systemd-tmpfiles --create swish-cplint.conf
ExecStart=/usr/bin/swish-cplint -s
ExecStop=/usr/bin/swish-cplint -k
Type=forking
PIDFile=/run/swish-cplint.pid
PIDFile=/run/swish-cplint/swish-cplint.pid
User=swish
Group=swish
RuntimeDirectory=swish-cplint
[Install]
Also=rserve-sandbox-docker.service

Loading…
Cancel
Save