Simon Kelley | bc54ae3 | 2012-08-28 21:26:56 +0100 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | set -e |
| 3 | |
| 4 | # Create the dnsmasq user in dnsmasq-base, so that Dbus doesn't complain. |
Tarun Kundu | 12e3b2e | 2024-08-15 16:16:53 -0700 | [diff] [blame] | 5 | |
Simon Kelley | bc54ae3 | 2012-08-28 21:26:56 +0100 | [diff] [blame] | 6 | if [ "$1" = "configure" ]; then |
Tarun Kundu | 12e3b2e | 2024-08-15 16:16:53 -0700 | [diff] [blame] | 7 | # Create the user to run as. |
Simon Kelley | bc54ae3 | 2012-08-28 21:26:56 +0100 | [diff] [blame] | 8 | if [ -z "`id -u dnsmasq 2> /dev/null`" ]; then |
Tarun Kundu | 12e3b2e | 2024-08-15 16:16:53 -0700 | [diff] [blame] | 9 | 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 Kelley | bc54ae3 | 2012-08-28 21:26:56 +0100 | [diff] [blame] | 15 | 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 Kundu | 12e3b2e | 2024-08-15 16:16:53 -0700 | [diff] [blame] | 22 | # dnsmasq user. |
Simon Kelley | 4790115 | 2015-09-29 22:54:41 +0100 | [diff] [blame] | 23 | if [ ! -d /run/dnsmasq ]; then |
| 24 | mkdir /run/dnsmasq |
| 25 | chown dnsmasq:nogroup /run/dnsmasq |
Simon Kelley | bc54ae3 | 2012-08-28 21:26:56 +0100 | [diff] [blame] | 26 | fi |
| 27 | fi |
Tarun Kundu | 12e3b2e | 2024-08-15 16:16:53 -0700 | [diff] [blame] | 28 | |
| 29 | #DEBHELPER# |
| 30 | |