aboutsummaryrefslogblamecommitdiffstats
path: root/filesystem/Makefile
blob: bc3fd71601d0f35a4b4c8ecfb1ff057a0cfe26f7 (plain) (tree)
1
2
3
       
                    
 












                     




















































                                                                  





                                                                                                                        
































                                                   


                                                                                            

                         
.POSIX:
include ../common.mk

HIDE =\
	Templates\
	Desktop\
	Public\
	Documents\
	Downloads\
	Music\
	Pictures\
	Videos\
	public_html\
	password.gpg\
	mnt

install:
	mkdir -p -- ~/.config
	mkdir -p -- ~/.var/cache/.thumbnails
	rm -rf -- ~/.config/.cache
	rm -rf -- ~/.cache
	rm -rf -- ~/.thumbnails
	ln -sf -- ../.cache ~/.config/.cache
	ln -sf -- .var/cache ~/.cache
	ln -sf -- .cache/.thumbnails ~/.thumbnails
	mkdir -p -- ~/.var/games
	mkdir -p -- ~/.var/lib
	mkdir -p -- ~/.var/mail
	mkdir -p -- ~/.var/spool
	rm -f -- ~/.spool
	rm -f -- ~/.local/var
	ln -sf .var/spool/ ~/.spool
	ln -sf ../.var ~/.local/var
	mkdir -p -- ~/.local/bin
	mkdir -p -- ~/.local/src
	if test -d ~/.fonts && test ! -L ~/.fonts; then \
		mkdir -p -- ~/.local/share && \
		test ! -e ~/.local/share/fonts && \
		mv ~/.fonts ~/.local/share/fonts; \
	else \
		mkdir -p -- ~/.local/share/fonts && \
		rm -f -- ~/.fonts && \
		ln -sf -- .local/share/fonts ~/.fonts; \
	fi
	if test -d ~/.icons && test ! -L ~/.icons; then \
		mkdir -p -- ~/.local/share && \
		test ! -e ~/.local/share/icons && \
		mv ~/.icons ~/.local/share/icons; \
	else \
		mkdir -p -- ~/.local/share/icons && \
		rm -f -- ~/.icons && \
		ln -sf -- .local/share/icons ~/.icons; \
	fi
	if test -d ~/.themes && test ! -L ~/.themes; then \
		mkdir -p -- ~/.local/share && \
		test ! -e ~/.local/share/themes && \
		mv ~/.themes ~/.local/share/themes; \
	else \
		mkdir -p -- ~/.local/share/themes && \
		rm -f -- ~/.themes && \
		ln -sf -- .local/share/themes ~/.themes; \
	fi
	mkdir -p -- ~/.usr/bin
	mkdir -p -- ~/.usr/include
	mkdir -p -- ~/.usr/lib
	mkdir -p -- ~/.usr/libexec
	mkdir -p -- ~/.usr/share/man
	mkdir -p -- ~/.usr/src
	ln -sf -- ~/.dotfiles/filesystem/user-dirs.dirs ~/.config/
	set -e && for f in $(HIDE); do \
		test -e ~/.hidden && grep '^'"$$f"'$' < ~/.hidden || printf '%s\n' "$$f" >> ~/.hidden; \
	done
	if test "$$(hostname | tr '[[:upper:]]' '[[:lower:]]')" = zenith; then \
		test -e ~/.hidden && grep '^cryptokey.gpg$' < ~/.hidden || printf '%s\n' "cryptokey.gpg" >> ~/.hidden; \
	fi

uninstall:
	-unlink -- ../.cache ~/.config/.cache
	-unlink -- .var/cache ~/.cache
	-unlink -- .cache/.thumbnails ~/.thumbnails
	-unlink -- .var/spool/ ~/.spool
	-unlink -- ../.var ~/.local/var
	-unlink -- .local/share/fonts ~/.fonts
	-unlink -- .local/share/icons ~/.icons
	-unlink -- .local/share/themes ~/.themes
	-rmdir -- ~/.config
	-rmdir -- ~/.var/cache/.thumbnails
	-rmdir -- ~/.var/cache
	-rmdir -- ~/.var/games
	-rmdir -- ~/.var/lib
	-rmdir -- ~/.var/mail
	-rmdir -- ~/.var/spool
	-rmdir -- ~/.var
	-rmdir -- ~/.local/bin
	-rmdir -- ~/.local/src
	-rmdir -- ~/.local/share/fonts
	-rmdir -- ~/.local/share/icons
	-rmdir -- ~/.local/share/themes
	-rmdir -- ~/.local/share
	-rmdir -- ~/.local
	-rmdir -- ~/.usr/bin
	-rmdir -- ~/.usr/include
	-rmdir -- ~/.usr/lib
	-rmdir -- ~/.usr/libexec
	-rmdir -- ~/.usr/share/man
	-rmdir -- ~/.usr/share
	-rmdir -- ~/.usr/src
	-rmdir -- ~/.usr
	-for f in $(HIDE) cryptokey.gpg; do \
		test ! -e ~/.hidden || grep -v '^'"$$f"'$' < ~/.hidden | sponge ~/.hidden; \
	done

.PHONY: install uninstall