pterodactyl-panel-compose/Makefile

22 lines
1.3 KiB
Makefile

PREFIX ?= /usr
SHARE_DIR=$(PREFIX)/share
APP_TIMEZONE=$(shell readlink /etc/localtime | awk -F'/' '{print $$(NF-1)"/"$$(NF)}')
MYSQL_PASSWORD=$(shell head /dev/urandom | tr -dc 'A-Za-z0-9!?,.$%&+-:<=>@_' | head -c32)
MYSQL_ROOT_PASSWORD=$(shell head /dev/urandom | tr -dc 'A-Za-z0-9!?,.$%&+-:<=>@_' | head -c32)
HOST_ACTIVE_IP=$(shell ip a | grep "state UP" -A2 | grep inet | awk '{$$1=$$1};1 {split($$2,a,"/"); print a[1]} ')
install: install-compose
install-compose:
install -vDm 755 pterodactyl-panel.sh.in "$(DESTDIR)$(SHARE_DIR)/pterodactyl-panel/pterodactyl-panel.sh"
sed -i "s|%APP_TIMEZONE%|$(APP_TIMEZONE)|g" "$(DESTDIR)$(SHARE_DIR)/pterodactyl-panel/pterodactyl-panel.sh"
sed -i "s|%MYSQL_PASSWORD%|$(MYSQL_PASSWORD)|g" "$(DESTDIR)$(SHARE_DIR)/pterodactyl-panel/pterodactyl-panel.sh"
sed -i "s|%MYSQL_ROOT_PASSWORD%|$(MYSQL_ROOT_PASSWORD)|g" "$(DESTDIR)$(SHARE_DIR)/pterodactyl-panel/pterodactyl-panel.sh"
sed -i "s|%HOST_ACTIVE_IP%|$(HOST_ACTIVE_IP)|g" "$(DESTDIR)$(SHARE_DIR)/pterodactyl-panel/pterodactyl-panel.sh"
install-service:
install -vDm 755 pterodactyl-panel-compose.initd.in "$(DESTDIR)/etc/init.d/pterodactyl-panel-compose"
sed -i "s|%COMPOSEPATH%|$(SHARE_DIR)/pterodactyl-panel/pterodactyl-panel.sh|g" "$(DESTDIR)/etc/init.d/pterodactyl-panel-compose"
.PHONY: install