From d058d58bc2ffc02a5d7c3e3364e0769e9fd4a5df Mon Sep 17 00:00:00 2001 From: Mathieu Maret Date: Sun, 30 May 2021 00:14:47 +0200 Subject: [PATCH] Add a Makefile for installation --- Makefile | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 Makefile diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..5293d68 --- /dev/null +++ b/Makefile @@ -0,0 +1,47 @@ +MSG=@ +IGNORE_DOT_FILES=. .. .git .gitmodules .gitignore +DOT_FILES=$(filter-out $(IGNORE_DOT_FILES), $(wildcard .*)) +DOT_INSTALLED=$(foreach dot, $(DOT_FILES), $(HOME)/$(dot)) +ROOT_DIR:=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST)))) + +PKG_ARCH_BASE=aspell-en aspell-fr conky cscope ctags dunst eog firefox noto-fonts-emoji fzf git gmrun gnome-terminal gvim hunspell-fr hyphen-en hyphen-fr lightdm numlockx openssh polkit-gnome python3 sudo tint2 tmux unrar unzip udevil zsh +PKG_ARCH_DEV=autopep8 bear cppcheck clang flake8 gcc hstr shellcheck strace + +ifeq ($(USER), root) +$(info Should not be run as root) +$(info Put youself in wheel group and add \"%wheel ALL=(ALL) NOPASSWD: ALL\" to /etc/sudoers) +$(error Should not be run as root) +endif + +all:$(DOT_INSTALLED) + git submodule update --init + +arch_all:$(DOT_INSTALLED) arch_install_base arch_install_dev udevil_install + git submodule update --init + +$(HOME)/%: $(ROOT_DIR)/% + $(MSG)echo "installing $@" + $(MSG)ln -s $< $@ + +/usr/bin/yay: + sudo pacman -Sy --needed git base-devel + git clone https://aur.archlinux.org/yay.git + cd yay && makepkg -s -i + rm -rf yay + +arch_install_base: /usr/bin/yay + $(info going to install $(PKG_ARCH_BASE)) + yay -Sy --needed $(PKG_ARCH_BASE) + +arch_install_dev: /usr/bin/yay + $(info going to install $(PKG_ARCH_DEV)) + yay -Sy --needed $(PKG_ARCH_DEV) + + +udevil_install: arch_install_base +ifneq (,$(wildcard /etc/systemd/system/multi-user.target.wants/devmon@$(USER).service)) + $(MSG)echo "udevil already installed" +else + sudo systemctl enable devmon@$(USER) + sudo systemctl start devmon@$(USER) +endif