drist-etc_hosts

drist script to update local and remote /etc/hosts
git clone git://git.pyratebeard.net/drist-etc_hosts.git
Log | Files | Refs

commit 4bddd5478bd9c3a491a8df2a8418c371ed0a441b
Author: pyratebeard <root@pyratebeard.net>
Date:   Sat, 16 Dec 2023 22:22:35 +0000

initial commit

Diffstat:
Amakefile | 14++++++++++++++
Ascript | 14++++++++++++++
2 files changed, 28 insertions(+), 0 deletions(-)

diff --git a/makefile b/makefile @@ -0,0 +1,14 @@ +LOCALSERVER := laundry +REMOTESERVER := nublar +FILESDIR = files + +.PHONY: dnsmasq + +dnsmasq: + if [ ! -d ${FILESDIR} ] ; then mkdir ${FILESDIR} ; fi + /usr/bin/pass systems/etc_hosts/default > ${FILESDIR}/default.hosts + /usr/bin/pass systems/etc_hosts/local > ${FILESDIR}/local.hosts + /usr/bin/pass systems/etc_hosts/remote > ${FILESDIR}/remote.hosts + drist ${REMOTESERVER} + drist ${LOCALSERVER} + rm -f ${FILESDIR}/*.hosts diff --git a/script b/script @@ -0,0 +1,14 @@ +#!/usr/bin/zsh + +if [[ $(hostname -s) == "laundry" ]] ; then + cat default.hosts local.hosts remote.hosts | sudo tee /etc/hosts >/dev/null + sudo chown root:root /etc/hosts + sudo chmod 644 /etc/hosts + sudo systemctl restart dnsmasq +fi + +if [[ $(hostname -s) == "nublar" ]] ; then + cat default.hosts remote.hosts | sudo tee /etc/hosts >/dev/null + sudo chown root:root /etc/hosts + sudo chmod 644 /etc/hosts +fi