Check if platform is supported

This commit is contained in:
Mylloon 2023-03-19 19:56:45 +01:00
parent b9d8a7064e
commit 2c3cb2a53f
Signed by: Anri
GPG key ID: A82D63DFF8D1317F

View file

@ -5,6 +5,10 @@ VC = git
WGET = wget -q --show-progress
CURL = curl -s
# Checkers
ARCH = $(shell grep -c "archlinux" /proc/version)
WSL = $(shell grep -c "WSL2" /proc/version)
# Hide some verbose messages from Make
MAKEFLAGS += --no-print-directory
@ -21,6 +25,8 @@ full-sync:
@$(MAKE) refresh
@$(MAKE) sync
# === All platforms ==
# .config
@ -51,12 +57,6 @@ sync-emacs:
@echo Emacs config synced!
@echo
# .mozilla
sync-mozilla:
# END
@echo Firefox config synced!
@echo
# .dotfiles
sync-dotfiles:
# .gitconfig
@ -72,24 +72,39 @@ sync-dotfiles:
@echo dotfiles synced!
@echo
# === Specific platforms ==
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
ifeq ($(shell grep -c "archlinux" /proc/version), 1)
# Arch
@$(MAKE) sync-mozilla
else ifeq ($(shell grep -c "WSL" /proc/version), 1)
# WSL
# Specific to Arch
ifeq ($(ARCH), 1)
# Fish
@$(WGET) https://git.mylloon.fr/Anri/confOS/raw/branch/main/.config/fish/config_wsl.fish -O $(HOME)/.config/fish/config.fish
# Specific to WSL
else ifeq ($(WSL), 1)
# Fish
@$(WGET) https://git.mylloon.fr/Anri/confOS/raw/branch/main/.config/fish/config_wsl.fish -O $(HOME)/.config/fish/config.fish
@$(CURL) https://git.mylloon.fr/Anri/confOS/raw/branch/main/.config/fish/conf.d/abbr_wsl.fish >> $(HOME)/.config/fish/conf.d/abbr.fish
# Unison
@mkdir -p $(HOME)/.unison
@$(WGET) https://git.mylloon.fr/Anri/confOS/raw/branch/main/.unison/default.prf -O $(HOME)/.unison/default.prf
# Specific
@$(WGET) https://git.mylloon.fr/Anri/confOS/raw/branch/main/.config/fish/config_wsl.fish -O $(HOME)/.config/fish/config.fish_prompt
@$(CURL) https://git.mylloon.fr/Anri/confOS/raw/branch/main/.config/fish/conf.d/abbr_wsl.fish >> $(HOME)/.config/fish/conf.d/abbr.fish
endif
# END
@echo 🎉 Sync complete!
endif