- demo.diff to update installation script for demo-db added
OBS-URL: https://build.opensuse.org/package/show/Application:ERP:GNUHealth:Factory/gnuhealth?expand=0&rev=40
This commit is contained in:
parent
febfb30252
commit
7a5211ddb6
103
demo.diff
Normal file
103
demo.diff
Normal file
@ -0,0 +1,103 @@
|
||||
diff --git a/scripts/demo/install_demo_database.sh b/scripts/demo/install_demo_database.sh
|
||||
--- a/scripts/demo/install_demo_database.sh
|
||||
+++ b/scripts/demo/install_demo_database.sh
|
||||
@@ -1,47 +1,71 @@
|
||||
#!/usr/bin/env bash
|
||||
# Script to download/unpack and locally install the GNU Health demo database
|
||||
|
||||
-URL="http://health.gnu.org/downloads/postgres_dumps/gnuhealth-3.0.1-demo-data.tar.gz"
|
||||
-DB="gnuhealth_demo"
|
||||
+URL="https://www.gnuhealth.org/downloads/postgres_dumps/gnuhealth-$1-demo.sql.gz"
|
||||
+DB="ghdemo$1"
|
||||
|
||||
-if [[ $USER != "gnuhealth" ]]; then
|
||||
- echo "Run script as gnuhealth user"
|
||||
+help()
|
||||
+{
|
||||
+ cat << EOF
|
||||
+
|
||||
+GNU Health HMIS demo database installer
|
||||
+
|
||||
+usage: `basename $0` <db_version>
|
||||
+
|
||||
+ Example:
|
||||
+ $ bash ./install_demo_dabase.sh 36
|
||||
+
|
||||
+ will install the latest demo db for version 3.6.x
|
||||
+EOF
|
||||
+ exit 0
|
||||
+}
|
||||
+
|
||||
+bailout () {
|
||||
+ echo "Error"
|
||||
+ echo "Cleaning up..."
|
||||
+ cleanup
|
||||
exit 1
|
||||
+ }
|
||||
+
|
||||
+
|
||||
+if [ $# -eq 0 ]; then
|
||||
+ help
|
||||
fi
|
||||
|
||||
+cleanup () {
|
||||
+ rm -f gnuhealth_demo_database.sql.gz
|
||||
+ rm -f gnuhealth_demo_database.sql
|
||||
+ }
|
||||
|
||||
-if psql -l | grep -q "$DB"; then
|
||||
+
|
||||
+if psql -l | grep -wq "$DB"; then
|
||||
echo "$DB database already exists"
|
||||
echo " delete it/change target database before proceeding"
|
||||
- exit 1
|
||||
+ bailout
|
||||
fi
|
||||
|
||||
-function cleanup {
|
||||
- rm -f demo_database.sql.gz
|
||||
- rm -f demo_database.sql
|
||||
- exit
|
||||
- }
|
||||
|
||||
-trap cleanup SIGHUP SIGINT SIGTERM EXIT
|
||||
|
||||
-echo -n 'Downloading the demo database...'
|
||||
-wget -q "$URL" -O demo_database.sql.gz
|
||||
-echo 'COMPLETE'
|
||||
+echo -n "Downloading the demo database..."
|
||||
+wget "$URL" -O gnuhealth_demo_database.sql.gz || bailout
|
||||
+echo 'SUCCESS...'
|
||||
|
||||
-echo -n 'Unpacking the database...'
|
||||
-gunzip -q demo_database.sql.gz
|
||||
-echo 'COMPLETE'
|
||||
+echo -n "Unpacking the database..."
|
||||
+gunzip -q gnuhealth_demo_database.sql.gz || bailout
|
||||
+echo 'SUCCESS...'
|
||||
|
||||
-echo -n 'Initializing empty database...'
|
||||
-psql -q -d template1 -c "create database $DB encoding='unicode'"
|
||||
-echo 'COMPLETE'
|
||||
+echo -n "Initializing empty database..."
|
||||
+createdb $DB
|
||||
+echo 'SUCCESS...'
|
||||
|
||||
-echo -n 'Importing demo database...'
|
||||
-psql -q "$DB" < demo_database.sql > /dev/null 2>&1
|
||||
-echo 'COMPLETE'
|
||||
+echo "Importing demo database..."
|
||||
+psql -q "$DB" < gnuhealth_demo_database.sql > /dev/null 2>&1 || bailout
|
||||
+echo "IMPORT OF DEMO DATABASE $DB COMPLETED SUCCESFULLY !"
|
||||
|
||||
-echo 'Use Tryton to access (with non-gnuhealth user!)...'
|
||||
+echo "Login Info:"
|
||||
echo " Database: $DB"
|
||||
-echo ' Username: admin'
|
||||
-echo ' Password: gnusolidario'
|
||||
+echo " Username: admin"
|
||||
+echo " Password: gnusolidario"
|
||||
exit 0
|
||||
+
|
||||
+
|
||||
|
@ -1,3 +1,8 @@
|
||||
-------------------------------------------------------------------
|
||||
Mon Nov 11 18:22:37 UTC 2019 - Axel Braun <axel.braun@gmx.de>
|
||||
|
||||
- demo.diff to update installation script for demo-db added
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Tue Jun 11 16:10:20 UTC 2019 - Axel Braun <axel.braun@gmx.de>
|
||||
|
||||
|
@ -40,6 +40,7 @@ Source3: gnuhealth.service
|
||||
Source4: gnuhealth-webdav@.service
|
||||
Source5: openSUSE-gnuhealth-setup
|
||||
Source6: gnuhealth
|
||||
Patch0: demo.diff
|
||||
|
||||
BuildArch: noarch
|
||||
|
||||
@ -94,7 +95,7 @@ You would need the GNU Health Client as well, on the same or a different machine
|
||||
|
||||
%prep
|
||||
%setup -q -n %{name}-%{version}
|
||||
#%patch0 -p1
|
||||
%patch0 -p1
|
||||
cp %{S:1} .
|
||||
cp %{S:2} .
|
||||
|
||||
@ -116,6 +117,10 @@ mkdir -p -m 755 %{buildroot}%{_bindir}
|
||||
install -p -m 755 gnuhealth-control %{buildroot}%{_bindir}/gnuhealth-control
|
||||
install -p -m 755 %{S:5} %{buildroot}%{_bindir}/openSUSE-gnuhealth-setup
|
||||
install -p -m 755 %{S:6} %{buildroot}%{_bindir}/gnuhealth
|
||||
install -p -m 755 scripts/demo/install_demo_database.sh %{buildroot}%{_bindir}/install_demo_database.sh
|
||||
|
||||
#delete empty demo directory
|
||||
rm -rf scripts/demo
|
||||
|
||||
mkdir -p $RPM_BUILD_ROOT%{_unitdir}
|
||||
install -p -m 644 %{SOURCE3} $RPM_BUILD_ROOT%{_unitdir}/%{name}.service
|
||||
|
Loading…
Reference in New Issue
Block a user