dbus: Fixes Bug#13094 - Check for existing user before `useradd`

Message ID 20230426203713.3274071-1-jon.murphy@ipfire.org
State Accepted
Commit 3df5187dfc42e0da2578a80057af57ddb37b435b
Headers
Series dbus: Fixes Bug#13094 - Check for existing user before `useradd` |

Commit Message

jon April 26, 2023, 8:37 p.m. UTC
  - The dbus install.sh script useradd command causes an error:
   "failed adding user 'messagebus', exit code: 9"
- This patch adds a check to only do the useradd if the user does not exist.
- See the bump PAK_VER for dbus that Adolf publised.  See this patch:
https://lists.ipfire.org/pipermail/development/2023-April/015816.html

Signed-off-by: Jon Murphy <jon.murphy@ipfire.org>
---
 src/paks/dbus/install.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
  

Patch

diff --git a/src/paks/dbus/install.sh b/src/paks/dbus/install.sh
index bf4e5a6d5..e4f2abda2 100644
--- a/src/paks/dbus/install.sh
+++ b/src/paks/dbus/install.sh
@@ -17,13 +17,13 @@ 
 # along with IPFire; if not, write to the Free Software                    #
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA #
 #                                                                          #
-# Copyright (C) 2007 IPFire-Team <info@ipfire.org>.                        #
+# Copyright (C) 2007-2023 IPFire-Team <info@ipfire.org>.                   #
 #                                                                          #
 ############################################################################
 #
 . /opt/pakfire/lib/functions.sh
 extract_files
-useradd messagebus
+id -u messagebus &>/dev/null || useradd -r -d /var/empty -s /bin/false messagebus
 
 # Create start links
 ln -svf  ../init.d/messagebus /etc/rc.d/rc3.d/S15messagebus