pterodactyl-panel-compose/Makefile

23 lines
1.4 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)
RANDOM_STRING=$(shell head /dev/urandom | tr -dc 'A-Za-z0-9!?,.$%&+-:<=>@_' | head -c20)
install: install-compose install-service
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|%SHARE_DIR%|$(SHARE_DIR)/pterodactyl-panel|g" "$(DESTDIR)$(SHARE_DIR)/pterodactyl-panel/pterodactyl-panel.sh"
sed -i "s|%RANDOM_STRING%|$(RANDOM_STRING)|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