confOS/Makefile

196 lines
5.5 KiB
Makefile
Raw Normal View History

2023-03-19 19:17:26 +01:00
# Version control
2023-03-26 17:55:06 +02:00
VC = git
2023-03-19 19:45:57 +01:00
2023-03-19 20:10:19 +01:00
# Util
2023-03-26 17:55:06 +02:00
RM = rm -f
2023-03-19 20:10:19 +01:00
2023-03-19 19:45:57 +01:00
# Downloaders
2023-03-26 17:57:52 +02:00
REPO_SRC = https://git.mylloon.fr/Anri/confOS/raw/branch/main
WGET = wget -q --show-progress
CURL = curl -s
2023-03-19 19:17:26 +01:00
2023-03-19 19:56:45 +01:00
# Checkers
2023-03-26 17:55:06 +02:00
ARCH = $(shell grep -c "archlinux" /proc/version)
WSL = $(shell grep -c "WSL2" /proc/version)
2023-03-19 19:56:45 +01:00
2023-03-19 19:05:07 +01:00
# Hide some verbose messages from Make
MAKEFLAGS += --no-print-directory
2023-03-26 17:26:30 +02:00
# Location
2023-03-26 17:55:06 +02:00
WIN_USER = anri
PFx86 = /mnt/c/Program\ Files\ \(x86\)
WIN_HOME = /mnt/c/Users/$(WIN_USER)
APPDATA = $(WIN_HOME)/AppData/Roaming
WIN_STEAM_USERDATA = $(filter-out "userdata",$(shell find $(PFx86)/Steam/userdata -maxdepth 1 -type d -printf "\"%f\" "))
2023-09-28 11:56:51 +02:00
CS2_CFG = $(PFx86)/Steam/steamapps/common/Counter-Strike\ Global\ Offensive/game/csgo/cfg
2023-03-26 17:26:30 +02:00
2023-03-19 19:18:19 +01:00
all: full-sync
2023-03-19 19:05:07 +01:00
2023-03-26 18:03:15 +02:00
2023-03-19 19:19:14 +01:00
# Pull latest changes
2023-03-19 19:17:26 +01:00
refresh:
2023-03-26 17:47:58 +02:00
@echo "Pull latest changes from repository..."
2023-03-19 19:17:26 +01:00
@$(VC) pull
2023-03-19 19:45:57 +01:00
@echo
2023-03-19 19:17:26 +01:00
2023-03-26 18:03:15 +02:00
2023-03-19 19:19:14 +01:00
# Pull and sync
2023-03-19 19:18:19 +01:00
full-sync:
@$(MAKE) refresh
@$(MAKE) sync
2023-03-19 19:56:45 +01:00
2023-03-19 19:19:14 +01:00
# .config
2023-03-19 19:05:07 +01:00
sync-dotconfig:
2023-03-19 19:45:57 +01:00
# Fish
2023-03-19 19:05:07 +01:00
@mkdir -p $(HOME)/.config/fish/conf.d
@mkdir -p $(HOME)/.config/fish/functions
2023-03-26 17:57:52 +02:00
@$(WGET) $(REPO_SRC)/.config/fish/functions/fish_prompt.fish -O $(HOME)/.config/fish/functions/fish_prompt.fish
2023-10-08 16:34:00 +02:00
@$(WGET) $(REPO_SRC)/.config/fish/functions/makeaway.fish -O $(HOME)/.config/fish/functions/makeaway.fish
2023-10-08 19:41:13 +02:00
@$(WGET) $(REPO_SRC)/.config/fish/functions/ssh-export.fish -O $(HOME)/.config/fish/functions/ssh-export.fish
2023-10-08 20:52:42 +02:00
@$(WGET) $(REPO_SRC)/.config/fish/functions/ssh-import.fish -O $(HOME)/.config/fish/functions/ssh-import.fish
2023-03-19 19:45:57 +01:00
2023-03-26 17:57:52 +02:00
@$(WGET) $(REPO_SRC)/.config/fish/conf.d/abbr.fish -O $(HOME)/.config/fish/conf.d/abbr.fish
@$(WGET) $(REPO_SRC)/.config/fish/conf.d/alias.fish -O $(HOME)/.config/fish/conf.d/alias.fish
2023-03-19 19:45:57 +01:00
# Micro
2023-03-26 17:57:52 +02:00
@$(WGET) $(REPO_SRC)/.config/micro/settings.json -O $(HOME)/.config/micro/settings.json
2023-03-19 19:45:57 +01:00
# END
2023-03-26 17:47:58 +02:00
@echo ".config directory synced!"
2023-03-19 19:45:57 +01:00
@echo
2023-03-19 19:05:07 +01:00
2023-03-26 18:03:15 +02:00
2023-03-19 19:19:14 +01:00
# .emacs.d
2023-03-19 19:05:07 +01:00
sync-emacs:
2023-03-19 19:45:57 +01:00
@mkdir -p $(HOME)/.emacs.d
2023-03-26 17:57:52 +02:00
@$(WGET) $(REPO_SRC)/.emacs.d/init.el -O $(HOME)/.emacs.d/init.el
2023-03-19 19:45:57 +01:00
# END
2023-03-26 17:47:58 +02:00
@echo "Emacs config synced!"
2023-03-19 19:45:57 +01:00
@echo
2023-03-19 19:05:07 +01:00
2023-03-26 18:03:15 +02:00
2023-03-19 19:45:57 +01:00
# .dotfiles
sync-dotfiles:
# .gitconfig
2023-03-26 17:57:52 +02:00
@$(WGET) $(REPO_SRC)/dotfiles/.gitconfig -O $(HOME)/.gitconfig
2023-03-19 19:05:07 +01:00
2023-03-19 19:45:57 +01:00
# .ocamlformat
2023-03-26 17:57:52 +02:00
@$(WGET) $(REPO_SRC)/dotfiles/.ocamlformat -O $(HOME)/.ocamlformat
2023-03-19 19:05:07 +01:00
2023-03-19 19:45:57 +01:00
# .clang-format
2023-03-26 17:57:52 +02:00
@$(WGET) $(REPO_SRC)/dotfiles/.clang-format -O $(HOME)/.clang-format
2023-03-19 19:45:57 +01:00
# End
2023-03-26 17:47:58 +02:00
@echo "dotfiles synced!"
2023-03-19 19:45:57 +01:00
@echo
2023-03-19 19:05:07 +01:00
2023-03-19 19:56:45 +01:00
2023-03-26 18:03:15 +02:00
# Arch distro specific
2023-03-26 17:55:06 +02:00
sync-arch:
# .config
@$(WGET) $(REPO_SRC)/.config/update_theme.sh -O $(HOME)/.config/update_theme.sh
2023-03-19 19:56:45 +01:00
# Fish
2023-03-26 17:57:52 +02:00
@$(WGET) $(REPO_SRC)/.config/fish/config_arch.fish -O $(HOME)/.config/fish/config.fish
@$(WGET) $(REPO_SRC)/.config/fish/conf.d/abbr.fish -O $(HOME)/.config/fish/conf.d/abbr.fish
@$(CURL) $(REPO_SRC)/.config/fish/conf.d/abbr_arch.fish >> $(HOME)/.config/fish/conf.d/abbr.fish
2023-03-19 20:00:36 +01:00
# Emoji Picker
2023-03-26 17:57:52 +02:00
@$(WGET) $(REPO_SRC)/.config/gazatu.xyz/emoji-picker.ini -O $(HOME)/.config/gazatu.xyz/emoji-picker.ini
2023-03-19 20:00:36 +01:00
# Firefox
2023-03-19 20:10:19 +01:00
-@$(RM) $(HOME)/.mozilla/firefox/*.default-release/user.js
2023-03-26 17:57:52 +02:00
@$(WGET) $(REPO_SRC)/.mozilla/firefox/user.js -P $(HOME)/.mozilla/firefox/*.default-release
2023-05-01 14:28:36 +02:00
@$(CURL) $(REPO_SRC)/.mozilla/firefox/user-arch.js >> $(wildcard $(HOME)/.mozilla/firefox/*.default-release)/user.js
2023-03-19 19:56:45 +01:00
2023-03-19 20:00:36 +01:00
# VSCodium
2023-03-26 17:57:52 +02:00
@$(WGET) $(REPO_SRC)/.config/VSCodium/product.json -O $(HOME)/.config/VSCodium/product.json
2023-03-19 19:56:45 +01:00
2023-05-01 13:55:08 +02:00
# Pacman hooks
2023-05-01 14:00:24 +02:00
@sudo mkdir -p /etc/pacman.d/hooks
@sudo $(WGET) $(REPO_SRC)/pacman.d/hooks/stop-wine-associations.hook -P /etc/pacman.d/hooks/stop-wine-associations.hook
2023-05-01 13:55:08 +02:00
2023-03-26 18:03:15 +02:00
# Windows Subsystem for Linux specific
2023-03-26 17:55:06 +02:00
sync-wsl:
2023-03-19 19:56:45 +01:00
# Fish
2023-03-26 17:57:52 +02:00
@$(WGET) $(REPO_SRC)/.config/fish/config_wsl.fish -O $(HOME)/.config/fish/config.fish
@$(CURL) $(REPO_SRC)/.config/fish/conf.d/abbr_wsl.fish >> $(HOME)/.config/fish/conf.d/abbr.fish
2023-09-07 19:01:09 +02:00
@$(CURL) $(REPO_SRC)/.config/fish/conf.d/alias_wsl.fish >> $(HOME)/.config/fish/conf.d/alias.fish
2023-03-19 19:56:45 +01:00
# Unison
@mkdir -p $(HOME)/.unison
2023-03-26 17:57:52 +02:00
@$(WGET) $(REPO_SRC)/.unison/default.prf -O $(HOME)/.unison/default.prf
2023-03-26 17:26:30 +02:00
2023-03-26 18:03:15 +02:00
2023-03-26 17:55:42 +02:00
# Windows through WSL
2023-03-26 17:55:06 +02:00
sync-windows:
2023-03-26 17:47:58 +02:00
# Scripts
@$(WGET) $(REPO_SRC)/windows/blockthespot.bat -O $(WIN_HOME)/Documents/Local/blockthespot.bat
2023-09-13 12:05:44 +02:00
@$(WGET) $(REPO_SRC)/windows/ctmpf.bat -O $(WIN_HOME)/Documents/Local/ctmpf.bat
2023-03-26 17:57:52 +02:00
@$(WGET) $(REPO_SRC)/windows/update.bat -O $(WIN_HOME)/Documents/Local/update.bat
@$(WGET) $(REPO_SRC)/windows/fix_nvidia_wsl.bat -O $(WIN_HOME)/Documents/Local/fix_nvidia_wsl.bat
2023-09-13 12:05:44 +02:00
@$(WGET) $(REPO_SRC)/windows/vencord_installer.bat -O $(WIN_HOME)/Documents/Local/vencord_installer.bat
2023-03-26 17:47:58 +02:00
@echo "(Windows) Scripts synced!"
@echo
2023-09-28 11:56:51 +02:00
# CS2 (only if installed)
@if [ -d $(CS2_CFG) ]; then \
$(WGET) $(REPO_SRC)/games/cs2/autoexec.cfg -O $(CS2_CFG)/autoexec.cfg; \
$(WGET) $(REPO_SRC)/games/cs2/myconfig.cfg -O $(CS2_CFG)/myconfig.cfg; \
$(WGET) $(REPO_SRC)/games/cs2/customgame.cfg -O $(CS2_CFG)/customgame.cfg; \
2023-03-26 17:47:58 +02:00
echo "(Windows) CS:GO synced!"; \
echo; \
2023-03-26 17:26:30 +02:00
fi
2023-03-26 17:47:58 +02:00
# Firefox
2023-03-26 17:57:52 +02:00
@$(WGET) $(REPO_SRC)/.mozilla/firefox/user.js -O $(APPDATA)/Mozilla/Firefox/Profiles/*.default-release/user.js
2023-03-26 17:47:58 +02:00
@echo "(Windows) Firefox synced!"
@echo
2023-08-18 03:32:06 +02:00
# WindowsAutoNightMode
@$(WGET) $(REPO_SRC)/.config/WindowsAutoNightMode/config.yaml -O $(APPDATA)/AutoDarkMode/config.yaml
@echo "(Windows) WindowsAutoNightMode synced!"
@echo
2023-03-26 18:03:15 +02:00
2023-03-26 17:55:06 +02:00
sync:
# Check if at least the platform is supported
ifneq (1, $(filter 1, $(ARCH) $(WSL)))
@echo "Unsupported platform"
else
# Call target of compatible with all supported platforms
@$(MAKE) sync-dotconfig
@$(MAKE) sync-dotfiles
@$(MAKE) sync-emacs
# Specific to Arch
ifeq ($(ARCH), 1)
@$(MAKE) sync-arch
@echo "Arch synced!"
@echo
# Specific to WSL
else ifeq ($(WSL), 1)
@$(MAKE) sync-wsl
@echo "WSL synced!"
@echo
# Windows
@$(MAKE) sync-windows
2023-03-26 17:47:58 +02:00
@echo "Windows synced!"
@echo
2023-03-19 19:05:07 +01:00
endif
2023-03-19 19:45:57 +01:00
# END
2023-03-26 17:47:58 +02:00
@echo "🎉 Sync complete!"
2023-03-19 19:56:45 +01:00
endif