[med-svn] r16361 - in trunk/packages/gnuhealth/trunk/debian: . database-scripts/install database-scripts/upgrade/pgsql
Emilien Klein
e2jk-guest at moszumanska.debian.org
Sat Mar 1 21:47:39 UTC 2014
Author: e2jk-guest
Date: 2014-03-01 21:47:39 +0000 (Sat, 01 Mar 2014)
New Revision: 16361
Modified:
trunk/packages/gnuhealth/trunk/debian/changelog
trunk/packages/gnuhealth/trunk/debian/database-scripts/install/pgsql
trunk/packages/gnuhealth/trunk/debian/database-scripts/upgrade/pgsql/2.0.0
trunk/packages/gnuhealth/trunk/debian/database-scripts/upgrade/pgsql/2.4.0
trunk/packages/gnuhealth/trunk/debian/gnuhealth-server.postinst
trunk/packages/gnuhealth/trunk/debian/gnuhealth-server.preinst
Log:
Use su instead of sudo to run commands as gnuhealth user (Closes: #739657)
Modified: trunk/packages/gnuhealth/trunk/debian/changelog
===================================================================
--- trunk/packages/gnuhealth/trunk/debian/changelog 2014-03-01 21:15:25 UTC (rev 16360)
+++ trunk/packages/gnuhealth/trunk/debian/changelog 2014-03-01 21:47:39 UTC (rev 16361)
@@ -1,8 +1,14 @@
gnuhealth (2.4.1-2) unstable; urgency=low
+ * Use su instead of sudo to run commands as gnuhealth user (Closes: #739657)
+ - d/gnuhealth-server.preinst
+ - d/gnuhealth-server.postinst
+ - d/database-scripts/install/pgsql
+ - d/database-scripts/upgrade/pgsql/2.0.0
+ - d/database-scripts/upgrade/pgsql/2.4.0
* Actually run the upgrade script provided by upstream for 2.4
- -- Emilien Klein <emilien+debian at klein.st> Sat, 01 Mar 2014 22:14:12 +0100
+ -- Emilien Klein <emilien+debian at klein.st> Sat, 01 Mar 2014 22:45:36 +0100
gnuhealth (2.4.1-1) unstable; urgency=low
Modified: trunk/packages/gnuhealth/trunk/debian/database-scripts/install/pgsql
===================================================================
--- trunk/packages/gnuhealth/trunk/debian/database-scripts/install/pgsql 2014-03-01 21:15:25 UTC (rev 16360)
+++ trunk/packages/gnuhealth/trunk/debian/database-scripts/install/pgsql 2014-03-01 21:47:39 UTC (rev 16361)
@@ -14,17 +14,16 @@
# Create system user
adduser --home ${GNUHEALTH_HOMEDIR} --quiet --system --group ${GNUHEALTH_USER}
-tf=`sudo -u ${GNUHEALTH_USER} tempfile 2>/dev/null`
+tf=`su --shell /bin/sh -c "tempfile 2>/dev/null" ${GNUHEALTH_USER}`
# Use the same password for the Tryton admin as for the database
echo $dbc_dbpass > $tf
# Initialize the gnuhealth database
-sudo -u ${GNUHEALTH_USER} TRYTONPASSFILE=$tf trytond --database=gnuhealth \
- --init=all --config=${GNUHEALTH_CONFFILE}
+su --shell /bin/sh -c "TRYTONPASSFILE=$tf trytond --database=gnuhealth --init=all --config=${GNUHEALTH_CONFFILE}" ${GNUHEALTH_USER}
rm -f $tf
# Change database owner (needs to be run as postgres user, as PostgreSQL's
# default authentication is set to peer method)
-sudo -u postgres psql -U postgres -c 'ALTER DATABASE gnuhealth OWNER TO gnuhealth'
+su --shell /bin/sh -c "psql -U postgres -c 'ALTER DATABASE gnuhealth OWNER TO gnuhealth'" postgres
# Create a temporary file that indicates we've just created the database.
# Will be used in postinst to know not to update the database.
Modified: trunk/packages/gnuhealth/trunk/debian/database-scripts/upgrade/pgsql/2.0.0
===================================================================
--- trunk/packages/gnuhealth/trunk/debian/database-scripts/upgrade/pgsql/2.0.0 2014-03-01 21:15:25 UTC (rev 16360)
+++ trunk/packages/gnuhealth/trunk/debian/database-scripts/upgrade/pgsql/2.0.0 2014-03-01 21:47:39 UTC (rev 16361)
@@ -11,7 +11,7 @@
# A backup of the database was already created by gnuhealth-server.preinst
# Run the pre script provided by upstream
-sudo -u ${dbc_dbuser} python /usr/share/gnuhealth/scripts/upgrade/2.0/pre.py --pg="dbname=${dbc_dbname}"
+su --shell /bin/sh -c "python /usr/share/gnuhealth/scripts/upgrade/2.0/pre.py --pg='dbname=${dbc_dbname}'" ${dbc_dbuser}
# Upgrading the database will be done by gnuhealth-server.postinst
Modified: trunk/packages/gnuhealth/trunk/debian/database-scripts/upgrade/pgsql/2.4.0
===================================================================
--- trunk/packages/gnuhealth/trunk/debian/database-scripts/upgrade/pgsql/2.4.0 2014-03-01 21:15:25 UTC (rev 16360)
+++ trunk/packages/gnuhealth/trunk/debian/database-scripts/upgrade/pgsql/2.4.0 2014-03-01 21:47:39 UTC (rev 16361)
@@ -11,7 +11,7 @@
# A backup of the database was already created by gnuhealth-server.preinst
# Run the remove_test_module.sql script provided by upstream
-sudo -u ${dbc_dbuser} psql ${dbc_dbname} < /usr/share/gnuhealth/scripts/upgrade/2.4/remove_test_module.sql
+su --shell /bin/sh -c "psql ${dbc_dbname} < /usr/share/gnuhealth/scripts/upgrade/2.4/remove_test_module.sql" ${dbc_dbuser}
# Upgrading the database will be done by gnuhealth-server.postinst
Modified: trunk/packages/gnuhealth/trunk/debian/gnuhealth-server.postinst
===================================================================
--- trunk/packages/gnuhealth/trunk/debian/gnuhealth-server.postinst 2014-03-01 21:15:25 UTC (rev 16360)
+++ trunk/packages/gnuhealth/trunk/debian/gnuhealth-server.postinst 2014-03-01 21:47:39 UTC (rev 16361)
@@ -56,8 +56,7 @@
# Update the gnuhealth database
echo "Updating the '${dbc_dbname}' database"
- sudo -u ${dbc_dbuser} trytond --database=${dbc_dbname} --update=all \
- --config=${GNUHEALTH_CONFFILE}
+ su --shell /bin/sh -c "trytond --database=${dbc_dbname} --update=all --config=${GNUHEALTH_CONFFILE}" ${dbc_dbuser}
else
# Do not update the database, as it's just been created.
# Just remove the temporary file, so that the database will be updated next time.
Modified: trunk/packages/gnuhealth/trunk/debian/gnuhealth-server.preinst
===================================================================
--- trunk/packages/gnuhealth/trunk/debian/gnuhealth-server.preinst 2014-03-01 21:15:25 UTC (rev 16360)
+++ trunk/packages/gnuhealth/trunk/debian/gnuhealth-server.preinst 2014-03-01 21:47:39 UTC (rev 16361)
@@ -29,7 +29,7 @@
# Make a backup of the database prior to upgrading from a previous version
echo "Backing up database '${dbc_dbname}' to ${BACKUP_FILE}"
- sudo -u ${dbc_dbuser} pg_dump ${dbc_dbname} > ${BACKUP_FILE}
+ su --shell /bin/sh -c "pg_dump ${dbc_dbname} > ${BACKUP_FILE}" ${dbc_dbuser}
chown ${dbc_dbuser}:${dbc_dbuser} ${BACKUP_FILE}
;;
More information about the debian-med-commit
mailing list