2 Commits

Author SHA1 Message Date
70f32b799c Update README.md 2021-05-21 19:57:40 +03:00
2aaaca0db0 Improve service file and service installation script 2019-09-10 15:00:26 +03:00
3 changed files with 7 additions and 6 deletions

View File

@@ -19,7 +19,7 @@ structure for that files.
## Installing ## Installing
```bash ```bash
go install github.com/derfenix/photocatalog go install github.com/derfenix/photocatalog/cmd/photocatalog@latest
``` ```
Optionally you could copy created binary from the GO's bin path to Optionally you could copy created binary from the GO's bin path to
system or user $PATH, e.g. /usr/local/bin/. system or user $PATH, e.g. /usr/local/bin/.

View File

@@ -1,19 +1,20 @@
#!/usr/bin/env bash #!/usr/bin/env bash
INIT=${1:-systemd} INIT="${1:-systemd}"
CONFIG_PATH="${XDG_CONFIG_HOME:-$HOME/.config}" CONFIG_PATH="${XDG_CONFIG_HOME:-$HOME/.config}"
SETTINGS_PATH="${CONFIG_PATH}/photocatalog" SETTINGS_PATH="${CONFIG_PATH}/photocatalog"
SYSTEMD_UNIT_PATH="${CONFIG_PATH}/systemd/user/" SYSTEMD_UNIT_PATH="${CONFIG_PATH}/systemd/user/"
if "${INIT}" == "systemd" if [[ "${INIT}" == "systemd" ]]
then then
cp ./init/systemd/photocatalog.service $SYSTEMD_UNIT_PATH/photocatalog.service cp ./init/systemd/photocatalog.service $SYSTEMD_UNIT_PATH/photocatalog.service
if test ! -f "${SETTINGS_PATH}" if test ! -f "${SETTINGS_PATH}"
then then
echo "TARGET=<specify target dir>\nMONITOR=<specify dir to monitor>\nMODE=hardlink" > "${SETTINGS_PATH}" echo "TARGET=<specify target dir>\nMONITOR=<specify dir to monitor>\nMODE=hardlink\n" > "${SETTINGS_PATH}"
${EDITOR} "${SETTINGS_PATH}" echo "UPDATECTIME=true\n" >> "${SETTINGS_PATH}"
${EDITOR:-vi} "${SETTINGS_PATH}"
exit $? exit $?
else else
exit 0 exit 0

View File

@@ -7,5 +7,5 @@ WantedBy=default.target
[Service] [Service]
Type=simple Type=simple
EnvironmentFile=/home/%u/.config/photocatalog EnvironmentFile=/home/%u/.config/photocatalog
ExecStart=photocatalog -mode $MODE -target $TARGET -monitor $MONITOR ExecStart=photocatalog -mode $MODE -target $TARGET -monitor $MONITOR -update_mtime $UPDATECTIME
ExecStartPre=photocatalog -mode $MODE -target $TARGET ${MONITOR} ExecStartPre=photocatalog -mode $MODE -target $TARGET ${MONITOR}