mirror of
https://github.com/iio612/DEFENDER.git
synced 2026-02-13 11:14:23 +00:00
Create Makefile installation; update copyright core command. TODO replace installation.py script.
This commit is contained in:
55
Makefile
Normal file
55
Makefile
Normal file
@@ -0,0 +1,55 @@
|
||||
OS := $(shell uname -s)
|
||||
CURRENT_USER := $(shell whoami)
|
||||
PYTHON_VERSION := $(shell python3 -V)
|
||||
HOME_DIR := $(shell echo $$HOME)
|
||||
SHELL := /bin/bash
|
||||
|
||||
install:
|
||||
ifeq ($(wildcard config/configuration.yaml),)
|
||||
$(error You must provide the Configuration file: config/configuration.yaml)
|
||||
endif
|
||||
|
||||
ifeq ($(OS), Linux)
|
||||
$(info Installation for os : $(OS))
|
||||
$(info Python version: $(PYTHON_VERSION))
|
||||
$(info Home directory: $(HOME_DIR))
|
||||
|
||||
@python3 core/install.py --check-version
|
||||
@if [ $$? -eq 0 ]; then \
|
||||
echo "Python Version OK! Well done :)"; \
|
||||
else \
|
||||
echo "Error: Script failed with exit code $$?"; \
|
||||
exit 1; \
|
||||
fi
|
||||
|
||||
$(info Creating the systemd user folder...)
|
||||
mkdir -p $(HOME_DIR)/.config/systemd/user
|
||||
|
||||
$(info Creating Python Virtual Environment...)
|
||||
python3 -m venv .pyenv
|
||||
@. .pyenv/bin/activate && \
|
||||
python -m pip install --upgrade pip && \
|
||||
pip cache purge && \
|
||||
pip install -r requirements.txt
|
||||
|
||||
@. .pyenv/bin/activate && python core/install.py --install
|
||||
loginctl enable-linger $(CURRENT_USER)
|
||||
@sleep 2
|
||||
@export echo $DBUS_SESSION_BUS_ADDRESS && \
|
||||
systemctl --user daemon-reload && \
|
||||
systemctl --user start defender
|
||||
|
||||
endif
|
||||
|
||||
clean:
|
||||
ifeq ($(OS), Linux)
|
||||
@if [ -e .pyenv ]; then \
|
||||
rm -rf .pyenv; \
|
||||
echo "Virtual Env has been removed!"; \
|
||||
fi
|
||||
@if [ -e $(HOME_DIR)/.config/systemd/user/defender.service ]; then \
|
||||
rm $(HOME_DIR)/.config/systemd/user/defender.service; \
|
||||
echo "Systemd file has been removed!"; \
|
||||
fi
|
||||
@export echo $DBUS_SESSION_BUS_ADDRESS && systemctl --user daemon-reload && echo "Systemd Daemon reloaded!"
|
||||
endif
|
||||
Reference in New Issue
Block a user