Skip to content

Commit

Permalink
Merge pull request #66 from unlsycn/fix-install-systemd
Browse files Browse the repository at this point in the history
build: not enabling service in install_systemd
  • Loading branch information
hmgle authored Feb 21, 2024
2 parents eb0e60d + 9f1773d commit dfba9e6
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,10 @@ Optionally, you can also install them to system:

```sh
sudo make install
# Enable and activate systemed unit
# Install systemed unit
sudo make install_systemd
# Activate systemd service
sudo make enable_systemd
```

### Install from binary package
Expand Down
4 changes: 3 additions & 1 deletion README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@ make 执行完后,即可运行 `graftcp-local/graftcp-local` 和 `./graftcp`

```sh
sudo make install
# Enable and activate systemed unit
# Install systemed unit
sudo make install_systemd
# Activate systemd service
sudo make enable_systemd
```

### 二进制包安装
Expand Down
8 changes: 6 additions & 2 deletions local/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,17 @@ install_systemd:: install
ifneq ($(PREFIX),/usr/)
sed -i -re 's#/usr/bin/graftcp-local#$(subst #,\#,${PREFIX})/bin/graftcp-local#g' ${DESTDIR}/${SYSTEMD_UNIT_DIR}/graftcp-local.service
endif

enable_systemd::
@echo "Enable and start the graftcp-local systemd unit"
systemctl daemon-reload && systemctl --now enable graftcp-local.service

uninstall_systemd::
$(if $(SYSTEMD_UNIT_DIR),,$(error SYSTEMD_UNIT_DIR is not defined))
disable_systemd::
@echo "Disable and stop the graftcp-local systemd unit"
systemctl disable --now graftcp-local.service

uninstall_systemd:: disable_systemd
$(if $(SYSTEMD_UNIT_DIR),,$(error SYSTEMD_UNIT_DIR is not defined))
rm -f ${DESTDIR}/${SYSTEMD_UNIT_DIR}/graftcp-local.service

uninstall::
Expand Down

0 comments on commit dfba9e6

Please sign in to comment.