diff options
-rw-r--r-- | Makefile | 13 | ||||
-rw-r--r-- | README.mdwn | 8 | ||||
-rw-r--r-- | priv/simplec.service | 10 | ||||
-rwxr-xr-x | simplec | 10 |
4 files changed, 39 insertions, 2 deletions
@@ -1,5 +1,7 @@ ERL ?= erl APP := simplec +USER_UNITS := ~/.config/systemd/user/ +SERVICE := $(APP).service .PHONY: deps @@ -26,6 +28,17 @@ test: all tags: find . -name "*.[he]rl" -print | etags - +install_user: test + cp priv/$(SERVICE) $(USER_UNITS)/$(SERVICE) + mkdir -p ~/bin/ + ln -s $$(realpath .)/$(APP) ~/bin/$(APP) + systemctl --user enable $(SERVICE) + +uninstall_user: + systemctl --user stop $(SERVICE) + systemctl --user disable $(SERVICE) + rm -f $(USER_UNITS)/$(SERVICE) ~/bin/$(APP) + DEPSOLVER_PLT=$(CURDIR)/.depsolver_plt $(DEPSOLVER_PLT): dialyzer --output_plt $(DEPSOLVER_PLT) --build_plt \ diff --git a/README.mdwn b/README.mdwn index 8da725c..186b6af 100644 --- a/README.mdwn +++ b/README.mdwn @@ -7,3 +7,11 @@ It also prints the vm names and IPs to stdout for easy c'n'p. To build and run do a: make && make && ./simplec + +If you want to install it as a systemd user service for the current user use: + + make install_user + +and to get rid of it again use: + + make uninstall_user diff --git a/priv/simplec.service b/priv/simplec.service new file mode 100644 index 0000000..2a654ab --- /dev/null +++ b/priv/simplec.service @@ -0,0 +1,10 @@ +[Unit] +Description=Simplec: simple vm interface + +[Service] +Type=simple +ExecStart=/bin/sh -c "exec ${HOME}/bin/simplec" +Restart=always + +[Install] +WantedBy=default.target @@ -1,3 +1,9 @@ #!/bin/sh -`dirname $0` -exec erl -pa $PWD/ebin $PWD/deps/*/ebin -boot start_sasl -s simplec +BIN=$(realpath $0) +cd $(dirname $BIN) + +if [ ! -t 1 ]; then + ARGS=-noinput +fi + +exec erl $ARGS -pa $PWD/ebin $PWD/deps/*/ebin -boot start_sasl -s simplec |