From 3e4d59348b74caa00fc3bc11ca483a210774b458 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hannes=20K=C3=B6rber?= Date: Thu, 30 Jun 2022 06:38:05 +0200 Subject: [PATCH] Do not use venv on arch --- Makefile | 31 ++++++++++++++++++++----------- install.sh | 5 +++++ 2 files changed, 25 insertions(+), 11 deletions(-) diff --git a/Makefile b/Makefile index 4ef32a5..578d375 100644 --- a/Makefile +++ b/Makefile @@ -1,20 +1,26 @@ +DISTRO := $(shell . /etc/os-release && echo $$NAME) + venv = ./venv requirements = requirements.txt activate = . $(venv)/bin/activate pip = pip -ansible = venv/bin/ansible-playbook -ansible_run = $(activate) && ansible-playbook -e ansible_python_interpreter=/usr/bin/python3 --inventory localhost, --diff ./playbook.yml ${ANSIBLE_EXTRA_ARGS} + +ifeq ($(DISTRO),Ubuntu) + ansible_run = $(activate) && ansible-playbook -e ansible_python_interpreter=/usr/bin/python3 --inventory localhost, --diff ./playbook.yml ${ANSIBLE_EXTRA_ARGS} +else + ansible_run =ansible-playbook -e ansible_python_interpreter=/usr/bin/python3 --inventory localhost, --diff ./playbook.yml ${ANSIBLE_EXTRA_ARGS} +endif .PHONY: all -all: | venv $(ansible) +all: | venv $(ansible_run) .PHONY: config -config: | venv $(ansible) +config: | venv $(ansible_run) --skip-tags system-update .PHONY: system-update -system-update: $(ansible) +system-update: venv $(ansible_run) --tags system-update .PHONY: reboot @@ -29,11 +35,11 @@ poweroff: weekend: | update poweroff .PHONY: packages -packages: $(ansible) +packages: venv $(ansible_run) --tags packages .PHONY: dotfiles -dotfiles: $(ansible) +dotfiles: venv $(ansible_run) --tags dotfiles .PHONY: clean @@ -44,11 +50,14 @@ clean: test: ./test-in-docker.sh -$(ansible): venv - +ifeq ($(DISTRO), Ubuntux) venv: - python3 -m venv $(venv) - $(activate) && $(pip) install -r $(requirements) + python3 -m venv $(venv) + $(activate) && $(pip) install -r $(requirements) +else +venv: + true +endif .PHONY: freeze freeze: diff --git a/install.sh b/install.sh index 3d3cb00..76d95bf 100755 --- a/install.sh +++ b/install.sh @@ -90,6 +90,11 @@ if ! python3 -c 'import venv' 2>/dev/null ; then printf 'Done\n' fi +if [[ $NAME == "Arch Linux" ]] ; then + _install "ansible" + _install "python-jmespath" +fi + cd "$DOTDIR" && make # fix permissions of the directory