update Makefile
This commit is contained in:
parent
c23f441e9d
commit
b0de91ee26
1 changed files with 11 additions and 4 deletions
13
Makefile
13
Makefile
|
|
@ -1,15 +1,22 @@
|
||||||
HOST ?= $(shell hostname)
|
HOST ?= $(shell hostname)
|
||||||
HOSTS = solo c2
|
HOSTS = solo c2
|
||||||
|
|
||||||
_all:
|
.PHONY: all switch $(addprefix, _swtich_,${HOSTS}) _swtich_
|
||||||
@true
|
|
||||||
.PHONY: _all $(addprefix, _swtich_,${HOSTS}) _swtich_
|
|
||||||
.SUFFIXES:
|
.SUFFIXES:
|
||||||
|
|
||||||
|
all:
|
||||||
|
@echo "Run \`make switch\` as root to rebuild and switch"
|
||||||
|
@true
|
||||||
|
|
||||||
switch: _switch_${HOST}
|
switch: _switch_${HOST}
|
||||||
|
|
||||||
_switch_:
|
_switch_:
|
||||||
@echo "ERROR: couldn't find hostname"
|
@echo "ERROR: couldn't find hostname"
|
||||||
@false
|
@false
|
||||||
_switch_%:
|
_switch_%:
|
||||||
|
@if [ "$(shell whoami)" != "root" ]; then \
|
||||||
|
echo "ERROR: Run as root!"; \
|
||||||
|
false; \
|
||||||
|
fi
|
||||||
nixos-rebuild switch --flake .#$*
|
nixos-rebuild switch --flake .#$*
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue