From f4f011f862059696e1c068ece09ab1b620c125e0c740e87d24f1fa2093712586 Mon Sep 17 00:00:00 2001
From: Aleksa Sarai <asarai@suse.com>
Date: Tue, 9 Apr 2019 13:11:48 +0000
Subject: [PATCH] Accepting request 692303 from
 home:jengelh:branches:Virtualization:containers

- %pre bash features: replace by POSIX equivalents.
- %build bash features: add %_buildshell definition for it.
- Do not igonre errors from groupadd.

OBS-URL: https://build.opensuse.org/request/show/692303
OBS-URL: https://build.opensuse.org/package/show/Virtualization:containers/lxd?expand=0&rev=7
---
 lxd.changes | 7 +++++++
 lxd.spec    | 9 +++++----
 2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/lxd.changes b/lxd.changes
index faab45f..17096a0 100644
--- a/lxd.changes
+++ b/lxd.changes
@@ -1,3 +1,10 @@
+-------------------------------------------------------------------
+Mon Apr  8 13:18:50 UTC 2019 - Jan Engelhardt <jengelh@inai.de>
+
+- %pre bash features: replace by POSIX equivalents.
+- %build bash features: add %_buildshell definition for it.
+- Do not igonre errors from groupadd.
+
 -------------------------------------------------------------------
 Fri Apr  5 19:13:48 UTC 2019 - Aleksa Sarai <asarai@suse.com>
 
diff --git a/lxd.spec b/lxd.spec
index 3288f43..da8ca27 100644
--- a/lxd.spec
+++ b/lxd.spec
@@ -15,6 +15,7 @@
 # Please submit bugfixes or comments via https://bugs.opensuse.org/
 #
 
+%define _buildshell /bin/bash
 %define import_path github.com/lxc/lxd
 
 Name:           lxd
@@ -240,12 +241,12 @@ install -d -m 0755 %{buildroot}%{_localstatedir}/log/%{name}
 
 %pre
 # Group which owns the lxd socket, which allows people to administer it.
-getent group %{name} &>/dev/null || groupadd -r %{name} ||:
+getent group %{name} >/dev/null || groupadd -r %{name}
 
 # /etc/sub[ug]id should exist already (it's part of shadow-utils), but older
 # distros don't have it. LXD just parses it and doesn't need any special
 # shadow-utils helpers.
-touch /etc/sub{u,g}id ||:
+touch /etc/subuid /etc/subgid || :
 
 # Add sub[ug]ids for LXD's unprivileged containers -- in order to support
 # isolated containers we add quite a few subuids. Since LXD runs as root we add
@@ -260,9 +261,9 @@ touch /etc/sub{u,g}id ||:
 #
 # This default setting of 500 million is enough for ~8000 isolated containers,
 # which should be enough for most users.
-grep '^root:' /etc/subuid &>/dev/null || \
+grep -q '^root:' /etc/subuid 2>/dev/null || \
 	usermod -v 400000000-900000000 root ||:
-grep '^root:' /etc/subgid &>/dev/null || \
+grep -q '^root:' /etc/subgid 2>/dev/null || \
 	usermod -w 400000000-900000000 root ||:
 
 %service_add_pre %{name}.service