From 6b0c513427a9c01a6a04b2617e24e3953aa374cc Mon Sep 17 00:00:00 2001 From: Ondrej Zara Date: Tue, 23 Apr 2019 12:31:01 +0200 Subject: [PATCH] systemd service --- .gitignore | 1 + Makefile | 32 ++++++++++++++++++++++++++++++++ README.md | 2 +- app/Makefile | 18 ------------------ misc/cyp.service.template | 9 +++++++++ screen1.png => misc/screen1.png | Bin screen2.png => misc/screen2.png | Bin 7 files changed, 43 insertions(+), 19 deletions(-) create mode 100644 Makefile delete mode 100644 app/Makefile create mode 100644 misc/cyp.service.template rename screen1.png => misc/screen1.png (100%) rename screen2.png => misc/screen2.png (100%) diff --git a/.gitignore b/.gitignore index 4028752..4193d91 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ node_modules _youtube +cyp.service diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..4954759 --- /dev/null +++ b/Makefile @@ -0,0 +1,32 @@ +LESS := $(shell npm bin)/lessc +APP := app +CSS := $(APP)/app.css +ICONS := $(APP)/js/lib/icons.js +SYSD_USER := ~/.config/systemd/user +SERVICE := cyp.service + +all: $(CSS) + +icons: $(ICONS) + +$(ICONS): $(APP)/icons/* + $(APP)/svg2js.sh $(APP)/icons > $@ + +$(CSS): $(APP)/css/* + $(LESS) $(APP)/css/app.less > $@ + +service: $(SERVICE) + mkdir -p $(SYSD_USER) + ln -fs $(realpath $^) $(SYSD_USER)/$^ + systemctl --user daemon-reload + +$(SERVICE): misc/cyp.service.template + cat $^ | envsubst > $@ + +watch: all + while inotifywait -e MODIFY -r $(APP)/css $(APP)/js ; do make $^ ; done + +clean: + rm -f $(SERVICE) $(CSS) + +.PHONY: all watch icons service clean diff --git a/README.md b/README.md index 08efd58..aad7915 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ CYP is a web-based frontend for [MPD](https://www.musicpd.org/), the Music Playe ## Screenshots -![](screen1.png) ![](screen2.png) +![](misc/screen1.png) ![](misc/screen2.png) ## Features diff --git a/app/Makefile b/app/Makefile deleted file mode 100644 index 819f958..0000000 --- a/app/Makefile +++ /dev/null @@ -1,18 +0,0 @@ -LESS := $(shell npm bin)/lessc -APP := app.css -ICONS := js/lib/icons.js - -all: $(APP) - -icons: $(ICONS) - -$(ICONS): icons/* - ./svg2js.sh icons > $@ - -$(APP): css/* - $(LESS) css/app.less > $@ - -watch: all - while inotifywait -e MODIFY -r css js ; do make $^ ; done - -.PHONY: all watch icons diff --git a/misc/cyp.service.template b/misc/cyp.service.template new file mode 100644 index 0000000..ef3ab6c --- /dev/null +++ b/misc/cyp.service.template @@ -0,0 +1,9 @@ +[Unit] +Description=Control Your Player + +[Service] +WorkingDirectory=$PWD +ExecStart=node . + +[Install] +WantedBy=multi-user.target diff --git a/screen1.png b/misc/screen1.png similarity index 100% rename from screen1.png rename to misc/screen1.png diff --git a/screen2.png b/misc/screen2.png similarity index 100% rename from screen2.png rename to misc/screen2.png