diff options
author | Max Devaine | 2015-06-16 00:54:34 +0200 |
---|---|---|
committer | Max Devaine | 2015-06-16 00:54:34 +0200 |
commit | 4a9221fe1f9e4d0e89e42ac6f704d2bc00b3e5a3 (patch) | |
tree | d22c85afcd1fe114984cc9f89b7d62afe7b95cdc | |
download | aur-4a9221fe1f9e4d0e89e42ac6f704d2bc00b3e5a3.tar.gz |
Initial import
-rw-r--r-- | .SRCINFO | 18 | ||||
-rw-r--r-- | PKGBUILD | 84 | ||||
-rwxr-xr-x | flexibee | 134 | ||||
-rw-r--r-- | flexibee.install | 31 |
4 files changed, 267 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 000000000000..daccbee29617 --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,18 @@ +pkgbase = flexibee + pkgdesc = Accounting economic system for person and business. Server and client in one package. + pkgver = 2015.3.3 + pkgrel = 1 + url = http://www.flexibee.eu + install = flexibee.install + arch = i686 + arch = x86_64 + license = custom + depends = glibc + depends = java-environment + source = http://download.flexibee.eu/download/2015.3/2015.3.3/flexibee-2015.3.3.tar.gz + source = flexibee + sha256sums = 69de471c621d36d98720552f217e0a3821a045030a07aafc7920e525bd3c3bd3 + sha256sums = 0aaf79ac30bfc5af5e9aba6d1b1189a76019551d3183621bcb9f2bdbe7ea39e3 + +pkgname = flexibee + diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 000000000000..f9131086be67 --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,84 @@ +# Contributor: Max Devaine <maxdevaine@gmail.com> + +pkgname=flexibee +pkgver=2015.3.3 +pkgbasever=2015.3 +pkgrel=1 +pkgdesc="Accounting economic system for person and business. Server and client in one package." +arch=('i686' 'x86_64') +url="http://www.flexibee.eu" +license=('custom') +depends=('glibc' 'java-environment') +install=flexibee.install +source=("http://download.flexibee.eu/download/$pkgbasever/$pkgver/flexibee-$pkgver.tar.gz" + "flexibee") + +sha256sums=('69de471c621d36d98720552f217e0a3821a045030a07aafc7920e525bd3c3bd3' + '0aaf79ac30bfc5af5e9aba6d1b1189a76019551d3183621bcb9f2bdbe7ea39e3') + +prepare() { + cd ${srcdir}/flexibee-$pkgver + + #replace postgresql port + sed -i 's/<entry key="port">5435/<entry key="port">5432/' etc/flexibee/flexibee-server.xml + + #replace flexibee user + sed -i 's/FLEXIBEE_USER="winstrom"/FLEXIBEE_USER="flexibee"/' etc/default/flexibee + + #replace flexibee user + sed -i 's/FLEXIBEE_USER="winstrom"/FLEXIBEE_USER="flexibee"/' usr/sbin/flexibee-server + + rm -rf etc/init.d +} + +package() { + + cd ${srcdir}/flexibee-$pkgver + + # Prepare destination directory + install -d -m 755 "${pkgdir}/usr/share/fonts/TTF" + install -d -m 755 "${pkgdir}/usr/bin" + install -d -m 755 "${pkgdir}/etc/flexibee" + install -d -m 755 "${pkgdir}/etc/logrotate.d" + install -d -m 755 "${pkgdir}/etc/default" + install -d -m 755 "${pkgdir}/etc/rc.d" + install -d -m 755 "${pkgdir}/usr/share/licenses/${pkgname}" + + # Install rc script + install -m 755 ${startdir}/flexibee "${pkgdir}/etc/rc.d/" + + # Install fonts and license + install -m 644 ./usr/share/fonts/truetype/*.ttf "${pkgdir}/usr/share/fonts/TTF" + install -m 644 ./usr/share/doc/flexibee/LICENSE.txt "${pkgdir}/usr/share/licenses/${pkgname}" + install -m 644 ./usr/share/doc/flexibee/THIRDPARTYLICENSE.txt "${pkgdir}/usr/share/licenses/${pkgname}" + + #config file + install -m 644 ./etc/flexibee/* "${pkgdir}/etc/flexibee/" + install -m 644 ./etc/default/* "${pkgdir}/etc/default/" + install -m 644 ./etc/logrotate.d/* "${pkgdir}/etc/logrotate.d/" + + + #binary + rm -rf ./usr/share/fonts + rm -rf ./usr/share/app-install + + for f in $(find ./usr/share -type d) + do + install -d -m 755 ${pkgdir}/${f} + done + + for f in $(find ./usr/share -type f) + do + if [ -x ${f} ] + then + install -m 755 ${f} "${pkgdir}/${f}" + else + install -m 644 ${f} "${pkgdir}/${f}" + fi + done + + install -m 755 ./usr/bin/flexibee "${pkgdir}/usr/bin/" + install -m 744 ./usr/sbin/flexibee-server "${pkgdir}/usr/bin/" + +} + diff --git a/flexibee b/flexibee new file mode 100755 index 000000000000..5a12b7a2e31d --- /dev/null +++ b/flexibee @@ -0,0 +1,134 @@ +#!/bin/bash +# Created by Max Devaine <maxdevaine@gmail.com> +# Last update : 7.7.2014 + +PATH=/sbin:/bin:/usr/sbin:/usr/bin:/opt/java/jre/bin +FLEXIBEE_PID=/var/run/flexibee.pid +FLEXIBEE_USER="flexibee" +MYLANG=`echo $LANG | cut -c 1-2` +CONFIGFILE=/etc/flexibee/flexibee-server.xml +DEFAULTCONFIGFILE=/etc/default/flexibee + +case "$1" in + start) + +### detect flexibee default configuration file +if [ -f /etc/default/flexibee ]; then + . /etc/default/flexibee +fi + +### detect flexibee server mode (if is define) +if [ x"$DEFAULTCONFIGFILE" = x"client" ]; then + + if [ x"$MYLANG" = x"cs" ]; then + echo "FlexiBee je vypnutý. Změňte hodnotu FLEXIBEE_CFG z 'client' na 'local' nebo 'server' v /etc/default/flexibee" + else + echo "FlexiBee is disabled. Change FLEXIBEE_CFG from 'client' to 'local' or 'server' in /etc/default/flexibee" + fi + exit 0 +fi + + +### detect postgresql server runing +if [ ! 'systemctl status postgresql' ]; then + + if [ x"$MYLANG" = x"cs" ]; then + echo "Neběží postgresql databáze. Spusťte jí pomocí : systemctl start postgresql" + else + echo "Postgresql database not running, run the database : systemctl start postgresql " + fi + exit 0 +fi + + +### detect flexibee running + if [ -e $FLEXIBEE_PID ]; then + + if [ x"$MYLANG" = x"cs" ]; then + echo "Flexibee server je už spuštěn!" + else + echo "Flexibee server is running!" + fi + exit 0 + fi + +### run flexibee server + /usr/sbin/flexibee-server + +### detect running flexibee server + if [ -e $FLEXIBEE_PID ]; then + + if [ x"$MYLANG" = x"cs" ]; then + echo "Flexibee server byl úspěšně spuštěn." + else + echo "Flexibee server successfully started" + fi + exit 0 + else + if [ x"$MYLANG" = x"cs" ]; then + echo "Chyba při spouštění flexibee serveru!" + else + echo "Error when starting flexibee server!" + fi + + fi + + + ;; + stop) + + if [ ! -e $FLEXIBEE_PID ]; then + + if [ x"$MYLANG" = x"cs" ]; then + echo "Chyba : Flexibee server není spuštěn." + else + echo "Error : Flexibee server is not running" + fi + exit 0 + fi + + kill `cat $FLEXIBEE_PID` + rm -f $FLEXIBEE_PID + + ;; + restart) + $0 stop + sleep 2 + $0 start + ;; + install) + + echo "---> 1) Create system user and group : flexibee" + echo " useradd --system --home-dir /tmp --no-create-home --user-group --shell /bin/false flexibee" + useradd --system --home-dir /tmp --no-create-home --user-group --shell /bin/false flexibee + + echo "---> 2) Create database role with random secret password : " + echo " su - postgres -c CREATE ROLE dba PASSWORD '********' CREATEDB SUPERUSER CREATEROLE INHERIT LOGIN;" + + ### generate random password + pass=`</dev/urandom tr -dc A-Za-z0-9| (head -c $1 > /dev/null 2>&1 || head -c 23)` + + ### create database role + su - postgres -c "psql -c \"CREATE ROLE dba PASSWORD '$pass' CREATEDB SUPERUSER CREATEROLE INHERIT LOGIN;\"" + + + echo "---> 3) The database role password adding to flexibee configuration file $CONFIGFILE" + echo " cat $CONFIGFILE | sed '/password/s/7971/**********/g' > $CONFIGFILE.new" + echo " mv $CONFIGFILE.new $CONFIGFILE" + cat $CONFIGFILE | sed '/password/s/7971/'$pass'/g' > $CONFIGFILE.new + mv $CONFIGFILE.new $CONFIGFILE + pass=0 + + echo "---> 4) Change file permission to flexibee configuration file" + echo " chmod 600 $CONFIGFILE" + echo " chown flexibee $CONFIGFILE" + chmod 600 $CONFIGFILE + chown flexibee $CONFIGFILE + + + ;; + *) + echo "usage: $0 {start|stop|restart|install}" +esac +exit 0 + diff --git a/flexibee.install b/flexibee.install new file mode 100644 index 000000000000..15f09b7f9fb7 --- /dev/null +++ b/flexibee.install @@ -0,0 +1,31 @@ +post_install() { + + echo -n "Updating font cache... " + fc-cache -fs >/dev/null + mkfontscale /usr/share/fonts/TTF /usr/share/fonts/Type1 + mkfontdir /usr/share/fonts/TTF /usr/share/fonts/Type1 + echo "done" + + echo -n "Updating desktop database... " + update-desktop-database -q + update-mime-database usr/share/mime + echo "done" + + echo "If you use this package for server instalation, then you must :" + echo " 1) Install this packages :" + echo " postgresql" + echo " postgresql-libs" + echo " 2) Create system user, database role, change database port, change permissions... :" + echo " /etc/rc.d/flexibee install" + echo " 3) Run flexibee server :" + echo " /etc/rc.d/flexibee start" + +} + +post_upgrade() { + post_install +} + +post_remove() { + post_install +} |