summaryrefslogtreecommitdiff
path: root/debian/vyos-1x.postinst
blob: 81ba74b9b8526eeecd03b0282b5b9f3761115e42 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/bin/sh -e
if ! deb-systemd-helper --quiet was-enabled salt-minion.service; then
    # Enables the unit on first installation, creates new
    # symlinks on upgrades if the unit file has changed.
    deb-systemd-helper disable salt-minion.service >/dev/null || true
fi

if [ -x "/etc/init.d/salt-minion" ]; then
    update-rc.d -f salt-minion remove >/dev/null
fi

# Add minion user for salt-minion
if ! grep -q '^minion' /etc/passwd; then
    adduser --quiet --firstuid 100 --system --disabled-login --ingroup vyattacfg --gecos "salt minion user" --shell /bin/vbash minion
    adduser --quiet minion frrvty
    adduser --quiet minion sudo
    adduser --quiet minion adm
    adduser --quiet minion dip
    adduser --quiet minion disk
    adduser --quiet minion users
fi

# add hostsd group for vyos-hostsd
if ! grep -q '^hostsd' /etc/group; then
    addgroup --quiet --system hostsd
fi

# add dhcpd user for dhcp-server
if ! grep -q '^dhcpd' /etc/passwd; then
    adduser --quiet --system --disabled-login --no-create-home --home /run/dhcp-server dhcpd
    adduser --quiet dhcpd hostsd
fi

# ensure hte proxy user has a proper shell
chsh -s /bin/sh proxy

# Remove unwanted daemon files from /etc
# conntackd
DELETE="/etc/logrotate.d/conntrackd.distrib /etc/init.d/conntrackd /etc/default/conntrackd /etc/ppp/ip-up.d/0000usepeerdns /etc/ppp/ip-down.d/0000usepeerdns"
for file in $DELETE; do
    if [ -f ${file} ]; then
        rm -f ${file}
    fi
done

# Enable Cloud-init pre-configuration service
systemctl enable vyos-config-cloud-init.service