cbdowell
1/19/2020 - 1:50 PM

makefile using stow...

makefile using stow...



.DEFAULT_GOAL := install
USER=cbdowell

install: stow

update:
	# fully update git repository
	# git pull
	# git submodule update --init --recursive
	# git submodule update --remote

hosts:
	# move block ips to host file
	# sed -i '/^# Hosts contributed by Steven Black$$/,$$d' /etc/hosts
	# cat etc/blockips >> /etc/hosts

sudo:
	# copy and start custom sudoers privs
	# cp etc/sudoers.d/* /etc/sudoers.d/

systemd:
	# copy and start custom systemd services
	# cp etc/systemd/system/* /etc/systemd/system/
	# systemctl enable wakelock.service
	# systemctl enable powertop.service
	# systemctl start wakelock.service
	# systemctl start powertop.service

root-config: hosts sudo systemd
	@ echo "root-config called..."

stow: configs root-config stow-post

configs: update stow-pre
	# stow personal configs
	sudo -u $(USER) stow -Rvt ~/ \
		base \
		editing \
		desktop \
		browsing \
		editing \
		gui \
		terminals

stow-pre:
	@ mkdir -p ~/.{themes,icons,fonts}
	@ mkdir -p ~/.config/wpg/templates
	@ wpg-install.sh -ig
	# remove configs that will already exist
	-[ -L /home/$(USER)/.bashrc ] && mv /home/$(USER)/.bashrc /home/$(USER)/.bashrc.bak
	-[ -L /home/$(USER)/.config/cava ] && mv /home/$(USER)/.config/cava /home/$(USER)/.config/cava.bak
	-[ -L /home/$(USER)/.config/wpg ] && mv /home/$(USER)/.config/wpg /home/$(USER)/.config/wpg.bak
	# create folder that might not be created yet for configs
	sudo -u $(USER) mkdir -p /home/$(USER)/.local/share/applications /home/$(USER)/.config/wpg /home/$(USER)/.config/systemd/user/default.target.wants

stow-post:
	@ echo "stow-pre called..."
	# shortcuts initialization
	# sudo -u $(USER) /home/$(USER)/.config/Scripts/shortcuts.sh
	# neovim vim-plug initialization
	# sudo -u $(USER) nvim +'PlugInstall --sync' +qa
	# set wallpaper and run wpgtk
	# sudo -u $(USER) cp /home/$(USER)/Pictures/wallpapers/$(WALLPAPER) /home/$(USER)/.config/wall
	sudo -u $(USER) wpg -s wallpaper.jpg

unstow:
	@ stow -Dvt ~/ \
		common