diff options
author | José Bollo <jose.bollo@open.eurogiciel.org> | 2015-02-19 14:41:33 +0100 |
---|---|---|
committer | José Bollo <jose.bollo@open.eurogiciel.org> | 2015-02-19 14:41:33 +0100 |
commit | 8d312c90a663b8a9319aba64b25ec370e457a202 (patch) | |
tree | f2c7be501862f7e2e5a415beaadb360af58318f7 | |
parent | 30ff93b6f03098ab14626e2212776b05594cb212 (diff) | |
download | buxton-accepted/tizen/common/20150220.083137.tar.gz buxton-accepted/tizen/common/20150220.083137.tar.bz2 buxton-accepted/tizen/common/20150220.083137.zip |
Improve post-install initialisationsubmit/tizen/20150219.172002accepted/tizen/wearable/20150220.130143accepted/tizen/tv/20150220.125615accepted/tizen/mobile/20150220.131654accepted/tizen/common/20150220.083137
The improvement comes from 4 modifications:
1. the foreign required programs are listed
2. the group is created if needed as a system group
3. the user is created if needed as a system user
4. the created files are really changed of owner and contex
Change-Id: I1b8dcddf6a97a6a748a2fb89bb5bef8dda4a00a2
Signed-off-by: José Bollo <jose.bollo@open.eurogiciel.org>
-rw-r--r-- | packaging/buxton.spec | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/packaging/buxton.spec b/packaging/buxton.spec index f325141..f6b3197 100644 --- a/packaging/buxton.spec +++ b/packaging/buxton.spec @@ -15,7 +15,11 @@ BuildRequires: pkgconfig(systemd) BuildRequires: pkgconfig(libsystemd-daemon) Requires(post): buxton Requires(post): smack +Requires(post): /usr/bin/getent Requires(post): /usr/bin/chown +Requires(post): /usr/sbin/useradd +Requires(post): /usr/sbin/groupadd +Requires(post): /usr/bin/chsmack %description Buxton is a security-enabled configuration management system. It @@ -92,18 +96,24 @@ install -m 0644 %{SOURCE1} %{buildroot}%{_sysconfdir}/buxton.conf %post /sbin/ldconfig -#buxtond runs as user buxton, which much be created -useradd buxton +# the database directory +dbdir="%{_localstatedir}/lib/buxton" + +# buxtond runs as user buxton of group buxton +# create it on need! +getent group buxton > /dev/null || groupadd -r buxton +getent passwd buxton > /dev/null || useradd -r -g buxton -d "${dbdir}" buxton + +# create initial databases buxtonctl create-db base buxtonctl create-db isp -if [ "$1" -eq 1 ] ; then - # The initial DBs will not have the correct labels and - # permissions when created in postinstall during image - # creation, so we set these file attributes here. - chsmack -a System %{_localstatedir}/lib/buxton/*.db - chown buxton:buxton %{_localstatedir}/lib/buxton/*.db -fi + +# The initial DBs will not have the correct labels and +# permissions when created in postinstall during image +# creation, so we set these file attributes here. +chown -R buxton:buxton "${dbdir}" +chsmack -a System "${dbdir}" "${dbdir}"/*.db %postun -p /sbin/ldconfig |