dip

old school recipes for janitorial snafu.
git clone git://git.ricketyspace.net/dip.git
Log | Files | Refs

Makefile (3558B)


      1 nothing: ; @echo 'give me something to make'
      2 .PHONY: nothing
      3 
      4 # Provision /usr/local/bin
      5 USRBIN_PREFIX:=usr/local/bin
      6 USRBIN_FILES:=alarm x-setup fdg rsync-bu tball pgdump clock
      7 usrbin:
      8 .for f in ${USRBIN_FILES}
      9 	rsync -a ${USRBIN_PREFIX}/${f} /${USRBIN_PREFIX}/${f}
     10 .endfor
     11 .PHONY: usrbin
     12 
     13 # Provision hosts
     14 hosts:
     15 	while read line; do \
     16 		grep -q "$$line" /etc/hosts || \
     17 			echo "$$line" >> /etc/hosts; \
     18 	done <etc/hosts
     19 .PHONY: hosts
     20 
     21 # Provision hostnames
     22 HN=hostname.*
     23 hn:
     24 	rsync etc/${HN} /etc/
     25 	chown root:wheel /etc/${HN}
     26 .PHONY: hn
     27 
     28 # Provision dhclient
     29 dhclient:
     30 	rsync etc/dhclient.conf /etc/
     31 	chown root:wheel /etc/dhclient.conf
     32 .PHONY: dhclient
     33 
     34 # Provision /etc/nginx
     35 NGINX_DIR:=etc/nginx
     36 HTML_DIR:=/var/www/html
     37 nginx:
     38 	rsync -a ${NGINX_DIR}/sites.conf /${NGINX_DIR}/sites.conf
     39 	grep -q 'sites.conf' /${NGINX_DIR}/nginx.conf || \
     40 		patch -u /${NGINX_DIR}/nginx.conf ${NGINX_DIR}/nginx.conf.patch
     41 
     42 	mkdir -p ${HTML_DIR}/sicp
     43 	mkdir -p ${HTML_DIR}/cached-web
     44 	mkdir -p ${HTML_DIR}/taoup
     45 	mkdir -p ${HTML_DIR}/vm
     46 	mkdir -p ${HTML_DIR}/fsfi
     47 	mkdir -p ${HTML_DIR}/rs
     48 	mkdir -p ${HTML_DIR}/lpsg
     49 .PHONY: nginx
     50 
     51 # Initialize postgresql
     52 psql:
     53 	su - _postgresql -c 'mkdir -p /var/postgresql/data'
     54 	su - _postgresql -c 'initdb -D /var/postgresql/data \
     55 		-U postgres -A scram-sha-256 \
     56 		-E UTF8 --locale=en_US.UTF-8 \
     57 		-W'
     58 .PHONY: psql
     59 
     60 # Provision php fpm
     61 FPM_DIR=etc/php-fpm.d/
     62 php: hosts
     63 	rsync -a ${FPM_DIR} /${FPM_DIR}
     64 	mkdir -p /var/www/etc && rsync -a /etc/hosts /var/www/etc/hosts
     65 	rsync -a /bin/sh  /var/www/bin/sh
     66 .PHONY: php
     67 
     68 # Provision doas
     69 DOAS_CONF=etc/doas.conf
     70 doas:
     71 	rsync -a ${DOAS_CONF} /${DOAS_CONF}
     72 	chown root:wheel /${DOAS_CONF}
     73 .PHONY: doas
     74 
     75 SYSCTL_CONF=etc/sysctl.conf
     76 sysctl:
     77 	rsync -a ${SYSCTL_CONF} /${SYSCTL_CONF}
     78 .PHONY: sysctl
     79 
     80 # pf baby.
     81 PF_CONF=etc/pf.conf
     82 pf:
     83 	while read line; do \
     84 		grep -q "$$line" /${PF_CONF} || \
     85 			echo $$line >> /${PF_CONF}; \
     86 	done <${PF_CONF}
     87 .PHONY: pf
     88 
     89 # Provision exports
     90 exports:
     91 	rsync -a etc/exports /etc/exports
     92 	chown root:wheel /etc/exports
     93 .PHONY: exports
     94 
     95 # Provision fstab
     96 fstab:
     97 	while read line; do \
     98 		grep -q "$$line" /etc/fstab || \
     99 			echo $$line >> /etc/fstab; \
    100 	done <etc/fstab
    101 
    102 	rcctl reload mountd
    103 	mount -a
    104 .PHONY: fstab
    105 
    106 # Provision mpd
    107 mpd:
    108 	rsync -a etc/mpd.conf /etc/mpd.conf
    109 	chown root:wheel /etc/mpd.conf
    110 .PHONY: mpd
    111 
    112 # Provision wsconsctl
    113 wsconsctl:
    114 	rsync -a etc/wsconsctl.conf /etc/wsconsctl.conf
    115 	chown root:wheel /etc/wsconsctl.conf
    116 .PHONY: wsconsctl
    117 
    118 # Enable rc.d daemons.
    119 DAEMONS_ENABLED=portmap mountd nfsd unwind
    120 edaemons: exports
    121 	rcctl enable ${DAEMONS_ENABLED}
    122 	rcctl start ${DAEMONS_ENABLED}
    123 	rcctl check ${DAEMONS_ENABLED}
    124 .PHONY: edaemons
    125 
    126 # Provision cabal build dir.
    127 CABAL_BDIR=/usr/local/cabal/build
    128 ${CABAL_BDIR}:
    129 	mkdir -p ${CABAL_BDIR}
    130 	chown -R s:wheel `dirname ${CABAL_BDIR}`
    131 
    132 cabal: ${CABAL_BDIR}
    133 	rm -rf ~/.cabal
    134 	ln -sf /usr/local/cabal ~/.cabal
    135 .PHONY: cabal
    136 
    137 # Provision virtualenv directory for python virtual environments.
    138 VENV_DIR=/usr/local/virtualenv
    139 ${VENV_DIR}:
    140 	mkdir -p ${VENV_DIR}
    141 	chown -R s:wheel `dirname ${VENV_DIR}`
    142 venv: ${VENV_DIR}
    143 .PHONY: venv
    144 
    145 # cron
    146 cron:
    147 	crontab var/cron/tabs/s
    148 .PHONY: cron
    149 
    150 pkgs:
    151 	pkg_add -v git \
    152 	bash \
    153 	gnupg \
    154 	pinentry-gtk2 \
    155 	password-store \
    156 	emacs \
    157 	ispell \
    158 	movemail \
    159 	redshift \
    160 	slock \
    161 	chromium \
    162 	firefox \
    163 	mupdf \
    164 	ledger \
    165 	guile2 \
    166 	racket-minimal \
    167 	go \
    168 	htop \
    169 	gmake \
    170 	ctags \
    171 	mpd \
    172 	mpc \
    173 	mplayer \
    174 	ncmpcpp \
    175 	nginx \
    176 	php \
    177 	postgresql-server \
    178 	postgresql-client \
    179 	postgresql-docs \
    180 	terminus-font \
    181 	cabal-install \
    182 	ghc \
    183 	py3-virtualenv
    184 .PHONY: pkgs