summarylogtreecommitdiffstats
path: root/systemd-hosts.d.install
blob: c9c0d4b57de7278b224225cf756208451fb91d71 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
post_install() {
    [[ ! -L /etc/hosts ]] &&
        mv -b /etc/hosts /etc/hosts.d/hosts.conf
    ln -sf /run/hosts /etc/hosts
    systemctl enable --now systemd-hosts.d.service
    systemctl enable --now systemd-hosts.d.path
}

pre_remove() {
    [[ -L /etc/hosts ]] &&
        rm /etc/hosts
    mv /etc/hosts.d/hosts.conf /etc/hosts ||
        mv /run/hosts /etc/hosts ||
        touch /etc/hosts
    systemctl disable --now systemd-hosts.d.path
    systemctl disable --now systemd-hosts.d.service
}