Makefile 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. PATH := "$(NVM_BIN):$(PATH)"
  2. UID := $(shell id -u)
  3. NVM_BINARY := $(shell which node)
  4. .PHONY: install-deps
  5. install-deps:
  6. which npm
  7. which npx
  8. chmod +x ~/.nvm/nvm.sh
  9. cd .. && npm i
  10. cd .. && npm i playwright@latest
  11. cd .. && npx playwright install-deps
  12. cd .. && ./generate_api_json.sh
  13. cd .. && ./generate_perl_modules.pl
  14. .PHONY: install-service
  15. install-service:
  16. test $(PORT)
  17. test $(NVM_BINARY)
  18. make install-deps
  19. [ ! -f /etc/redhat-release ] || make enable-systemd-user-mode
  20. mkdir -p ~/.config/systemd/user
  21. cp playwright.unit ~/.config/systemd/user/playwright.service
  22. sed -i 's#__REPLACEME__#$(shell pwd)#g' ~/.config/systemd/user/playwright.service
  23. sed -i 's#__PORT__#$(PORT)#g' ~/.config/systemd/user/playwright.service
  24. sed -i 's#!/usr/bin/node#!$(NVM_BINARY)#g' ../bin/playwright_server
  25. systemctl --user daemon-reload
  26. systemctl --user enable playwright
  27. systemctl --user start playwright
  28. sudo loginctl enable-linger $(USER)
  29. .PHONY: enable-systemd-user-mode
  30. enable-systemd-user-mode:
  31. sudo cp systemd/centos-user-mode.unit /etc/systemd/system/user@$(UID).service
  32. sudo systemctl daemon-reload
  33. sudo systemctl enable user@$(UID).service
  34. sudo systemctl start user@$(UID).service