blob: e992a361e88f35e5fbddd24bcba666dbab33ffc7 [file] [log] [blame]
Simon Kelleybc54ae32012-08-28 21:26:56 +01001#!/bin/sh
2set -e
3
4# Create the dnsmasq user in dnsmasq-base, so that Dbus doesn't complain.
Tarun Kundu12e3b2e2024-08-15 16:16:53 -07005
Simon Kelleybc54ae32012-08-28 21:26:56 +01006if [ "$1" = "configure" ]; then
Tarun Kundu12e3b2e2024-08-15 16:16:53 -07007 # Create the user to run as.
Simon Kelleybc54ae32012-08-28 21:26:56 +01008 if [ -z "`id -u dnsmasq 2> /dev/null`" ]; then
Tarun Kundu12e3b2e2024-08-15 16:16:53 -07009 useradd --system \
10 --gid nogroup \
11 --comment dnsmasq \
12 --home-dir /var/lib/misc --no-create-home \
13 --shell /usr/sbin/nologin \
14 dnsmasq
Simon Kelleybc54ae32012-08-28 21:26:56 +010015 fi
16
17 # Make the directory where we keep the pid file - this
18 # has to be owned by "dnsmasq" so that the file can be unlinked.
19 # This is only actually used by the dnsmasq binary package, not
20 # dnsmasq-base, but it's much easier to create it here so that
21 # we don't have synchronisation issues with the creation of the
Tarun Kundu12e3b2e2024-08-15 16:16:53 -070022 # dnsmasq user.
Simon Kelley47901152015-09-29 22:54:41 +010023 if [ ! -d /run/dnsmasq ]; then
24 mkdir /run/dnsmasq
25 chown dnsmasq:nogroup /run/dnsmasq
Simon Kelleybc54ae32012-08-28 21:26:56 +010026 fi
27fi
Tarun Kundu12e3b2e2024-08-15 16:16:53 -070028
29#DEBHELPER#
30