Accepting request 423944 from Application:ERP:Tryton:Factory
File permissions corrected OBS-URL: https://build.opensuse.org/request/show/423944 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/gnuhealth?expand=0&rev=1
This commit is contained in:
commit
3bd79d2cb6
23
.gitattributes
vendored
Normal file
23
.gitattributes
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
## Default LFS
|
||||
*.7z filter=lfs diff=lfs merge=lfs -text
|
||||
*.bsp filter=lfs diff=lfs merge=lfs -text
|
||||
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
||||
*.gem filter=lfs diff=lfs merge=lfs -text
|
||||
*.gz filter=lfs diff=lfs merge=lfs -text
|
||||
*.jar filter=lfs diff=lfs merge=lfs -text
|
||||
*.lz filter=lfs diff=lfs merge=lfs -text
|
||||
*.lzma filter=lfs diff=lfs merge=lfs -text
|
||||
*.obscpio filter=lfs diff=lfs merge=lfs -text
|
||||
*.oxt filter=lfs diff=lfs merge=lfs -text
|
||||
*.pdf filter=lfs diff=lfs merge=lfs -text
|
||||
*.png filter=lfs diff=lfs merge=lfs -text
|
||||
*.rpm filter=lfs diff=lfs merge=lfs -text
|
||||
*.tbz filter=lfs diff=lfs merge=lfs -text
|
||||
*.tbz2 filter=lfs diff=lfs merge=lfs -text
|
||||
*.tgz filter=lfs diff=lfs merge=lfs -text
|
||||
*.ttf filter=lfs diff=lfs merge=lfs -text
|
||||
*.txz filter=lfs diff=lfs merge=lfs -text
|
||||
*.whl filter=lfs diff=lfs merge=lfs -text
|
||||
*.xz filter=lfs diff=lfs merge=lfs -text
|
||||
*.zip filter=lfs diff=lfs merge=lfs -text
|
||||
*.zst filter=lfs diff=lfs merge=lfs -text
|
56
GNUHealth.README.SUSE
Normal file
56
GNUHealth.README.SUSE
Normal file
@ -0,0 +1,56 @@
|
||||
GNUHealth for openSUSE
|
||||
======================
|
||||
|
||||
GNUHealth is a free Health and Hospital Information system build on top of Tryton, an OpenSource ERP framework.
|
||||
|
||||
This is the openSUSE package for GNUHealth. It was build to simplify the installation and maintenance of a system, to make it useable for 'end-users' as well.
|
||||
|
||||
To achieve this goal, the openSUSE package handles some things different than the GNUHealth standard:
|
||||
|
||||
1) No installation from source code
|
||||
GNUHealth has an installation script (gnuhealth_install.sh)that installs the Software from the source code.
|
||||
It has shown that this can cause a lot of trouble with dependencies (other software packages that are required to run GNUHealth and the Tryton Server), as they may be named slightly different in your Linux-distribution, or are just not listed.
|
||||
|
||||
To avoid hassle for each and every end user, openSUSE uses the Open Build Service [1] to create a package where all dependencies are resolved for you.
|
||||
|
||||
As a consequence, you install the package 'gnuhealth' with the openSUSE package manager, and the system does the rest for you. See [2] for installation advise.
|
||||
|
||||
2) GNUHealth depends on Tryton
|
||||
Tryton [3] is the technical backend for GNUHealth. Tryton can run as ERP-System on its own. For the reasons explained under 1) , Tryton is build as well as package for openSUSE, following the same philosophy. See [4]for details.
|
||||
|
||||
See as well: /usr/share/doc/packages/trytond/tryton-server.README.SUSE on your local installation
|
||||
|
||||
3) GNUHealth is build on top of Tryton
|
||||
Unlike the standard GNUHealth setup, openSUSE treats GNUHealth as add-on (additional modules) to a Tryton standard installation. The implications are:
|
||||
|
||||
- The Tryton Server (basis for GNUHealth) runs under the user 'tryton', not under the user 'gnuhealth'
|
||||
- you can use the openSUSE standard tools to start and stop the server [4]
|
||||
- you can use the openSUSE package manager (zypper or YaST) to install upgrades.
|
||||
- You *SHOULD NOT* use gnuhealth-control to install upgrades! gnuhealth-control forces an installation from source, and by this may break your installation
|
||||
- all Tryton and GNUHealth modules are installed in the python directory /usr/lib/python/site-packages/trytond
|
||||
|
||||
Nevertheless, you can use gnuhealth-control to create database backups, install languages and updates. Make sure the version of gnuhealth_control ends on -openSUSE
|
||||
|
||||
You may use the GNUHealth mailing list (health@gnu.org) for remarks or questions.
|
||||
|
||||
|
||||
Digital Signatures
|
||||
==================
|
||||
|
||||
In order to make use of GNUHealth's capabilities to digitally sign documents, you need to create a PGP-key for the user logged in to the operating system.
|
||||
|
||||
From the start menu, start the program Kgpg and follow the instructions, it will guide you through the process of key generation. Choose the maximal key length (4096).
|
||||
Use a passphrase with Capital letters, small letters, numbers and special characters (like %$§ etc) and have at least 12 digits for the passphrase - the more, the better.
|
||||
Keep the passphrase in a secure location, and take a backup of the PGP keys (located in ~/gnupg - in the live CD this is /home/gnuhealth/.gnupg ).
|
||||
|
||||
|
||||
Have fun and keep the neighborhood well and fit!
|
||||
|
||||
|
||||
[1] https://build.opensuse.org
|
||||
[2] http://en.wikibooks.org/wiki/GNU_Health/Operating_System-Specific_Notes#OpenSUSE
|
||||
[3] http://www.tryton.org
|
||||
[4] https://code.google.com/p/tryton/wiki/InstallationonopenSUSE
|
||||
|
||||
|
||||
-- Axel Braun <axel.braun@gmx.de> Tue, 27 Jan 2015 10:08:00 +0200
|
4
_service
Normal file
4
_service
Normal file
@ -0,0 +1,4 @@
|
||||
<services>
|
||||
|
||||
<service name="download_files" mode="localonly" />
|
||||
</services>
|
3
gnuhealth-3.0.3.tar.gz
Normal file
3
gnuhealth-3.0.3.tar.gz
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:980beedf052e0204e8d8d150d2b23ec6a08ebb1e6022315b34130767bdacbab5
|
||||
size 10260031
|
39
gnuhealth.changes
Normal file
39
gnuhealth.changes
Normal file
@ -0,0 +1,39 @@
|
||||
-------------------------------------------------------------------
|
||||
Wed Aug 31 06:26:10 UTC 2016 - axel.braun@gmx.de
|
||||
|
||||
- file permissions corrected
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Sun Aug 21 12:19:30 UTC 2016 - jengelh@inai.de
|
||||
|
||||
- Trim summary/description from redundant words
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Mon Jan 11 12:07:51 UTC 2016 - axel.braun@gmx.de
|
||||
|
||||
- version 3.0.0
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Mon Jan 4 07:27:41 UTC 2016 - axel.braun@gmx.de
|
||||
|
||||
- Version 3.0RC2
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Thu Jan 22 06:41:46 UTC 2015 - axel.braun@gmx.de
|
||||
|
||||
- version 2.8
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Thu Jul 10 14:55:14 UTC 2014 - axel.braun@gmx.de
|
||||
|
||||
- Release 2.6.0
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Wed Jan 22 07:44:06 UTC 2014 - axel.braun@gmx.de
|
||||
|
||||
- GnuHealth 2.4RC1 on Tryton 3.0
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Fri Oct 18 12:10:27 UTC 2013 - axel.braun@gmx.de
|
||||
|
||||
- Initial package build on OBS ( version 2.2.1 )
|
140
gnuhealth.spec
Normal file
140
gnuhealth.spec
Normal file
@ -0,0 +1,140 @@
|
||||
#
|
||||
# spec file for package GNU Health
|
||||
#
|
||||
# Copyright (c) 2014 SUSE LINUX GmbH, Nuernberg, Germany.
|
||||
# Copyright (c) 2014-2016 Dr. Axel Braun
|
||||
#
|
||||
# All modifications and additions to the file contributed by third parties
|
||||
# remain the property of their copyright owners, unless otherwise agreed
|
||||
# upon. The license for this file, and modifications and additions to the
|
||||
# file, is the same license as for the pristine package itself (unless the
|
||||
# license for the pristine package is not an Open Source License, in which
|
||||
# case the license is the MIT License). An "Open Source License" is a
|
||||
# license that conforms to the Open Source Definition (Version 1.9)
|
||||
# published by the Open Source Initiative.
|
||||
|
||||
# Please submit bugfixes or comments via http://bugs.opensuse.org/
|
||||
|
||||
%define majorver 3.0
|
||||
|
||||
Name: gnuhealth
|
||||
|
||||
# List of additional build dependencies
|
||||
BuildRequires: python-setuptools
|
||||
|
||||
Version: %{majorver}.3
|
||||
Release: 1
|
||||
License: GPL-3.0+
|
||||
|
||||
Url: http://health.gnu.org
|
||||
Source: http://ftp.gnu.org/gnu/health/%{name}-%{version}.tar.gz
|
||||
Source1: GNUHealth.README.SUSE
|
||||
Source2: gnuhealth_control
|
||||
|
||||
BuildArch: noarch
|
||||
|
||||
Requires(pre): /usr/sbin/groupadd
|
||||
Requires(pre): /usr/sbin/useradd
|
||||
|
||||
Group: Productivity/Office/Management
|
||||
|
||||
Summary: A Health and Hospital Information System
|
||||
|
||||
Requires: trytond
|
||||
Requires: python-ldap
|
||||
Requires: python-cracklib
|
||||
Requires: python-vobject
|
||||
Requires: proteus
|
||||
Requires: python-simpleeval
|
||||
Requires: python-hl7apy
|
||||
Requires: python-PyWebDAV
|
||||
Requires: python-qrcode
|
||||
Requires: python-six
|
||||
Requires: python-imaging
|
||||
Requires: python-caldav
|
||||
Requires: python-polib
|
||||
Requires: trytond_account
|
||||
Requires: trytond_account_invoice
|
||||
Requires: trytond_account_invoice_stock
|
||||
Requires: trytond_account_product
|
||||
Requires: trytond_calendar
|
||||
Requires: trytond_company
|
||||
Requires: trytond_country
|
||||
Requires: trytond_currency
|
||||
Requires: trytond_party
|
||||
Requires: trytond_product
|
||||
Requires: trytond_purchase
|
||||
Requires: trytond_stock
|
||||
Requires: trytond_stock_lot
|
||||
Requires: trytond_stock_supply
|
||||
|
||||
# additional suggestion for a useable editor
|
||||
Suggests: nano
|
||||
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||
|
||||
%description
|
||||
GNU Health is the Hospital Information System adopted by the United
|
||||
Nations University, International Institute for Global Health, for
|
||||
the implementations and trainings.
|
||||
|
||||
|
||||
%prep
|
||||
%setup -q -n %{name}-%{version}
|
||||
#%patch0 -p1
|
||||
cp %{S:1} .
|
||||
cp %{S:2} .
|
||||
|
||||
%build
|
||||
for i in h*; do
|
||||
cd $i
|
||||
python setup.py build
|
||||
cd ..
|
||||
done
|
||||
|
||||
#pdq
|
||||
cd pdq
|
||||
python setup.py build
|
||||
cd ..
|
||||
|
||||
%install
|
||||
for i in h*; do
|
||||
cd $i
|
||||
python setup.py install --prefix=%_prefix --root=%buildroot
|
||||
cd ..
|
||||
done
|
||||
#pdq
|
||||
cd pdq
|
||||
python setup.py install --prefix=%_prefix --root=%buildroot
|
||||
cd ..
|
||||
|
||||
mkdir -p -m 755 %{buildroot}%{_bindir}
|
||||
install -p -m 755 gnuhealth-control %{buildroot}%{_bindir}/gnuhealth-control
|
||||
|
||||
# create user
|
||||
%pre
|
||||
#getent group tryton > /dev/null || /usr/sbin/groupadd -r tryton
|
||||
#getent passwd gnuhealth > /dev/null || /usr/sbin/useradd -r -g tryton \
|
||||
# -d %{_localstatedir}/lib/%{name} -c 'GNU Health' gnuhealth
|
||||
# Dont create as system user
|
||||
#getent passwd gnuhealth > /dev/null || /usr/sbin/useradd -g tryton \
|
||||
# -c 'GNU Health' gnuhealth
|
||||
#:
|
||||
|
||||
#Write environment changes to /etc/bash.bashrc.local
|
||||
cat > /etc/bash.bashrc.local << "EOF"
|
||||
alias cdlogs='cd /var/log/trytond'
|
||||
alias cdexe='cd /usr/lib/python/site-packages/trytond'
|
||||
alias cdconf='cd /etc/tryton'
|
||||
alias cdmods='cd /usr/lib/python/site-packages/trytond/modules'
|
||||
alias editconf='${EDITOR} /etc/tryton/trytond.conf'
|
||||
EOF
|
||||
|
||||
%files
|
||||
%defattr(744,root,root)
|
||||
%{_bindir}/gnuhealth-control
|
||||
%defattr(-,root,root)
|
||||
%doc README Changelog COPYING gnuhealth-setup version gnuhealthrc GNUHealth.README.SUSE scripts/* backend/* config/* doc/*
|
||||
%{python_sitelib}/*
|
||||
|
||||
%changelog
|
442
gnuhealth_control
Normal file
442
gnuhealth_control
Normal file
@ -0,0 +1,442 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# gnuhealth-control
|
||||
# The GNU Health control center
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
# GNU Health: The Free Health and Hospital Information System
|
||||
# Copyright (C) 2008-2015 Luis Falcon <falcon@gnu.org>
|
||||
# Adaption to openSUSE Axel Braun <axel.braun@gmx.de>
|
||||
#
|
||||
# This program 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.
|
||||
#
|
||||
# This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
VERSION="3.0.2-openSUSE"
|
||||
|
||||
TRYTON_URL="http://downloads.tryton.org"
|
||||
GNUHEALTH_URL="http://ftp.gnu.org/gnu/health"
|
||||
TRANSLATE_URL="http://translate.gnusolidario.org"
|
||||
GNUHEALTH_DIR="/usr/lib/python/site-packages/trytond/modules"
|
||||
|
||||
UPDATE_DOWNLOAD_DIR="/tmp/gnuhealth_update"
|
||||
|
||||
usage()
|
||||
{
|
||||
cat << EOF
|
||||
|
||||
This is GNU Health control center ${VERSION}
|
||||
|
||||
usage: `basename $0` command [options]
|
||||
|
||||
Command:
|
||||
|
||||
version : Show version
|
||||
backup : Backup he gnuhealth kernel, attach dir and database
|
||||
update : Download and install the patches
|
||||
getlang : Get and install / update the language pack code
|
||||
status : Show environment and GNU Health Tryton server status
|
||||
|
||||
Options:
|
||||
|
||||
--backdir : destination directory for the backup file
|
||||
--dry-run : Check, download and preview, but don't actually update process
|
||||
--database : database name to use with the backup command
|
||||
|
||||
EOF
|
||||
exit 0
|
||||
}
|
||||
|
||||
help()
|
||||
{
|
||||
cat << EOF
|
||||
The GNU Health Control Center (gnuhealth-control) is the main tool for
|
||||
administrative tasks of the GNU Health environment.
|
||||
|
||||
It can perform backups and updates of the instance
|
||||
|
||||
Updates
|
||||
-------
|
||||
|
||||
Use the system tools to update GNU Health:
|
||||
zypper up
|
||||
will update all packages to the latest version. This includes Tryton Server
|
||||
as well as GNU Health.
|
||||
|
||||
EOF
|
||||
usage
|
||||
exit 0
|
||||
}
|
||||
|
||||
cli_msg()
|
||||
{
|
||||
local UTC="$(date -u +'%Y-%m-%d %H:%M:%S')"
|
||||
|
||||
case $1 in
|
||||
ERROR ) echo -e "\e[00;31m${UTC} [ERROR] $2\e[00m";;
|
||||
WARNING ) echo -e "\e[0;33m${UTC} [WARNING] $2\e[m" ;;
|
||||
INFO ) echo -e "\e[0;36m${UTC} [INFO] $2\e[m" ;;
|
||||
esac
|
||||
}
|
||||
|
||||
get_current_values()
|
||||
{
|
||||
# Bail out if no GNU Health profile exists
|
||||
#if [ ! -e $HOME/.gnuhealthrc ]
|
||||
#then
|
||||
# cli_msg "ERROR" "No GNU Health profile found !"
|
||||
# exit 1
|
||||
#fi
|
||||
|
||||
# Stop if it can't find the GNU Health version
|
||||
#if [ -z "$GNUHEALTH_VERSION" ]
|
||||
#then
|
||||
# cli_msg "ERROR" "Could not find the GNU Health version env. variable"
|
||||
# exit 1
|
||||
#fi
|
||||
|
||||
# Stop if current GNU Health version < 2.8.0
|
||||
#local raw_ver=`echo $GNUHEALTH_VERSION | tr -d '.'`
|
||||
#if [ $raw_ver -lt 280 ]
|
||||
#then
|
||||
# cli_msg "ERROR" "GNU Health version must be at least 2.8"
|
||||
# exit 1
|
||||
#fi
|
||||
|
||||
cli_msg "INFO" "Environment variables"
|
||||
#cli_msg "INFO" "GNUHEALTH_VERSION = ${GNUHEALTH_VERSION}"
|
||||
#cli_msg "INFO" "TRYTON VERSION = ${TRYTON_VERSION}"
|
||||
cli_msg "INFO" "PYTHONPATH = $PYTHONPATH"
|
||||
|
||||
}
|
||||
|
||||
do_backup()
|
||||
{
|
||||
|
||||
get_current_values
|
||||
|
||||
local COMMAND=$1
|
||||
local BACKDATE=`date -u +%Y-%m-%d_%H%M%S`
|
||||
local LOCKFILE="/tmp/.gnuhealth_backup.lock"
|
||||
local INFOFILE="/tmp/gnuhealth_backup.log"
|
||||
local BACKDIR=""
|
||||
local DB=""
|
||||
|
||||
|
||||
shift # Remove the command and deal only with the options
|
||||
|
||||
if [ $# -ne 4 ]; then
|
||||
echo -e "Usage : gnuhealth-control backup --backdir <directory> --database <dbname>"
|
||||
exit
|
||||
fi
|
||||
|
||||
for option in "$@"
|
||||
do
|
||||
case $option in
|
||||
--backdir ) BACKDIR=$2;;
|
||||
--database ) DB=$2 ;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
if [ -f $LOCKFILE ]
|
||||
then
|
||||
cli_msg "ERROR" "Backup in progress or stale lock file found ..." | tee -a $INFOFILE
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
if [ ! -e ${BACKDIR} ]
|
||||
then
|
||||
cli_msg "ERROR" "Backup directory ${BACKDIR} not found !"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
touch $LOCKFILE
|
||||
|
||||
# Backup start
|
||||
|
||||
cli_msg "INFO" "START Database Backup" | tee -a $INFOFILE
|
||||
|
||||
pg_dump $DB > $BACKDIR/backup\_$DB\_$BACKDATE || bailout
|
||||
|
||||
cli_msg "INFO" "Compressing Database Backup" | tee -a $INFOFILE
|
||||
|
||||
gzip "${BACKDIR}/backup_${DB}_${BACKDATE}" || bailout
|
||||
|
||||
cli_msg "INFO" "Creating compressed tarball with DB and GNU Health Attachment directory" | tee -a $INFOFILE
|
||||
|
||||
# tar -cvf "${BACKDIR}/gnuhealth_${DB}_with_fs_backup_${BACKDATE}.tar.gz" $HOME || bailout
|
||||
tar -cvf "${BACKDIR}/gnuhealth_${DB}_with_fs_backup_${BACKDATE}.tar.gz" /var/lib/tryton || bailout
|
||||
|
||||
cli_msg "INFO" "Backup Successful" | tee -a $INFOFILE
|
||||
|
||||
#Remove lock file
|
||||
rm $LOCKFILE
|
||||
|
||||
}
|
||||
|
||||
check_status()
|
||||
{
|
||||
# TRYTOND_PIDS=`pgrep -f "^.*python.*trytond.*$"`
|
||||
# if [ $? = 0 ]
|
||||
# then
|
||||
# cli_msg "INFO" "GNU Health / Tryton instance(s) with PID(s) :"
|
||||
# echo $TRYTOND_PIDS
|
||||
# else
|
||||
# cli_msg "INFO" "No GNU Health instance seems to be running"
|
||||
# fi
|
||||
systemctl status trytond
|
||||
|
||||
}
|
||||
|
||||
check_download_dir()
|
||||
{
|
||||
if [ -d $UPDATE_DOWNLOAD_DIR ]; then
|
||||
echo "Update download directory exists. Bailing out"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
check_updates()
|
||||
{
|
||||
# source $HOME/.gnuhealthrc
|
||||
|
||||
zypper lu | grep "trytond , gnuhealth"
|
||||
|
||||
# local TRYTOND_PATCHLEVEL=`echo ${TRYTON_VERSION} | cut -d'.' -f3`
|
||||
|
||||
# local TRYTON_MODULES=`cd ${GNUHEALTH_DIR}; ls -1d trytond*`
|
||||
# TRYTON_MAJOR_MINOR=`echo $TRYTON_VERSION | cut -d'.' -f1-2`
|
||||
|
||||
# NEED_UPDATE_TRYTOND=0
|
||||
# NEED_UPDATE_MODULES=0
|
||||
# NEED_UPDATE_PATCHSETS=0
|
||||
# MOD_UPDATES=""
|
||||
# NEED_DELETE=0
|
||||
# TO_DELETE=""
|
||||
|
||||
# cli_msg "INFO" "TRYTON SERVER : Checking latest patchlevel"
|
||||
|
||||
# LATEST_TRYTOND=`wget --quiet -O - ${TRYTON_URL}/${TRYTON_MAJOR_MINOR} | egrep -o trytond-${TRYTON_MAJOR_MINOR}.[0-9\.]+.tar.gz | sort -V | tail -1`
|
||||
# local LATEST_TRYTOND_PATCHLEVEL=`echo ${LATEST_TRYTOND} | cut -d'.' -f3`
|
||||
|
||||
# Check latest tryton server against local version
|
||||
# if (( ${TRYTOND_PATCHLEVEL} < ${LATEST_TRYTOND_PATCHLEVEL} )); then
|
||||
# cli_msg "WARNING" "TRYTON SERVER patchlevel ${TRYTOND_PATCHLEVEL} is outdated ! A newer version is available (${LATEST_TRYTOND})"
|
||||
# NEED_DELETE=1
|
||||
# TO_DELETE="${TO_DELETE} ${GNUHEALTH_DIR}/tryton/server/trytond-${TRYTON_MAJOR_MINOR}.${TRYTOND_PATCHLEVEL}"
|
||||
# NEED_UPDATE_TRYTOND=1
|
||||
# else
|
||||
# cli_msg "INFO" "TRYTON SERVER patchlevel ${TRYTOND_PATCHLEVEL} is at the latest version"
|
||||
# fi
|
||||
|
||||
# Check latest tryton modules against local version
|
||||
# for MODULE in ${TRYTON_MODULES}; do
|
||||
# MODNAME=`echo $MODULE | cut -d'-' -f1`
|
||||
# MODULE_PATCHLEVEL=`echo $MODULE | sed 's/^.*\.\([[:digit:]]*\)$/\1/'`
|
||||
# LATEST_MODULE=`wget --quiet -O - ${TRYTON_URL}/${TRYTON_MAJOR_MINOR} | egrep -o ${MODNAME}-${TRYTON_MAJOR_MINOR}.[0-9\.]+.tar.gz | sort -V | tail -1`
|
||||
# LATEST_MODULE_PATCHLEVEL=`echo ${LATEST_MODULE} | cut -d'.' -f3`
|
||||
# if (( ${MODULE_PATCHLEVEL} < ${LATEST_MODULE_PATCHLEVEL} )); then
|
||||
# cli_msg "WARNING" "${MODNAME} patchlevel ${MODULE_PATCHLEVEL} is outdated ! A newer version is available (${LATEST_MODULE})"
|
||||
# NEED_UPDATE_MODULES=1
|
||||
# MOD_UPDATES="${MOD_UPDATES} ${LATEST_MODULE}"
|
||||
# NEED_DELETE=1
|
||||
# TO_DELETE="${TO_DELETE} ${GNUHEALTH_DIR}/tryton/server/modules/${MODNAME}-${TRYTON_MAJOR_MINOR}.${MODULE_PATCHLEVEL}"
|
||||
# else
|
||||
# cli_msg "INFO" "${MODNAME} patchlevel ${MODULE_PATCHLEVEL} is at the latest version"
|
||||
# fi
|
||||
# done
|
||||
|
||||
# Check latest GNU HEALTH PATCHSETS against local version
|
||||
# cli_msg "INFO" "GNU HEALTH KERNEL : Checking latest PATCHSETS"
|
||||
|
||||
# GNUHEALTH_MAJOR_MINOR=`echo $GNUHEALTH_VERSION | cut -d'.' -f1-2`
|
||||
# GNUHEALTH_PATCHSET=`echo $GNUHEALTH_VERSION | cut -d'.' -f3`
|
||||
|
||||
# PATCHSETS_NUM=`wget --quiet -O - ${GNUHEALTH_URL}/ | egrep -o gnuhealth_patchset-${GNUHEALTH_MAJOR_MINOR}\.[0-9\.]+.tar.gz | uniq | wc -l | tr -d ' '`
|
||||
|
||||
# if (( ${PATCHSETS_NUM} > 0 )); then
|
||||
# cli_msg "INFO" "Number of Patchsets for this version : ${PATCHSETS_NUM}"
|
||||
|
||||
# LATEST_GNUHEALTH=`wget --quiet -O - ${GNUHEALTH_URL}/ | egrep -o gnuhealth_patchset-${GNUHEALTH_MAJOR_MINOR}\.[0-9\.]+.tar.gz | sort -V | tail -1`
|
||||
# LATEST_GNUHEALTH_PATCHSET=`echo ${LATEST_GNUHEALTH} | cut -d'.' -f3`
|
||||
|
||||
# if (( ${GNUHEALTH_PATCHSET} < ${LATEST_GNUHEALTH_PATCHSET} )); then
|
||||
# cli_msg "WARNING" "GNU HEALTH patchset ${GNUHEALTH_PATCHSET} is outdated ! A newer version is available (${LATEST_GNUHEALTH})"
|
||||
# NEED_UPDATE_PATCHSETS=1
|
||||
# let PSET=GNUHEALTH_PATCHSET+1
|
||||
# for n in `seq $PSET $LATEST_GNUHEALTH_PATCHSET`
|
||||
# do
|
||||
# PATCHSETS="$PATCHSETS gnuhealth_patchset-${GNUHEALTH_MAJOR_MINOR}.$n.tar.gz"
|
||||
# done
|
||||
|
||||
# else
|
||||
# cli_msg "INFO" "GNU HEALTH patchset ${GNUHEALTH_PATCHSET} is at the latest version"
|
||||
# fi
|
||||
|
||||
# else
|
||||
# cli_msg "INFO" "** NO GNU HEALTH PATCHSETS FOUND FOR THIS VERSION **"
|
||||
# fi
|
||||
|
||||
}
|
||||
|
||||
install_updates()
|
||||
{
|
||||
|
||||
#if [ $NEED_UPDATE_TRYTOND -eq 1 ]; then
|
||||
# cli_msg "INFO" "Downloading TRYTON SERVER $LATEST_TRYTOND"
|
||||
# wget --quiet --directory-prefix=${UPDATE_DOWNLOAD_DIR}/trytond ${TRYTON_URL}/${TRYTON_MAJOR_MINOR}/${LATEST_TRYTOND} || exit 1
|
||||
# cli_msg "INFO" "--> Uncompressing TRYTON SERVER $LATEST_TRYTOND"
|
||||
# tar -xzf ${UPDATE_DOWNLOAD_DIR}/trytond/${LATEST_TRYTOND} --directory ${GNUHEALTH_DIR}/tryton/server || exit 1
|
||||
# fi
|
||||
|
||||
# if [ $NEED_UPDATE_MODULES -eq 1 ]; then
|
||||
# for mod in ${MOD_UPDATES}
|
||||
# do
|
||||
# cli_msg "INFO" "Downloading $mod"
|
||||
# wget --quiet --directory-prefix=${UPDATE_DOWNLOAD_DIR}/modules ${TRYTON_URL}/${TRYTON_MAJOR_MINOR}/${mod} || exit 1
|
||||
# cli_msg "INFO" "--> Uncompressing ${mod}"
|
||||
# tar -xzf ${UPDATE_DOWNLOAD_DIR}/modules/${mod} --directory ${GNUHEALTH_DIR}/tryton/server/modules || exit 1
|
||||
# done
|
||||
# fi
|
||||
|
||||
# if [ $NEED_UPDATE_PATCHSETS -eq 1 ]; then
|
||||
# for patchset in ${PATCHSETS}
|
||||
# do
|
||||
# cli_msg "INFO" "Downloading $patchset"
|
||||
# wget --quiet --directory-prefix=${UPDATE_DOWNLOAD_DIR}/patchsets ${GNUHEALTH_URL}/${patchset} || exit 1
|
||||
# cli_msg "INFO" "--> Applying PATCHSET $patchset"
|
||||
# tar -xzf ${UPDATE_DOWNLOAD_DIR}/patchsets/${patchset} --directory ${HOME} || exit 1
|
||||
# done
|
||||
# fi
|
||||
|
||||
if [ $2 == "--dry-run" ];then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
sudo zypper up trytond* gnuhealth
|
||||
|
||||
}
|
||||
|
||||
#remove_old()
|
||||
#{
|
||||
# if [ ${NEED_DELETE} -eq 1 ]; then
|
||||
# cli_msg "WARNING" "Removing obsolete kernel and/or modules : ${TO_DELETE}"
|
||||
# rm -rf ${TO_DELETE}
|
||||
# fi
|
||||
#}
|
||||
|
||||
relink_mods()
|
||||
{
|
||||
# source $HOME/.gnuhealthrc
|
||||
|
||||
# if [ ${NEED_DELETE} -eq 1 ]; then
|
||||
# local TRYTON_MODS=`cd ${GNUHEALTH_DIR}/tryton/server/modules; ls -1d trytond_*`
|
||||
# for mod in ${TRYTON_MODS}; do
|
||||
# local modname=`echo ${mod} | cut -d'-' -f1 | cut -d'_' -f2-`
|
||||
# cli_msg "INFO" "Relinking : ${mod}"
|
||||
# ln -sf ${GNUHEALTH_DIR}/tryton/server/modules/${mod} ${GNUHEALTH_DIR}/tryton/server/${TRYTOND}/trytond/modules/${modname} || exit 1
|
||||
# done
|
||||
|
||||
# cli_msg "INFO" "Relinking GNU Health modules ..."
|
||||
# local HEALTH_MODS=`cd ${GNUHEALTH_DIR}/tryton/server/modules; ls -1d health*`
|
||||
# for mod in ${HEALTH_MODS}; do
|
||||
# cli_msg "INFO" "--> Relinking : ${mod}"
|
||||
# ln -sf ${GNUHEALTH_DIR}/tryton/server/modules/${mod} ${GNUHEALTH_DIR}/tryton/server/${TRYTOND}/trytond/modules/ || exit 1
|
||||
# done
|
||||
|
||||
# cli_msg "INFO" "Relinking local modules and customizations ..."
|
||||
|
||||
# local LOCAL_MODS=`cd ${GNUHEALTH_DIR}/tryton/server/modules/local; ls -A`
|
||||
# for mod in ${LOCAL_MODS}; do
|
||||
# cli_msg "INFO" "--> Relinking : ${mod}"
|
||||
# ln -sf ${GNUHEALTH_DIR}/tryton/server/modules/local/${mod} ${GNUHEALTH_DIR}/tryton/server/${TRYTOND}/trytond/modules/ || exit 1
|
||||
# done
|
||||
|
||||
# fi
|
||||
|
||||
sudo systemctl restart trytond
|
||||
|
||||
}
|
||||
|
||||
do_update()
|
||||
{
|
||||
if [ $# -gt 1 ];then
|
||||
if [ $2 != "--dry-run" ];then
|
||||
cli_msg "ERROR" "Unrecognized update option"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
check_download_dir
|
||||
get_current_values
|
||||
check_updates
|
||||
if [ $# -gt 1 ];then
|
||||
if [ $2 == "--dry-run" ];then
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
install_updates
|
||||
# remove_old
|
||||
relink_mods
|
||||
}
|
||||
|
||||
getlang() {
|
||||
if [ $# -eq 1 ]; then
|
||||
usage
|
||||
fi
|
||||
|
||||
local lang_to_install=$2
|
||||
local lang_file=${lang_to_install}.zip
|
||||
# source $HOME/.gnuhealthrc || exit 1
|
||||
cli_msg "INFO" "Going to modules directory..."
|
||||
|
||||
cd ${GNUHEALTH_DIR} || exit 1
|
||||
cli_msg "INFO" "Retrieving language pack file for ${lang_to_install}"
|
||||
wget ${TRANSLATE_URL}/export/?path=/${lang_to_install}/GNUHEALTH/ -O /tmp/${lang_file} || exit 1
|
||||
cli_msg "INFO" "Installing / Updating language files for ${lang_to_install} ..."
|
||||
|
||||
tar --strip-components 3 -xzf /tmp/${lang_file} || exit 1
|
||||
cli_msg "INFO" "Language pack ${lang_to_install} sucessfully installed / updated"
|
||||
cli_msg "INFO" "You now need to update the database modules"
|
||||
# cd
|
||||
}
|
||||
|
||||
bailout() {
|
||||
cli_msg "ERROR" "Bailing out !"
|
||||
cli_msg "ERROR" "Removing backup lock file"
|
||||
rm -f $LOCKFILE
|
||||
exit 1
|
||||
}
|
||||
|
||||
parse_command_line()
|
||||
{
|
||||
if [ $# -eq 0 ]; then
|
||||
usage
|
||||
fi
|
||||
|
||||
case $1 in
|
||||
version) echo $VERSION;;
|
||||
backup) do_backup $@;;
|
||||
update) do_update $@;;
|
||||
status) check_status;;
|
||||
getlang) getlang $@;;
|
||||
help) help;;
|
||||
*) echo $1: Unrecognized command; exit 1;;
|
||||
esac
|
||||
}
|
||||
|
||||
parse_command_line $@
|
Loading…
Reference in New Issue
Block a user