SHA256
1
0
forked from pool/aaa_base

Accepting request 228072 from Base:System

git commit 439506be299c79d70838c8edbb33b5046276f6ec (forwarded request 227012 from tsaupe)

OBS-URL: https://build.opensuse.org/request/show/228072
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/aaa_base?expand=0&rev=403
This commit is contained in:
Stephan Kulow 2014-04-06 07:54:04 +00:00 committed by Git OBS Bridge
parent 8567f9b1b7
commit d997ad11b2
4 changed files with 217 additions and 2 deletions

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:baea9e1d142e3d9329b76277a2ff0889751d3749d946d0691efa1ddecdfc7acc
size 83744
oid sha256:cfb02442d39b75a9eb1524e21b5b860926e049ccc20df860428268b3e0b76405
size 83408

View File

@ -8,6 +8,12 @@ Mon Mar 10 15:32:44 UTC 2014 - lnussel@suse.de
- adjust mktar script to new versioning scheme
- implement legacy actions (bnc#861124)
-------------------------------------------------------------------
Mon Mar 3 13:59:54 UTC 2014 - thomas.blume@suse.com
- move tmp file removal parameters from cron to systemd (fate#314974)
fate-314974.patch
-------------------------------------------------------------------
Thu Feb 27 07:28:15 UTC 2014 - coolo@suse.com

View File

@ -55,6 +55,7 @@ Source: aaa_base-%{version}.tar.xz
#
Source1: README.packaging.txt
Source99: aaa_base-rpmlintrc
Patch1: fate-314974.patch
%description
This package installs several important configuration files and central scripts.
@ -83,6 +84,8 @@ installed by default as it may degrade performance.
%prep
%setup -q
%patch1 -p1
chmod 755 files/usr/bin/systemd-tmpfiles-keep
%build
make CFLAGS="$RPM_OPT_FLAGS" CC="%{__cc}" %{?_smp_mflags}
@ -191,6 +194,7 @@ rm -f /root/.gnupg/secring.gpg.aaa_save
/usr/bin/safe-rm
/usr/bin/safe-rmdir
/usr/bin/setJava
/usr/bin/systemd-tmpfiles-keep
/usr/lib/restricted/bin/hostname
/usr/sbin/Check
/usr/sbin/sysconf_addword

205
fate-314974.patch Normal file
View File

@ -0,0 +1,205 @@
diff -Naur orig/aaa_base.pre mod/aaa_base.pre
--- orig/aaa_base.pre 2013-10-08 12:09:34.632146253 +0200
+++ mod/aaa_base.pre 2014-03-05 12:31:28.000000000 +0100
@@ -237,3 +237,147 @@
if test -f /root/.gnupg/secring.gpg ; then
cp -a /root/.gnupg/secring.gpg /root/.gnupg/secring.gpg.aaa_save
fi
+
+# fate 314974: port tmpdir removal parameters from /etc/sysconfig/cron to /etc/tmpfiles.d/tmp.conf
+# we don't take action if /etc/sysconfig/cron is not present
+if [ -f /etc/sysconfig/cron ]; then
+ . /etc/sysconfig/cron
+
+# we need at least a skeleton of tmp.conf
+ if [ ! -f /etc/tmpfiles.d/tmp.conf ]; then
+ if [ -f /usr/lib/tmpfiles.d/tmp.conf ]; then
+ cp /usr/lib/tmpfiles.d/tmp.conf /etc/tmpfiles.d/tmp.conf
+ else
+ echo "# This file is part of systemd.
+ #
+ # systemd is free software; you can redistribute it and/or modify it
+ # under the terms of the GNU Lesser General Public License as published by
+ # the Free Software Foundation; either version 2.1 of the License, or
+ # (at your option) any later version.
+
+ # See tmpfiles.d(5) for details
+
+ # Clear tmp directories separately, to make them easier to override
+ # SUSE policy: we don't clean those directories
+ d /tmp 1777 root root -
+ d /var/tmp 1777 root root -
+ #" | sed 's/^ *//g' > /etc/tmpfiles.d/tmp.conf
+ fi
+ fi
+
+# transform settings from /etc/sysconfig/cron to /etc/tmpfiles.d/tmp.conf
+ if [ "${#MAX_DAYS_IN_TMP}" -gt 0 ] || [ "${#TMP_DIRS_TO_CLEAR}" -gt 0 ]; then
+ ISINTTMP=`test "$MAX_DAYS_IN_TMP" -eq "$MAX_DAYS_IN_TMP" 2>/dev/null ; echo $?`
+ if [ "$ISINTTMP" -eq 0 ]; then
+ for DIR in $TMP_DIRS_TO_CLEAR; do
+ DIRENT=`sed -n "\c^d $DIR cp" /etc/tmpfiles.d/tmp.conf`
+ if [ -n "$DIRENT" ]; then
+ AGE=`echo $DIRENT | cut -d " " -f 6`
+ if [ $AGE == "-" ] && [ "$MAX_DAYS_IN_TMP" -gt 0 ]; then
+ MODENT+=`sed -n "\c^d $DIR cs/-/"$MAX_DAYS_IN_TMP"d/p" /etc/tmpfiles.d/tmp.conf | sed 's/^d/\\\nd/'`
+ else
+ MODENT+=`echo $DIRENT | sed 's/^d/\\\nd/'`
+ fi
+ elif [ "$MAX_DAYS_IN_TMP" -gt 0 ]; then
+ MODENT+=`echo "\nd $DIR 1777 root root "$MAX_DAYS_IN_TMP"d"`
+ elif [ "$MAX_DAYS_IN_TMP" -eq 0 ]; then
+ MODENT+=`echo "\nd $DIR 1777 root root -"`
+ fi
+ done
+ if [ ${#TMP_DIRS_TO_CLEAR} -eq 0 ] && [ "$MAX_DAYS_IN_TMP" -gt 0 ]; then
+ MODENT+=`echo "\nd /tmp 1777 root root "$MAX_DAYS_IN_TMP"d"`
+ fi
+ fi
+ fi
+
+ if [ -n "$MAX_DAYS_IN_LONG_TMP" ] || [ -n "$LONG_TMP_DIRS_TO_CLEAR" ]; then
+ ISINTTMP=`test $MAX_DAYS_IN_LONG_TMP -eq $MAX_DAYS_IN_LONG_TMP 2>/dev/null ; echo $?`
+ if [ "$ISINTTMP" -eq 0 ]; then
+ for DIR in $LONG_TMP_DIRS_TO_CLEAR; do
+ DIRENT=`sed -n "\c^d $DIR cp" /etc/tmpfiles.d/tmp.conf`
+ if [ -n "$DIRENT" ]; then
+ AGE=`echo $DIRENT | cut -d " " -f 6`
+ if [ $AGE == "-" ] && [ "$MAX_DAYS_IN_LONG_TMP" -gt 0 ]; then
+ MODENT+=`sed -n "\c^d $DIR cs/-/"$MAX_DAYS_IN_LONG_TMP"d/p" /etc/tmpfiles.d/tmp.conf | sed 's/^d/\\\nd/'`
+ else
+ MODENT+=`echo $DIRENT | sed 's/^d/\\\nd/'`
+ fi
+ elif [ "$MAX_DAYS_IN_LONG_TMP" -gt 0 ]; then
+ MODENT+=`echo "\nd $DIR 1777 root root "$MAX_DAYS_IN_LONG_TMP"d"`
+ elif [ "$MAX_DAYS_IN_TMP" -eq 0 ]; then
+ MODENT+=`echo "\nd $DIR 1777 root root -"`
+ fi
+ done
+ fi
+ fi
+
+# keep additional directory entries that are already present in tmp.conf
+ for ENTRY in `sed -n '/^d\ \//p' /etc/tmpfiles.d/tmp.conf | cut -d " " -f 2`; do
+ if [[ ! "$MODENT" =~ "d $ENTRY " ]]; then
+ MODENT+=`sed -n "\c^d $ENTRY cp" /etc/tmpfiles.d/tmp.conf | sed 's/^d/\\\nd/'`
+ fi
+ done
+
+ sed -e '/^d\ \//d' -e '/^R\ \//d' -e '/# Clear tmp directories/,+2d' /etc/tmpfiles.d/tmp.conf | sed -re '$!N;/^\n$/!P;D' > /etc/tmpfiles.d/tmp.conf.tmp
+ echo -e "\n# Clear tmp directories separately, to make them easier to override" >>/etc/tmpfiles.d/tmp.conf.tmp
+ echo "# SUSE policy: we don't clean those directories" >>/etc/tmpfiles.d/tmp.conf.tmp
+ echo -e "$MODENT" >> /etc/tmpfiles.d/tmp.conf.tmp
+
+# address directories to be cleared at system boot
+ : ${TMP_DIRS_TO_CLEAR:=/tmp}
+ : ${CLEAR_TMP_DIRS_AT_BOOTUP:=no}
+ REMENT=`sed -n '/^R\ \//s/^/ /p' /etc/tmpfiles.d/tmp.conf`
+ CLEAR_DIRS="$TMP_DIRS_TO_CLEAR"
+ if [ "${CLEAR_TMP_DIRS_AT_BOOTUP:0:1}" == "/" ]; then
+ CLEAR_DIRS="$CLEAR_TMP_DIRS_AT_BOOTUP"
+ CLEAR_TMP_DIRS_AT_BOOTUP=yes
+ fi
+ if test "$CLEAR_TMP_DIRS_AT_BOOTUP" = yes; then
+ for DIR in $CLEAR_DIRS; do
+ if [[ ! "$REMENT" =~ "R $DIR/*" ]]; then
+ REMENT+=`echo " R $DIR/*"`
+ fi
+ done
+ fi
+ echo -e "$REMENT" | sed -e 's/ R/\nR/g' | sed '/^$/d' >> /etc/tmpfiles.d/tmp.conf.tmp
+
+# take care of ownerkeep parameters
+# owner based keeping of files is not implemented in systemd, so we need to run a script
+# that creates keep entries before each scheduled removal run
+ OWNER_TO_KEEP_IN_TMP=`sed -n '/^OWNER_TO_KEEP_IN_TMP/p' /etc/sysconfig/cron`
+ if [ ${#OWNER_TO_KEEP_IN_TMP} -gt 0 ]; then
+ TMPDIR_TO_SEARCH_OWNER=`sed -n 's/^TMP_DIRS_TO_CLEAR/TMPDIR_TO_SEARCH_OWNER/p' /etc/sysconfig/cron`
+
+ echo "
+ #########Moved sysconfig variables, do not delete leading hashes!#########
+ ## Type: string
+ ## Default: root
+ #
+ # In OWNER_TO_KEEP_IN_TMP, you can specify, whose files shall not be deleted.
+ #
+ #${OWNER_TO_KEEP_IN_TMP:-OWNER_TO_KEEP_IN_TMP=\"root\"}
+
+ ## Type: string
+ ## Default: ""
+ #
+ # To which of the TMP directories should OWNER_TO_KEEP_IN_TMP apply.
+ # If empty it defaults to all directory entries in /etc/tmpfiles.d/tmp.conf.
+ #${TMPDIR_TO_SEARCH_OWNER:-TMPDIR_TO_SEARCH_OWNER=\"\"}
+ ##########################################################################
+ " | sed 's/^ *//g' >> /etc/tmpfiles.d/tmp.conf.tmp
+ fi
+ mv /etc/tmpfiles.d/tmp.conf.tmp /etc/tmpfiles.d/tmp.conf
+
+# clear old variables from /etc/sysconfig/cron
+ OLDVARS=`sed '1!G;h;$!d' /etc/sysconfig/cron | sed -n '/^CLEAR_TMP_DIRS_AT_BOOTUP/,/Path:.*System\/Cron$/p'`
+ if [ ${#OLDVARS} -gt 0 ]; then
+ echo "## The Parameters MAX_DAYS_IN_TMP, MAX_DAYS_IN_LONG_TMP, TMP_DIRS_TO_CLEAR,
+ ## LONG_TMP_DIRS_TO_CLEAR, CLEAR_TMP_DIRS_AT_BOOTUP and OWNER_TO_KEEP_IN_TMP have
+ ## been converted to systemd-tmpfiles settings in /etc/tmpfiles.d/tmp.conf.
+ ## Please check and modify to your needs.
+ ## See 'man tmpfiles.d' for details.
+ " | sed 's/^ *//g' > /etc/sysconfig/cron.tmp
+ sed '1!G;h;$!d' /etc/sysconfig/cron | sed '/^CLEAR_TMP_DIRS_AT_BOOTUP/,/Path:.*System\/Cron$/d' | sed '1!G;h;$!d' >> /etc/sysconfig/cron.tmp
+ mv /etc/sysconfig/cron.tmp /etc/sysconfig/cron
+ fi
+fi
diff -Naur orig/files/usr/bin/systemd-tmpfiles-keep mod/files/usr/bin/systemd-tmpfiles-keep
--- orig/files/usr/bin/systemd-tmpfiles-keep 1970-01-01 01:00:00.000000000 +0100
+++ mod/files/usr/bin/systemd-tmpfiles-keep 2014-03-05 12:22:56.000000000 +0100
@@ -0,0 +1,50 @@
+#!/bin/sh
+#
+# Create exclude entries for files owned by $OWNER_TO_KEEP_IN_TMP in /etc/tmpfiles.d/tmp.conf
+#
+# Copyright (c) 2014 SUSE LINUX Products GmbH, Germany.
+#
+# Author: Thomas Blume
+#
+# Please send feedback to http://www.suse.de/feedback
+#
+
+#
+# paranoia settings
+#
+umask 022
+
+PATH=/sbin:/bin:/usr/sbin:/usr/bin
+export PATH
+
+if [ -f /etc/tmpfiles.d/tmp.conf ]; then
+ OWNER_TO_KEEP_IN_TMP=`sed -n '/#OWNER_TO_KEEP_IN_TMP/s/#OWNER_TO_KEEP_IN_TMP=//p' /etc/tmpfiles.d/tmp.conf | sed 's/\"//g'`
+ TMPDIR_TO_SEARCH_OWNER=`sed -n '/#TMPDIR_TO_SEARCH_OWNER/s/#TMPDIR_TO_SEARCH_OWNER=//p' /etc/tmpfiles.d/tmp.conf | sed 's/\"//g'`
+
+ if [ "${TMPDIR_TO_SEARCH_OWNER:0:1}" == "/" ]; then
+ DIRENT="$TMPDIR_TO_SEARCH_OWNER"
+ else
+ DIRENT=`sed -n '/^d\ \//p' /etc/tmpfiles.d/tmp.conf | cut -d " " -f 2`
+ fi
+
+ for DIR in $DIRENT ; do
+ for OWNER in $OWNER_TO_KEEP_IN_TMP ; do
+ getent passwd $OWNER >/dev/null
+ if [ $? == 0 ] && [ -d $DIR ]; then
+ FILES_TO_KEEP+=`/usr/bin/find $DIR/* -user $OWNER 2>/dev/null`
+ fi
+ done
+ done
+
+
+ if [ ${#FILES_TO_KEEP} -gt 0 ]; then
+ sed '/######Automatically generated part, please do not modify######/,/###############Automatically generated part end###############/d' /etc/tmpfiles.d/tmp.conf | sed -re '$!N;/^\n$/!P;D' > /etc/tmpfiles.d/tmp.conf.tmp
+ echo -e "\n######Automatically generated part, please do not modify######" >> /etc/tmpfiles.d/tmp.conf.tmp
+ echo "# Exclude files owned by OWNER_TO_KEEP_IN_TMP " >>/etc/tmpfiles.d/tmp.conf.tmp
+ for i in $FILES_TO_KEEP; do
+ echo "x $i" >> /etc/tmpfiles.d/tmp.conf.tmp
+ done
+ echo "###############Automatically generated part end###############" >>/etc/tmpfiles.d/tmp.conf.tmp
+ mv /etc/tmpfiles.d/tmp.conf.tmp /etc/tmpfiles.d/tmp.conf
+ fi
+fi