[osm-tile-server] 09/117: Configurable user name

Ruben Undheim rubund-guest at moszumanska.debian.org
Tue Nov 3 23:18:14 UTC 2015


This is an automated email from the git hooks/post-receive script.

rubund-guest pushed a commit to branch master
in repository osm-tile-server.

commit 9b184e1da2353b75b47c65ae7cea066ac70f42af
Author: Ruben Undheim <ruben.undheim at gmail.com>
Date:   Thu Sep 3 00:05:49 2015 +0200

    Configurable user name
---
 debian/osm-tile-server-base.postinst    |  8 +++--
 debian/osm-tile-server-config.config    |  8 ++---
 debian/osm-tile-server-config.postinst  | 30 +++++++++---------
 debian/osm-tile-server-config.templates | 27 +++--------------
 debian/po/templates.pot                 | 54 ---------------------------------
 5 files changed, 27 insertions(+), 100 deletions(-)

diff --git a/debian/osm-tile-server-base.postinst b/debian/osm-tile-server-base.postinst
index f13714e..ecea881 100644
--- a/debian/osm-tile-server-base.postinst
+++ b/debian/osm-tile-server-base.postinst
@@ -22,10 +22,12 @@ set -e
 
 case "$1" in
     configure)
-        #db_get osm-tile-server/db-name
-        #DBNAME=$RET
+        db_get osm-tile-server/db-user
+        DBUSER=$RET
+        db_get osm-tile-server/db-name
+        DBNAME=$RET
 
-        su osm -c "osm2pgsql --slim -d osmdb -C 1600 --hstore -S /usr/share/osm2pgsql/default.style /usr/share/osm-tile-server-base/samples/liechtenstein-latest.osm.pbf"
+        su $DBUSER -c "osm2pgsql --slim -d $DBNAME -C 1600 --hstore -S /usr/share/osm2pgsql/default.style /usr/share/osm-tile-server-base/samples/liechtenstein-latest.osm.pbf"
         
     ;;
 
diff --git a/debian/osm-tile-server-config.config b/debian/osm-tile-server-config.config
index 5dd8276..2ed1fc1 100644
--- a/debian/osm-tile-server-config.config
+++ b/debian/osm-tile-server-config.config
@@ -4,12 +4,8 @@ set -e
 
 . /usr/share/debconf/confmodule
 
-#db_input high osm-tile-server/path || true
-db_input medium osm-tile-server/db-name || true
-db_input medium osm-tile-server/db-user || true
-db_input medium osm-tile-server/db-password || true
-db_input medium osm-tile-server/root-password || true
-db_input medium osm-tile-server/enable || true
+db_input high osm-tile-server/db-user || true
+db_input high osm-tile-server/db-name || true
 db_go
 
 exit 0
diff --git a/debian/osm-tile-server-config.postinst b/debian/osm-tile-server-config.postinst
index abf1968..42e4053 100644
--- a/debian/osm-tile-server-config.postinst
+++ b/debian/osm-tile-server-config.postinst
@@ -22,38 +22,40 @@ set -e
 
 case "$1" in
     configure)
-        #db_get osm-tile-server/db-name
-        #DBNAME=$RET
+        db_get osm-tile-server/db-user
+        DBUSER=$RET
+        db_get osm-tile-server/db-name
+        DBNAME=$RET
 
-        if ! getent group osm >/dev/null; then
-            addgroup --system osm >/dev/null
+        if ! getent group $DBUSER >/dev/null; then
+            addgroup --system $DBUSER >/dev/null
         fi
     
-        if ! getent passwd osm >/dev/null; then
+        if ! getent passwd $DBUSER >/dev/null; then
             adduser \
                 --system \
                 --disabled-login \
-                --ingroup osm \
-                --home /var/lib/osm-tile-server-user \
+                --ingroup $DBUSER \
+                --home /var/lib/osm-tile-server \
                 --gecos "osm tile server user" \
                 --shell /bin/bash \
-                osm >/dev/null
+                $DBUSER >/dev/null
         fi
 
 
-        echo -n "Checking if user osm already exists... "
+        echo -n "Checking if user $DBUSER already exists... "
         set +e
-        su postgres -c "cd /var/lib/postgresql ; psql postgres -tAc \"SELECT 1 FROM pg_roles WHERE rolname='osm'\"" | grep -q 1
+        su postgres -c "cd /var/lib/postgresql ; psql postgres -tAc \"SELECT 1 FROM pg_roles WHERE rolname='$DBUSER'\"" | grep -q 1
         USEREXISTS=$?
         set -e
         if [ "$USEREXISTS" = "0" ] ; then
             echo "YES"
         else
             echo "NO. Creating user, database and setting it up..."
-            su postgres -c "cd /var/lib/postgresql ; createuser osm"
-            su postgres -c "cd /var/lib/postgresql ; createdb -E UTF8 -O osm osmdb"
-            su postgres -c "cd /var/lib/postgresql ; psql -c \"CREATE EXTENSION hstore;\" -d osmdb"
-            su postgres -c "cd /var/lib/postgresql ; psql -c \"CREATE EXTENSION postgis;\" -d osmdb"
+            su postgres -c "cd /var/lib/postgresql ; createuser $DBUSER"
+            su postgres -c "cd /var/lib/postgresql ; createdb -E UTF8 -O $DBUSER $DBNAME"
+            su postgres -c "cd /var/lib/postgresql ; psql -c \"CREATE EXTENSION hstore;\" -d $DBNAME"
+            su postgres -c "cd /var/lib/postgresql ; psql -c \"CREATE EXTENSION postgis;\" -d $DBNAME"
             echo "DONE"
         fi
    
diff --git a/debian/osm-tile-server-config.templates b/debian/osm-tile-server-config.templates
index 1fb8613..518e4df 100644
--- a/debian/osm-tile-server-config.templates
+++ b/debian/osm-tile-server-config.templates
@@ -1,30 +1,11 @@
-Template: osm-tile-server/path
-Type: string
-Default: /blabla
-_Description: Enter the path to the pictures:
 
 Template: osm-tile-server/db-name
 Type: string
-Default: naturfakta
-_Description: Enter name of mysql database to use for naturfakta:
-
-Template: osm-tile-server/db-password
-Type: password
-Default: default
-_Description: Enter the password for the mysql database:
+Default: osmdb
+_Description: Enter name of postgresql database to use for the tile server:
 
 Template: osm-tile-server/db-user
 Type: string
-Default: naturfaktauser
-_Description: Enter name of the mysql user:
-
-Template: osm-tile-server/root-password
-Type: password
-Default: 
-_Description: Enter the root password for the config db:
-
-Template: osm-tile-server/enable
-Type: boolean
-Default: true
-_Description: Enable apache site for naturfakta now?:
+Default: osm
+_Description: Enter name of the postgresql user:
 
diff --git a/debian/po/templates.pot b/debian/po/templates.pot
deleted file mode 100644
index eb6e657..0000000
--- a/debian/po/templates.pot
+++ /dev/null
@@ -1,54 +0,0 @@
-# SOME DESCRIPTIVE TITLE.
-# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
-# This file is distributed under the same license as the PACKAGE package.
-# FIRST AUTHOR <EMAIL at ADDRESS>, YEAR.
-#
-#, fuzzy
-msgid ""
-msgstr ""
-"Project-Id-Version: osm-tile-server\n"
-"Report-Msgid-Bugs-To: osm-tile-server at packages.debian.org\n"
-"POT-Creation-Date: 2015-09-02 22:41+0200\n"
-"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
-"Last-Translator: FULL NAME <EMAIL at ADDRESS>\n"
-"Language-Team: LANGUAGE <LL at li.org>\n"
-"Language: \n"
-"MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=CHARSET\n"
-"Content-Transfer-Encoding: 8bit\n"
-
-#. Type: string
-#. Description
-#: ../templates:1001
-msgid "Enter the path to the pictures:"
-msgstr ""
-
-#. Type: string
-#. Description
-#: ../templates:2001
-msgid "Enter name of mysql database to use for naturfakta:"
-msgstr ""
-
-#. Type: password
-#. Description
-#: ../templates:3001
-msgid "Enter the password for the mysql database:"
-msgstr ""
-
-#. Type: string
-#. Description
-#: ../templates:4001
-msgid "Enter name of the mysql user:"
-msgstr ""
-
-#. Type: password
-#. Description
-#: ../templates:5001
-msgid "Enter the root password for the config db:"
-msgstr ""
-
-#. Type: boolean
-#. Description
-#: ../templates:6001
-msgid "Enable apache site for naturfakta now?:"
-msgstr ""

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-grass/osm-tile-server.git



More information about the Pkg-grass-devel mailing list