confOS/Makefile

338 lines
11 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
2024-04-03 08:39:48 +02:00
RM = rm -f
MKDIR = mkdir -p
2024-04-03 08:40:48 +02:00
SED = sed -i
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:05:07 +01:00
# Hide some verbose messages from Make
MAKEFLAGS += --no-print-directory
2023-03-26 17:26:30 +02:00
# Location
2024-10-02 20:27:22 +02:00
WIN_USER = anri
PFx86 = /mnt/c/Program\ Files\ \(x86\)
PF = /mnt/c/Program\ Files
WIN_HOME = /mnt/c/Users/$(WIN_USER)
APPDATA = $(WIN_HOME)/AppData/Roaming
LOCALAPPDATA = $(WIN_HOME)/AppData/Local
# Locations aliases
CS2_CFG = $(PFx86)/Steam/steamapps/common/Counter-Strike\ Global\ Offensive/game/csgo/cfg
OBS_CFG = $(PF)/obs-studio/config/obs-studio
2024-10-02 20:26:12 +02:00
2023-03-26 17:26:30 +02:00
2024-10-02 20:22:09 +02:00
# Checkers
ARCH = $(shell grep -c "archlinux" /proc/version 2> /dev/null)
WSL = $(shell grep -c "WSL2" /proc/version 2> /dev/null)
TERMUX = $(firstword $(shell type termux-info &> /dev/null && echo 1))
ADMIN_WIN = $(shell touch $(PF) 2> /dev/null; echo $$?)
2024-11-06 08:54:15 +01:00
FORCE := 0
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:
2024-11-06 08:54:15 +01:00
# check if last update < with last commit ID or if FORCE is 1
# store update : commit id in ignored file
2023-03-19 19:18:19 +01:00
@$(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
2024-04-03 08:39:48 +02:00
@$(MKDIR) $(HOME)/.config/fish/conf.d
@$(MKDIR) $(HOME)/.config/fish/functions
2023-03-19 19:05:07 +01:00
2023-11-06 00:26:14 +01:00
@$(WGET) $(REPO_SRC)/.config/fish/config.fish -O $(HOME)/.config/fish/config.fish
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
@$(WGET) $(REPO_SRC)/.config/fish/functions/catall.fish -O $(HOME)/.config/fish/functions/catall.fish
2024-10-06 18:07:45 +02:00
@$(WGET) $(REPO_SRC)/.config/fish/functions/latex-color.fish -O $(HOME)/.config/fish/functions/latex-color.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-10-09 17:56:56 +02:00
@$(WGET) $(REPO_SRC)/.config/fish/functions/ugc.fish -O $(HOME)/.config/fish/functions/ugc.fish
@$(WGET) $(REPO_SRC)/.config/fish/functions/update-theme.fish -O $(HOME)/.config/fish/functions/update-theme.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-11-05 15:16:55 +01:00
@echo "Fish global settings synced!"
@echo
2023-03-19 19:45:57 +01:00
# Micro
2024-04-03 08:48:08 +02:00
@$(MKDIR) $(HOME)/.config/micro
2023-03-26 17:57:52 +02:00
@$(WGET) $(REPO_SRC)/.config/micro/settings.json -O $(HOME)/.config/micro/settings.json
2023-11-05 15:16:55 +01:00
@echo "Micro settings synced!"
2023-03-19 19:45:57 +01:00
@echo
2023-03-19 19:05:07 +01:00
2023-11-23 17:17:49 +01:00
# Bat
2024-04-03 08:39:48 +02:00
@$(MKDIR) $(HOME)/.config/bat
2023-11-23 17:17:49 +01:00
@$(WGET) $(REPO_SRC)/.config/bat/config -O $(HOME)/.config/bat/config
@echo "Bat settings synced!"
@echo
2023-11-07 02:55:24 +01:00
# Topgrade
@$(WGET) $(REPO_SRC)/.config/topgrade/topgrade.toml -O $(HOME)/.config/topgrade.toml
@echo "Topgrade settings synced!"
@echo
2023-03-26 18:03:15 +02:00
2023-11-05 16:57:53 +01:00
# # .emacs.d
# sync-emacs:
2024-04-03 08:39:48 +02:00
# @$(MKDIR) $(HOME)/.emacs.d
2023-11-05 16:57:53 +01:00
#
# @$(WGET) $(REPO_SRC)/.emacs.d/init.el -O $(HOME)/.emacs.d/init.el
2023-03-19 19:45:57 +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-11-05 15:16:55 +01:00
@echo "Git settings synced!"
@echo
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-11-05 15:16:55 +01:00
@echo "OCaml formatter settings synced!"
@echo
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-11-05 15:16:55 +01:00
@echo "Clang formatter settings 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-11-05 15:16:55 +01:00
@echo "Theme script synced!"
@echo
2023-03-19 19:56:45 +01:00
# Fish
2023-03-26 17:57:52 +02:00
@$(CURL) $(REPO_SRC)/.config/fish/conf.d/abbr_arch.fish >> $(HOME)/.config/fish/conf.d/abbr.fish
2023-11-07 15:36:30 +01:00
@$(CURL) $(REPO_SRC)/.config/fish/conf.d/alias_arch.fish >> $(HOME)/.config/fish/conf.d/alias.fish
2023-11-05 15:16:55 +01:00
@echo "Fish specific settings synced!"
@echo
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-11-05 15:16:55 +01:00
@echo "Emoji picker settings synced!"
@echo
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-11-05 15:16:55 +01:00
@echo "Firefox settings synced!"
@echo
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-11-05 15:16:55 +01:00
@echo "VSCodium settings synced!"
@echo
2023-03-19 19:56:45 +01:00
2024-01-29 09:54:54 +01:00
# s-tui
@$(WGET) $(REPO_SRC)/.config/s-tui/s-tui.conf -O $(HOME)/.config/s-tui/s-tui.conf
@echo "s-tui settings synced!"
@echo
2024-02-28 10:35:09 +01:00
# gpu-screen-recorder
@$(WGET) $(REPO_SRC)/.config/gpu-screen-recorder.env -O $(HOME)/.config/gpu-screen-recorder.env
2024-03-07 17:05:34 +01:00
@echo "ADDITIONAL_ARGS=-a $$(pactl get-default-source)" >> $(HOME)/.config/gpu-screen-recorder.env
2024-02-28 10:35:09 +01:00
@echo "gpu-screen-recorder settings synced!"
@echo
2024-03-26 09:30:41 +01:00
# Blackbox
@$(WGET) $(REPO_SRC)/.local/share/blackbox/user-keymap.json -O $(HOME)/.local/share/blackbox/user-keymap.json
@echo "Blackbox keymap synced!"
@echo
2023-05-01 13:55:08 +02:00
# Pacman hooks
2024-04-03 08:39:48 +02:00
@sudo $(MKDIR) /etc/pacman.d/hooks
2024-05-20 22:12:00 +02:00
@sudo $(WGET) $(REPO_SRC)/pacman.d/hooks/stop-wine-associations.hook -O /etc/pacman.d/hooks/stop-wine-associations.hook
@sudo $(WGET) $(REPO_SRC)/pacman.d/hooks/gnome-terminal-shortcut.hook -O /etc/pacman.d/hooks/gnome-terminal-shortcut.hook
@sudo $(WGET) $(REPO_SRC)/pacman.d/hooks/blackbox-shortcut.hook -O /etc/pacman.d/hooks/blackbox-shortcut.hook
2024-05-22 09:59:28 +02:00
@sudo $(WGET) $(REPO_SRC)/pacman.d/hooks/honkai-shortcut.hook -O /etc/pacman.d/hooks/honkai-shortcut.hook
2024-06-21 21:43:14 +02:00
@sudo $(WGET) $(REPO_SRC)/pacman.d/hooks/vesktop.hook -O /etc/pacman.d/hooks/vesktop.hook
2023-11-05 15:16:55 +01:00
@echo "Pacman hooks synced!"
@echo
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-11-06 00:26:14 +01:00
@$(CURL) $(REPO_SRC)/.config/fish/config_wsl.fish >> $(HOME)/.config/fish/config.fish
2023-03-26 17:57:52 +02:00
@$(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
2024-11-04 17:18:22 +01:00
@$(WGET) $(REPO_SRC)/.config/fish/functions/trash.fish -O $(HOME)/.config/fish/functions/trash.fish
2024-11-04 17:22:51 +01:00
@$(WGET) $(REPO_SRC)/.config/fish/functions/trash-empty.fish -O $(HOME)/.config/fish/functions/trash-empty.fish
2023-11-05 15:16:55 +01:00
@echo "Fish specific settings synced!"
@echo
2023-03-19 19:56:45 +01:00
# Unison
2024-04-03 08:39:48 +02:00
@$(MKDIR) $(HOME)/.unison
2023-03-26 17:57:52 +02:00
@$(WGET) $(REPO_SRC)/.unison/default.prf -O $(HOME)/.unison/default.prf
2023-11-05 15:16:55 +01:00
@echo "Unison settings synced!"
@echo
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-11-05 15:20:37 +01:00
WIN = (Windows) # specific prefix since we're running it from WSL for windows
2023-03-26 17:55:06 +02:00
sync-windows:
2023-03-26 17:47:58 +02:00
# Scripts
2023-03-26 17:57:52 +02:00
@$(WGET) $(REPO_SRC)/windows/update.bat -O $(WIN_HOME)/Documents/Local/update.bat
2024-07-02 11:09:22 +02:00
@$(WGET) $(REPO_SRC)/windows/clean.bat -O $(WIN_HOME)/Documents/Local/ctmpf.bat
@$(WGET) $(REPO_SRC)/windows/installers/spotify.bat -O $(WIN_HOME)/Documents/Local/blockthespot.bat
@$(WGET) $(REPO_SRC)/windows/installers/vencord.bat -O $(WIN_HOME)/Documents/Local/vencord_installer.bat
2023-03-26 17:57:52 +02:00
@$(WGET) $(REPO_SRC)/windows/fix_nvidia_wsl.bat -O $(WIN_HOME)/Documents/Local/fix_nvidia_wsl.bat
2024-04-18 01:18:07 +02:00
@$(WGET) $(REPO_SRC)/windows/fix_mihoyo_shortcut.bat -O $(WIN_HOME)/Documents/Local/fix_mihoyo_shortcut.bat
@$(WGET) $(REPO_SRC)/windows/start_obs_as_shadowplay.bat -O $(LOCALAPPDATA)/start_obs_as_shadowplay.bat
2023-10-31 11:52:16 +01:00
@echo "$(WIN) Scripts synced!"
2023-03-26 17:47:58 +02:00
@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; \
2024-08-06 19:45:29 +02:00
$(WGET) $(REPO_SRC)/games/cs2/normalgame.cfg -O $(CS2_CFG)/normalgame.cfg; \
2024-08-20 17:41:42 +02:00
echo "$(WIN) CS2 configs synced!"; \
2023-03-26 17:47:58 +02:00
echo; \
2023-03-26 17:26:30 +02:00
fi
2024-10-02 20:22:09 +02:00
2023-03-26 17:47:58 +02:00
# Firefox
-@$(RM) $(APPDATA)/Mozilla/Firefox/Profiles/*.default-release/user.js
@$(WGET) $(REPO_SRC)/.mozilla/firefox/user.js -P $(APPDATA)/Mozilla/Firefox/Profiles/*.default-release
2023-10-30 14:46:36 +01:00
@$(CURL) $(REPO_SRC)/.mozilla/firefox/user-windows.js >> $(wildcard $(APPDATA)/Mozilla/Firefox/Profiles/*.default-release)/user.js
2023-11-05 15:16:55 +01:00
@echo "$(WIN) Firefox settings synced!"
2023-03-26 17:47:58 +02:00
@echo
2023-08-18 03:32:06 +02:00
# WindowsAutoNightMode
@$(WGET) $(REPO_SRC)/.config/WindowsAutoNightMode/config.yaml -O $(APPDATA)/AutoDarkMode/config.yaml
2023-11-06 13:25:51 +01:00
@$(WGET) $(REPO_SRC)/.config/WindowsAutoNightMode/scripts.yaml -O $(APPDATA)/AutoDarkMode/scripts.yaml
2023-11-05 15:16:55 +01:00
@echo "$(WIN) WindowsAutoNightMode settings synced!"
2023-08-18 03:32:06 +02:00
@echo
2023-10-31 11:50:39 +01:00
# Xournal++
2024-04-03 08:39:48 +02:00
@$(MKDIR) $(LOCALAPPDATA)/xournalpp
2023-10-31 11:50:39 +01:00
@$(WGET) $(REPO_SRC)/.config/xournalpp/settings.xml -O $(LOCALAPPDATA)/xournalpp/settings.xml
2023-11-05 15:16:55 +01:00
@echo "$(WIN) Xournal++ settings synced!"
2023-10-31 11:50:39 +01:00
@echo
2023-11-11 19:42:31 +01:00
# OpenTabletDriver presets
2024-04-03 08:39:48 +02:00
@$(MKDIR) $(LOCALAPPDATA)/OpenTabletDriver/Presets
2023-11-11 19:42:31 +01:00
@$(WGET) $(REPO_SRC)/opentabletdriver/vertical-main.json -O $(LOCALAPPDATA)/OpenTabletDriver/Presets/vertical-main.json
@$(WGET) $(REPO_SRC)/opentabletdriver/vertical-second.json -O $(LOCALAPPDATA)/OpenTabletDriver/Presets/vertical-second.json
@echo "$(WIN) OpenTabletDriver presets synced!"
@echo
2023-11-05 15:08:40 +01:00
# # Topgrade
# @$(WGET) $(REPO_SRC)/.config/topgrade/topgrade.toml -O $(APPDATA)/topgrade.toml
2023-11-05 15:16:55 +01:00
# @echo "$(WIN) Topgrade settings synced!"
2023-11-05 15:08:40 +01:00
# @echo
2023-11-05 14:48:22 +01:00
2024-08-20 18:50:09 +02:00
# OBS config
2024-10-02 20:22:09 +02:00
ifeq ($(ADMIN_WIN),1)
2024-08-20 18:50:09 +02:00
@echo "$(WIN) Can't update OBS configuration, use elevated terminal to do so"
2024-10-02 20:22:09 +02:00
@echo
2024-08-20 18:50:09 +02:00
else
2024-10-02 20:24:50 +02:00
@$(MKDIR) $(OBS_CFG)/basic/profiles/ReplayBuffer
@$(MKDIR) $(OBS_CFG)/basic/scenes
@$(WGET) $(REPO_SRC)/.config/obs/global.ini -O $(OBS_CFG)/global.ini
@$(WGET) $(REPO_SRC)/.config/obs/basic/profiles/ReplayBuffer/basic.ini -O $(OBS_CFG)/basic/profiles/ReplayBuffer/basic.ini
@$(WGET) $(REPO_SRC)/.config/obs/basic/profiles/ReplayBuffer/recordEncoder.json -O $(OBS_CFG)/basic/profiles/ReplayBuffer/recordEncoder.json
@$(WGET) $(REPO_SRC)/.config/obs/basic/scenes/ReplayBuffer.json -O $(OBS_CFG)/basic/scenes/ReplayBuffer.json
2024-10-05 18:50:59 +02:00
@echo "$(WIN) OBS configuration synced! Check your OBS to see if the screen is correctly picked up (could have turned black due to the update)"
2024-10-02 20:23:34 +02:00
@echo
2024-08-20 18:50:09 +02:00
endif
2023-03-26 18:03:15 +02:00
2024-10-02 20:17:57 +02:00
# FanControl
2024-10-02 20:22:09 +02:00
ifeq ($(ADMIN_WIN),1)
@echo "$(WIN) Can't update FanControl configuration, use elevated terminal to do so"
@echo
else
2024-10-02 20:17:57 +02:00
@$(MKDIR) $(PFx86)/FanControl/Configurations/
@$(WGET) $(REPO_SRC)/.config/FanControl/userConfig.json -O $(PFx86)/FanControl/Configurations/userConfig.json
@echo "$(WIN) FanControl configuration synced!"
@echo
2024-10-02 20:22:09 +02:00
endif
2024-10-02 20:17:57 +02:00
2024-04-03 08:40:48 +02:00
# Termux distro specific
sync-termux:
@$(SED) "/fish_ssh_agent/d" $(HOME)/.config/fish/config.fish
2024-04-03 08:40:48 +02:00
@$(SED) "/topgrade/d" $(HOME)/.config/fish/conf.d/abbr.fish
@echo "Fix-for-Termux applied!"
@echo
2023-03-26 17:55:06 +02:00
sync:
# Check if at least the platform is supported
2024-04-03 08:40:48 +02:00
ifneq (1, $(filter 1, $(ARCH) $(WSL) $(TERMUX)))
2023-11-05 15:19:28 +01:00
@echo "❌ Unsupported platform"
2023-03-26 17:55:06 +02:00
else
# Call target of compatible with all supported platforms
@$(MAKE) sync-dotconfig
2023-11-05 15:19:28 +01:00
@echo "⌛ .config directory synced!"
2023-11-05 15:16:55 +01:00
@echo
2023-03-26 17:55:06 +02:00
@$(MAKE) sync-dotfiles
2023-11-05 15:19:28 +01:00
@echo "⌛ Dotfiles synced!"
2023-11-05 15:16:55 +01:00
@echo
2023-11-05 16:57:53 +01:00
# @$(MAKE) sync-emacs
# @echo "⌛ Emacs settings synced!"
# @echo
2023-03-26 17:55:06 +02:00
# Specific to Arch
ifeq ($(ARCH), 1)
@$(MAKE) sync-arch
2023-11-05 15:19:28 +01:00
@echo "✅ Arch synced!"
2023-03-26 17:55:06 +02:00
@echo
# Specific to WSL
else ifeq ($(WSL), 1)
@$(MAKE) sync-wsl
2023-11-05 15:19:28 +01:00
@echo "✅ WSL synced!"
2023-03-26 17:55:06 +02:00
@echo
# Windows
@$(MAKE) sync-windows
2023-11-05 15:19:28 +01:00
@echo "✅ Windows synced!"
2023-03-26 17:47:58 +02:00
@echo
2024-04-03 08:40:48 +02:00
# Specific to Termux
2024-04-03 09:18:07 +02:00
else ifeq ($(TERMUX), 1)
2024-04-03 08:40:48 +02:00
@$(MAKE) sync-termux
@echo "✅ Termux 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