From b0de91ee2622842417253c28792cd68898002234 Mon Sep 17 00:00:00 2001 From: Henri Dohmen Date: Wed, 19 Mar 2025 09:07:24 +0100 Subject: [PATCH] update Makefile --- Makefile | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 21187ce..fcef0de 100644 --- a/Makefile +++ b/Makefile @@ -1,15 +1,22 @@ HOST ?= $(shell hostname) HOSTS = solo c2 -_all: - @true -.PHONY: _all $(addprefix, _swtich_,${HOSTS}) _swtich_ +.PHONY: all switch $(addprefix, _swtich_,${HOSTS}) _swtich_ .SUFFIXES: +all: + @echo "Run \`make switch\` as root to rebuild and switch" + @true + switch: _switch_${HOST} _switch_: @echo "ERROR: couldn't find hostname" @false _switch_%: - nixos-rebuild switch --flake .#$* \ No newline at end of file + @if [ "$(shell whoami)" != "root" ]; then \ + echo "ERROR: Run as root!"; \ + false; \ + fi + nixos-rebuild switch --flake .#$* +