cosmic/Makefile

85 lines
2.8 KiB
Makefile
Raw Permalink Normal View History

2020-09-18 22:37:51 +00:00
help:
@echo "targets:"
@awk -F '#' '/^\w+:.*?#/ { print $0 }' $(MAKEFILE_LIST) \
| sed -n 's/^\(.*\): \(.*\)#\(.*\)/ \1|-\3/p' \
| column -t -s '|'
2019-01-02 20:01:57 +00:00
2020-09-18 22:37:51 +00:00
install: apt bin templates man completion files efingerd menu postfix updatemotd source # install everything
.PHONY: help apt bin templates man completion files efingerd menu postfix updatemotd source
apt: # install all apt packages
2019-02-24 16:54:33 +00:00
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
if [ ! -f "/etc/apt/sources.list.d/yarn.list" ]; then \
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list; \
fi
2019-01-02 20:01:57 +00:00
xargs -a pkglist sudo apt install -y
2018-12-12 20:09:26 +00:00
2020-09-18 22:37:51 +00:00
source: # clone all manual source packages to /var/packages
2019-02-06 02:31:41 +00:00
@while IFS= read -r line; do \
name=$$(printf "%s" "$$line" | awk -F "\t" '{print $$1}'); \
repo=$$(printf "%s" "$$line" | awk -F "\t" '{print $$2}'); \
2019-02-06 02:34:15 +00:00
dir="/var/packages/$${name}"; \
if [ ! -d "$$dir" ]; then \
mkdir -p "$$dir"; \
git clone "$$repo" "$$dir"; \
2019-02-06 02:31:41 +00:00
else \
printf "%s already cloned\\n" "$${name}"; \
fi; \
done < "pkglist-source"
2020-09-18 22:37:51 +00:00
bin: # link bin scripts to /usr/local/bin
2018-12-12 20:09:26 +00:00
stow -t "/usr/local/bin" bin
2020-09-18 22:37:51 +00:00
templates: # link template files
2018-12-12 20:09:26 +00:00
mkdir -p "/etc/templates"
stow -t "/etc/templates" templates
2020-09-18 22:37:51 +00:00
man: # link system man pages
2018-12-12 20:09:26 +00:00
mkdir -p "/usr/share/man/man1"
stow -t "/usr/share/man/man1" man
2020-09-18 22:37:51 +00:00
completion: # add bash completions
2018-12-12 20:09:26 +00:00
mkdir -p "/etc/bash_completion.d"
stow -t "/etc/bash_completion.d" completion
2020-09-18 22:37:51 +00:00
files: # link miscellaneous files
2018-12-31 17:37:01 +00:00
mkdir -p "/usr/share/games/fortunes"
cd files && stow -t "/usr/share/games/fortunes" fortunes
2020-09-18 22:37:51 +00:00
efingerd: # install finger scripts
2019-01-01 19:44:04 +00:00
mkdir -p "/etc/efingerd"
stow -t "/etc/efingerd" efingerd
2018-12-31 17:54:26 +00:00
2020-09-18 22:37:51 +00:00
updatemotd: # link motd files
2019-01-11 20:16:58 +00:00
mkdir -p "/etc/update-motd.d"
stow -t "/etc/update-motd.d" update-motd
sudo chown -R root /etc/update-motd.d
2020-09-18 22:37:51 +00:00
menu: # install the system interactive menu
2019-01-01 19:50:10 +00:00
stow -t "/etc" menu
2020-09-18 22:37:51 +00:00
postfix: # set up postfix for tilde-only email
if ! grep -q 'transport_maps' "/etc/postfix/main.cf"; then \
2020-09-18 20:22:40 +00:00
printf "transport_maps = hash:/etc/postfix/transport\n" >> "/etc/postfix/main.cf"; \
printf "smtpd_recipient_restrictions = check_sender_access hash:/etc/postfix/access, reject" >> "/etc/postfix/main.cf"; \
fi
2019-01-02 19:45:27 +00:00
stow -t "/etc/postfix" postfix
sudo chown root /etc/postfix/transport
sudo chown root /etc/postfix/access
2019-01-02 19:45:27 +00:00
postmap /etc/postfix/transport
postmap /etc/postfix/access
2019-01-02 19:45:27 +00:00
postfix reload
2020-09-18 22:37:51 +00:00
uninstall: # uninstall everything we've installed from this repo
2018-12-12 20:15:48 +00:00
stow -t "/usr/local/bin" -D bin
stow -t "/etc/templates" -D templates
stow -t "/usr/share/man/man1/" -D man
stow -t "/etc/bash_completion.d" -D completion
2019-01-01 19:44:04 +00:00
stow -t "/etc/efingerd" -D efingerd
2019-01-01 19:50:10 +00:00
stow -t "/etc" -D menu
2019-01-02 19:45:27 +00:00
stow -t "/etc/postfix" -D postfix
2019-01-15 00:36:36 +00:00
stow -t "/etc/update-motd.d" -D update-motd
stow -t "/etc" -D menu
2018-12-31 17:37:01 +00:00
cd files && stow -t "/usr/share/games/fortunes" -D fortunes
2018-12-12 20:15:48 +00:00