[Slackbuilds-users] dbus.SlackBuild: messagebus user and group

Niki Kovacs contact at kikinovak.net
Tue Jan 30 09:06:48 UTC 2007


Hi,

The dbus script suggests to manually take care of creating messagebus user and
group. My own SlackBuild for dbus tries to make sense of the various scripts I
found on the Internet. As I like to say: several ways lead to
Saint-Bauzille-de-Putois. I'd like to suggest this one improvement for
doinst.sh:

--8<-----

#!/bin/sh

# If the messagebus user/group don't exist, add them:
if grep "^messagebus:" etc/group 1> /dev/null 2> /dev/null ; then
  true
else
  groupadd -g 60 messagebus
fi
if grep "^messagebus:" etc/passwd 1> /dev/null 2> /dev/null ; then
  true
else
  useradd -g messagebus -u 60 -s /bin/false -M messagebus
fi

# if rc.local doesn't exist, create it
if [ ! -e etc/rc.d/rc.local ]; then
   echo "#!/bin/sh" > etc/rc.d/rc.local
   chmod 755 etc/rc.d/rc.local
fi

# if rc.local_shutdown doesn't exist, create it
if [ ! -e etc/rc.d/rc.local_shutdown ]; then
   echo "#!/bin/sh" > etc/rc.d/rc.local_shutdown
   chmod 755 etc/rc.d/rc.local_shutdown
fi

# if rc.messagebus is executable, run it on startup
exist_run=`grep ". /etc/rc.d/rc.messagebus" etc/rc.d/rc.local`
if [[ "${exist_run}" == "" ]]; then
cat << EOF >> etc/rc.d/rc.local

# To disable dbus, chmod rc.messagebus to 644
if [ -x /etc/rc.d/rc.messagebus ]; then
  . /etc/rc.d/rc.messagebus start
fi
EOF
fi

# Stop DBUS on shutdown
exist_shutdown=`grep ". /etc/rc.d/rc.messagebus" etc/rc.d/rc.local_shutdown`
if [[ "${exist_shutdown}" == "" ]]; then
cat << EOF >> etc/rc.d/rc.local_shutdown

# Stop the system message bus
if [ -x /etc/rc.d/rc.messagebus ]; then
  . /etc/rc.d/rc.messagebus stop
fi
EOF
fi

--8<-----


... or is there some caveat?

Cheers,

Niki




More information about the Slackbuilds-users mailing list