From 8e494be7d760b4fe8f5b0d9e48a19b2dca7d962b Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Thu, 29 Mar 2012 10:14:49 +0200 Subject: [PATCH] User info in /etc/metaproxy/metaproxy.user --- debian/metaproxy.default | 8 +------- debian/metaproxy.init | 3 +++ debian/metaproxy.install | 1 + debian/metaproxy.postinst | 7 +------ debian/metaproxy.postrm | 11 +++++------ debian/rules | 7 ++++--- metaproxy.spec | 18 ++++-------------- rpm/metaproxy.init | 4 +++- rpm/metaproxy.sysconfig | 6 ------ rpm/metaproxy.user | 5 +++++ 10 files changed, 27 insertions(+), 43 deletions(-) create mode 100644 rpm/metaproxy.user diff --git a/debian/metaproxy.default b/debian/metaproxy.default index b17a343..51f3a26 100644 --- a/debian/metaproxy.default +++ b/debian/metaproxy.default @@ -6,11 +6,5 @@ # This is a POSIX shell fragment # -# User and HOME of metaproxy daemon -SERVER_HOME=/var/metaproxy -SERVER_USER=metaproxy -SERVER_GROUP=metaproxy -SERVER_NAME="Metaproxy user" - # Additional options that are passed to the Daemon. -DAEMON_OPTS="-D -u ${SERVER_USER} -p /var/run/metaproxy.pid -l /var/log/metaproxy.log -c /etc/metaproxy/metaproxy.xml" +DAEMON_OPTS="-D -u $SERVER_USER -p /var/run/metaproxy.pid -l /var/log/metaproxy.log -c /etc/metaproxy/metaproxy.xml" diff --git a/debian/metaproxy.init b/debian/metaproxy.init index 0f36bdd..6b72823 100644 --- a/debian/metaproxy.init +++ b/debian/metaproxy.init @@ -22,6 +22,9 @@ SCRIPTNAME=/etc/init.d/$NAME # Exit if the package is not installed [ -x "$DAEMON" ] || exit 0 +# Read user information +. /etc/metaproxy/metaproxy.user + # Read configuration variable file if it is present [ -r /etc/default/$NAME ] && . /etc/default/$NAME diff --git a/debian/metaproxy.install b/debian/metaproxy.install index 6c7ccb0..fcced76 100644 --- a/debian/metaproxy.install +++ b/debian/metaproxy.install @@ -1,4 +1,5 @@ debian/tmp/etc/metaproxy/metaproxy.xml +debian/tmp/etc/metaproxy/metaproxy.user debian/tmp/usr/bin/metaproxy debian/tmp/usr/share/man/man1/* debian/tmp/usr/share/man/man3/* diff --git a/debian/metaproxy.postinst b/debian/metaproxy.postinst index 45bbfac..d1897b1 100644 --- a/debian/metaproxy.postinst +++ b/debian/metaproxy.postinst @@ -4,12 +4,7 @@ set -e case "$1" in configure) - [ -f /etc/default/metaproxy ] && . /etc/default/metaproxy - - [ -z "$SERVER_HOME" ] && SERVER_HOME=/var/metaproxy - [ -z "$SERVER_USER" ] && SERVER_USER=metaproxy - [ -z "$SERVER_NAME" ] && SERVER_NAME="Metaproxy user" - [ -z "$SERVER_GROUP" ] && SERVER_GROUP=metaproxy + . /etc/metaproxy/metaproxy.user # 1. create group if not existing if ! getent group | grep -q "^$SERVER_GROUP:" ; then diff --git a/debian/metaproxy.postrm b/debian/metaproxy.postrm index 922142c..ce720c1 100644 --- a/debian/metaproxy.postrm +++ b/debian/metaproxy.postrm @@ -6,12 +6,11 @@ case "$1" in purge) update-rc.d metaproxy remove >/dev/null - [ -f /etc/default/metaproxy ] && . /etc/default/metaproxy - - [ -z "$SERVER_HOME" ] && SERVER_HOME=/var/metaproxy - [ -z "$SERVER_USER" ] && SERVER_USER=metaproxy - [ -z "$SERVER_NAME" ] && SERVER_NAME="Metaproxy user" - [ -z "$SERVER_GROUP" ] && SERVER_GROUP=metaproxy + # copy of metaproxy.user, which is gone at this point + SERVER_HOME=/var/metaproxy + SERVER_USER=metaproxy + SERVER_NAME="Metaproxy user" + SERVER_GROUP=metaproxy # find first and last SYSTEM_UID numbers for LINE in `grep SYSTEM_UID /etc/adduser.conf | grep -v "^#"`; do diff --git a/debian/rules b/debian/rules index 789d889..c5713b7 100755 --- a/debian/rules +++ b/debian/rules @@ -6,8 +6,8 @@ # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 -# Force compat level four -export DH_COMPAT=4 +# Force compat level five +export DH_COMPAT=5 # These are used for cross-compiling and for saving the configure script # from having to guess our platform (since we know it already) @@ -30,7 +30,7 @@ endif config.status: configure dh_testdir # Add here commands to configure the package. - CFLAGS="$(CFLAGS)" ./configure --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) --prefix=/usr --mandir=\$${prefix}/share/man --with-yazpp=/usr/bin + CFLAGS="$(CFLAGS)" ./configure --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) --prefix=/usr --mandir=\$${prefix}/share/man --with-yazpp=/usr/bin --without-usemarcon #--infodir=\$${prefix}/share/info --enable-shared --enable-static --with-xslt @@ -84,6 +84,7 @@ binary-arch: build install mv debian/tmp/usr/share/doc/metaproxy debian/tmp/usr/share/doc/metaproxy-doc mkdir -p debian/tmp/etc/metaproxy cp debian/metaproxy.xml debian/tmp/etc/metaproxy/metaproxy.xml + cp rpm/metaproxy.user debian/tmp/etc/metaproxy/metaproxy.user dh_install # dh_installmenu # dh_installdebconf diff --git a/metaproxy.spec b/metaproxy.spec index f516c3a..62e075a 100644 --- a/metaproxy.spec +++ b/metaproxy.spec @@ -67,6 +67,7 @@ mkdir -p ${RPM_BUILD_ROOT}/etc/logrotate.d mkdir -p ${RPM_BUILD_ROOT}/etc/init.d mkdir -p ${RPM_BUILD_ROOT}/etc/sysconfig install -m 644 rpm/metaproxy.xml ${RPM_BUILD_ROOT}/etc/metaproxy/metaproxy.xml +install -m 644 rpm/metaproxy.user ${RPM_BUILD_ROOT}/etc/metaproxy/metaproxy.user install -m 755 rpm/metaproxy.init ${RPM_BUILD_ROOT}/etc/init.d/metaproxy install -m 644 rpm/metaproxy.sysconfig ${RPM_BUILD_ROOT}/etc/sysconfig/metaproxy install -m 644 rpm/metaproxy.logrotate ${RPM_BUILD_ROOT}/etc/logrotate.d/metaproxy @@ -101,17 +102,14 @@ rm -fr ${RPM_BUILD_ROOT} %{_mandir}/man?/* %config /etc/init.d/metaproxy %config(noreplace) /etc/metaproxy/metaproxy.xml +%config /etc/metaproxy/metaproxy.user %dir /etc/metaproxy/filters-available %dir /etc/metaproxy/filters-enabled %config(noreplace) /etc/logrotate.d/metaproxy %config(noreplace) /etc/sysconfig/metaproxy %post -[ -f /etc/sysconfig/metaproxy ] && . /etc/sysconfig/metaproxy -[ -z "$SERVER_HOME" ] && SERVER_HOME=/var/metaproxy -[ -z "$SERVER_USER" ] && SERVER_USER=metaproxy -[ -z "$SERVER_NAME" ] && SERVER_NAME="Metaproxy user" -[ -z "$SERVER_GROUP" ] && SERVER_GROUP=metaproxy +. /etc/metaproxy/metaproxy.user # 1. create group if not existing if ! getent group | grep -q "^$SERVER_GROUP:" ; then @@ -149,15 +147,7 @@ if [ $1 = 0 ]; then /sbin/service metaproxy stop > /dev/null 2>&1 /sbin/chkconfig --del metaproxy fi -fi -%postun -[ -f /etc/sysconfig/metaproxy ] && . /etc/sysconfig/metaproxy -[ -z "$SERVER_HOME" ] && SERVER_HOME=/var/metaproxy -[ -z "$SERVER_USER" ] && SERVER_USER=metaproxy -[ -z "$SERVER_NAME" ] && SERVER_NAME="Metaproxy user" -[ -z "$SERVER_GROUP" ] && SERVER_GROUP=metaproxy - -if [ $1 = 0 ]; then + . /etc/metaproxy/metaproxy.user test -d $SERVER_HOME && rm -fr $SERVER_HOME userdel $SERVER_USER fi diff --git a/rpm/metaproxy.init b/rpm/metaproxy.init index d303d36..d4cf0ab 100755 --- a/rpm/metaproxy.init +++ b/rpm/metaproxy.init @@ -96,7 +96,9 @@ else fi # end of compatibility layer for RedHat/SuSE -OPTIONS="-u nobody -l /var/log/metaproxy.log -c /etc/metaproxy/metaproxy.xml" +. /etc/metaproxy/metaproxy.user + +OPTIONS="-u $SERVER_USER -l /var/log/metaproxy.log -c /etc/metaproxy/metaproxy.xml" if [ -f /etc/sysconfig/metaproxy ]; then . /etc/sysconfig/metaproxy diff --git a/rpm/metaproxy.sysconfig b/rpm/metaproxy.sysconfig index 6a14674..7ea2230 100644 --- a/rpm/metaproxy.sysconfig +++ b/rpm/metaproxy.sysconfig @@ -1,10 +1,4 @@ # Defaults for metaproxy -# User and HOME of metaproxy daemon -SERVER_HOME=/var/metaproxy -SERVER_USER=metaproxy -SERVER_GROUP=metaproxy -SERVER_NAME="Metaproxy user" -# OPTIONS="-u $SERVER_USER -l /var/log/metaproxy.log -c /etc/metaproxy/metaproxy.xml" # The following options should noe be set, because since init.d script # already sets them: -p, -D, -t diff --git a/rpm/metaproxy.user b/rpm/metaproxy.user new file mode 100644 index 0000000..08c691e --- /dev/null +++ b/rpm/metaproxy.user @@ -0,0 +1,5 @@ +# Metaproxy user information +SERVER_HOME=/var/metaproxy +SERVER_USER=metaproxy +SERVER_NAME="Metaproxy user" +SERVER_GROUP=metaproxy -- 1.7.10.4