Unverified Commit d7345ec5 authored by Troy Engel's avatar Troy Engel Committed by GitHub

Merge pull request #7 from troyengel/devel

Devel -> Master merge for 2.0.1
parents 6de26a73 f4bd6716
# Petrified Changelog
Project Home: https://github.com/troyengel/petrified
## [2.0.1] - 2017-11-19
- Add `CHANGELOG.md` to project
- Update README / man for new systemd things
- Rebuild systemd again to use timers.target (#4)
- Remove petrified.target design completely
- Instanced units can be created manually using systemd overrides
- Use templates to build systemd units ExexStart path (#4)
- Unit files to install are now templates built by Makefile
- Path is determined by `PREFIX=` semantics (packaging standard)
- Readjust copyright date, US Copyright Law is first year published
## [2.0.0] - 2017-11-19
- Implement FreeDNS APIv2 alongside APIv1 with dynamic API guess (#5)
- Default config is to guess which API based on key length
- Specific API version can be coded into config, see `DDNS_API`
- See comments in `petrified.conf` for details on new settings
- Add new `LOG_QUIET` option to not emit if IP hasn't changed (#4)
- Update shebang to be BSD portable (bin/bash -> bin/env bash)
## [1.0.6] - 2016-01-24
- Rebuild systemd design for timers and target (#3)
- Fix systemd `OnCalendar` implementation
- Add systemd `OnActiveSec` to timer on startup
- Deprecate Arch build - AUR started using git
- Update / enhance docs and man page
## [1.0.5] - 2015-03-08
- Fix bad perlpod char
- Add cleanup routine to bad IP exit clause
- Update / enhance Makefile
## [1.0.4] - 2014-12-01
- Fix bad month macro in logfile entries (@IanMReed)
## [1.0.3] - 2014-01-24
- Add Makefile to project
- Convert `README.md` to `README.pod` for multi-use
- Add petrified.1 man page built from README.pod
- Update / enhance Arch `PKGBUILD` things
- Change logrotate to not install systemwide
## [1.0.2] - 2014-11-22
- Documentation updates and enhancements
- First addition of systemd timers (#1)
- Reorganize file layout (move things to subdirs)
- Add better examples for (f)cron, logrotate, etc.
- Add security / permissions check of config file
- Contains API key, should be kept protected
## [1.0.1] - 2014-09-07
- First release of working version
- First tagged release for packagers
## [1.0.0] - unreleased / untagged
- First commits to build project
......@@ -14,7 +14,7 @@ DESTDIR ?=
MANPAGES = \
petrified.1
all: doc
all: doc build-systemd
doc: $(MANPAGES)
petrified.1: README.pod
......@@ -36,26 +36,37 @@ install-doc:
install -Dm0644 extra/petrified.crontab extra/petrified.dispatch \
extra/petrified.logrotate "$(DESTDIR)$(DOCPREFIX)/petrified/extra"
install-systemd:
build-systemd:
sed -e 's|@[email protected]|$(BINPREFIX)|' systemd/petrified-system.service.in > \
systemd/petrified-system.service
sed -e 's|@[email protected]|$(BINPREFIX)|' systemd/petrified-user.service.in > \
systemd/petrified-user.service
clean-systemd:
rm systemd/petrified-system.service systemd/petrified-user.service
install-systemd: build-systemd
# system unit
install -dm0755 "$(DESTDIR)$(LIBPREFIX)/systemd/system"
install -Dm0644 systemd/system/petrified.target \
systemd/system/petrified.timer \
systemd/system/petrified.service \
"$(DESTDIR)$(LIBPREFIX)/systemd/system"
install -Dm0644 systemd/petrified-system.service \
"$(DESTDIR)$(LIBPREFIX)/systemd/system/petrified.service"
install -Dm0644 systemd/petrified.timer \
"$(DESTDIR)$(LIBPREFIX)/systemd/system/petrified.timer"
# user unit
install -dm0755 "$(DESTDIR)$(LIBPREFIX)/systemd/user"
install -Dm0644 systemd/user/petrified.target \
systemd/user/petrified.timer \
systemd/user/petrified.service \
"$(DESTDIR)$(LIBPREFIX)/systemd/user"
install -Dm0644 systemd/petrified-user.service \
"$(DESTDIR)$(LIBPREFIX)/systemd/user/petrified.service"
install -Dm0644 systemd/petrified.timer \
"$(DESTDIR)$(LIBPREFIX)/systemd/user/petrified.timer"
uninstall-main:
$(RM) "$(DESTDIR)$(BINPREFIX)/petrified" \
rm "$(DESTDIR)$(BINPREFIX)/petrified" \
"$(DESTDIR)$(MANPREFIX)/man1/petrified.1" \
"$(DESTDIR)$(ETCPREFIX)/petrified.conf"
rmdir "$(DESTDIR)$(VARPREFIX)/cache/petrified"
uninstall-doc:
$(RM) "$(DESTDIR)$(DOCPREFIX)/petrified/README.pod" \
rm "$(DESTDIR)$(DOCPREFIX)/petrified/README.pod" \
"$(DESTDIR)$(DOCPREFIX)/petrified/LICENSE" \
"$(DESTDIR)$(DOCPREFIX)/petrified/extra/petrified.crontab" \
"$(DESTDIR)$(DOCPREFIX)/petrified/extra/petrified.dispatch" \
......@@ -64,14 +75,12 @@ uninstall-doc:
"$(DESTDIR)$(DOCPREFIX)/petrified" \
uninstall-systemd:
$(RM) "$(DESTDIR)$(LIBPREFIX)/systemd/system/petrified.target" \
"$(DESTDIR)$(LIBPREFIX)/systemd/system/petrified.timer" \
"$(DESTDIR)$(LIBPREFIX)/systemd/system/[email protected]"
$(RM) "$(DESTDIR)$(LIBPREFIX)/systemd/user/petrified.target" \
"$(DESTDIR)$(LIBPREFIX)/systemd/user/petrified.timer" \
"$(DESTDIR)$(LIBPREFIX)/systemd/user/[email protected]"
clean:
rm "$(DESTDIR)$(LIBPREFIX)/systemd/system/petrified.timer" \
"$(DESTDIR)$(LIBPREFIX)/systemd/system/petrified.service"
rm "$(DESTDIR)$(LIBPREFIX)/systemd/user/petrified.timer" \
"$(DESTDIR)$(LIBPREFIX)/systemd/user/petrified.service"
clean: clean-systemd
$(RM) $(MANPAGES)
.PHONY: clean doc install uninstall
......
......@@ -63,35 +63,31 @@ configuration.
user: systemctl --user --now enable petrified.timer
systemctl --user list-timers petrified.timer
A target of C<petrified.target> is pre-configured if multuple interfaces are
to be configured; per standard systemd methodology the existing service unit
is first customized either at the system or user level, then all custom units
and the timer are started/enabled.
For example at the system level if two interfaces are to be used, it might
look like:
Multiple interfaces can be configured using the standard systemd semantics
of unit overrides, which might look like this:
/etc/systemd/system/petrified-iface1.service
--------------------------------------------
.include /usr/lib/systemd/system/petrified.service
[Service]
ExecStart=
ExecStart=/usr/bin/petrified -c /etc/petrified-iface1.conf
/etc/systemd/system/petrified-iface2.service
--------------------------------------------
.include /usr/lib/systemd/system/petrified.service
[Service]
ExecStart=/usr/bin/petrified -c /etc/petrified-iface2.conf
The first C<ExecStart=> is intentional, needed to negate the existing value
first before defining a new value (systemd design for ExecStart override).
Then both customized service units are enabled, as well as the timer unit:
A corresponding new timer is then created to call this unit as it may be
desireable to run different interfaces on different time schedules, which
might then look like this:
systemctl --now enable petrified-iface1.service
systemctl --now enable petrified-iface2.service
systemctl --now enable petrified.timer
/etc/systemd/system/petrified-iface1.timer
--------------------------------------------
.include /usr/lib/systemd/system/petrified.timer
[Timer]
Unit=petrified-iface1.service
OnCalendar=0/8:00:00
The per user configuration looks the same and is usually configured in the
F<~/.config/systemd/user/> space in the home directory. The provided units
for the service contain the connection to the target pre-configured.
This timer will now operate the new custom unit when it's enabled.
=over 4
......@@ -101,8 +97,6 @@ L<http://www.freedesktop.org/software/systemd/man/systemd.unit.html>
L<http://www.freedesktop.org/software/systemd/man/systemd.timer.html>
L<http://www.freedesktop.org/software/systemd/man/systemd.target.html>
=back
=head1 DEPENDENCIES
......@@ -143,7 +137,7 @@ LOG file (if feature enabled - default: no)
=head1 AUTHOR
Copyright (c) 2015 Troy Engel
Copyright (c) 2014 Troy Engel
GPLv3 - see LICENSE for details
......
#!/usr/bin/env bash
#
## petrified - bash client to update dynamic DNS at freedns.afraid.org
## Copyright (c) 2015 Troy Engel
## Version: 2.0.0
## Copyright (c) 2014 Troy Engel
## Version: 2.0.1
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
......
......@@ -129,7 +129,7 @@
.\" ========================================================================
.\"
.IX Title "PETRIFIED 1"
.TH PETRIFIED 1 "2017-09-29" "petrified 2.0.0" "Petrified Manual"
.TH PETRIFIED 1 "2017-11-19" "petrified 2.0.1" "Petrified Manual"
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
......@@ -191,46 +191,40 @@ configuration.
\& systemctl \-\-user list\-timers petrified.timer
.Ve
.PP
A target of \f(CW\*(C`petrified.target\*(C'\fR is pre-configured if multuple interfaces are
to be configured; per standard systemd methodology the existing service unit
is first customized either at the system or user level, then all custom units
and the timer are started/enabled.
Multiple interfaces can be configured using the standard systemd semantics
of unit overrides, which might look like this:
.PP
For example at the system level if two interfaces are to be used, it might
look like:
.PP
.Vb 5
.Vb 6
\& /etc/systemd/system/petrified\-iface1.service
\& \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-
\& .include /usr/lib/systemd/system/petrified.service
\& [Service]
\& ExecStart=
\& ExecStart=/usr/bin/petrified \-c /etc/petrified\-iface1.conf
\&
\& /etc/systemd/system/petrified\-iface2.service
\& \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-
\& .include /usr/lib/systemd/system/petrified.service
\& [Service]
\& ExecStart=/usr/bin/petrified \-c /etc/petrified\-iface2.conf
.Ve
.PP
Then both customized service units are enabled, as well as the timer unit:
The first \f(CW\*(C`ExecStart=\*(C'\fR is intentional, needed to negate the existing value
first before defining a new value (systemd design for ExecStart override).
.PP
A corresponding new timer is then created to call this unit as it may be
desireable to run different interfaces on different time schedules, which
might then look like this:
.PP
.Vb 3
\& systemctl \-\-now enable petrified\-iface1.service
\& systemctl \-\-now enable petrified\-iface2.service
\& systemctl \-\-now enable petrified.timer
.Vb 6
\& /etc/systemd/system/petrified\-iface1.timer
\& \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-
\& .include /usr/lib/systemd/system/petrified.timer
\& [Timer]
\& Unit=petrified\-iface1.service
\& OnCalendar=0/8:00:00
.Ve
.PP
The per user configuration looks the same and is usually configured in the
\&\fI~/.config/systemd/user/\fR space in the home directory. The provided units
for the service contain the connection to the target pre-configured.
This timer will now operate the new custom unit when it's enabled.
.IP "\fBSee also:\fR" 4
.IX Item "See also:"
<http://www.freedesktop.org/software/systemd/man/systemd.unit.html>
.Sp
<http://www.freedesktop.org/software/systemd/man/systemd.timer.html>
.Sp
<http://www.freedesktop.org/software/systemd/man/systemd.target.html>
.SH "DEPENDENCIES"
.IX Header "DEPENDENCIES"
.Vb 7
......@@ -261,7 +255,7 @@ Per-user configuration file
\&\s-1LOG\s0 file (if feature enabled \- default: no)
.SH "AUTHOR"
.IX Header "AUTHOR"
Copyright (c) 2015 Troy Engel
Copyright (c) 2014 Troy Engel
.PP
GPLv3 \- see \s-1LICENSE\s0 for details
.SH "SUPPORT"
......
......@@ -15,18 +15,9 @@
[Unit]
Description=Run petrified in system mode
After=network-online.target
Requisite=network-online.target
[Service]
Type=simple
ExecStart=/usr/bin/petrified -c /etc/petrified.conf
# A target is being provided in the case where the advanced
# admin wants to override this unit with multiple config files
# for multiple interfaces. In this use case, *both* the custom
# service units and the timer are enabled with systemctl (as each
# custom unit will not be called "petrified.service", instead
# something like "petrified-wlp3s0.service")
[Install]
WantedBy=petrified.target
[email protected]@/petrified -c /etc/petrified.conf
......@@ -15,18 +15,9 @@
[Unit]
Description=Run petrified as %u
After=network-online.target
Requisite=network-online.target
[Service]
Type=simple
ExecStart=/usr/bin/petrified -c "%h/.petrifiedrc"
# A target is being provided in the case where the advanced
# admin wants to override this unit with multiple config files
# for multiple interfaces. In this use case, *both* the custom
# service units and the timer are enabled with systemctl (as each
# custom unit will not be called "petrified.service", instead
# something like "petrified-wlp3s0.service")
[Install]
WantedBy=petrified.target
[email protected]@/petrified -c "%h/.petrifiedrc"
......@@ -15,5 +15,4 @@ OnCalendar=0/6:00:00
Persistent=true
[Install]
WantedBy=multi-user.target
WantedBy=timers.target
#
# /usr/lib/systemd/system/petrified.target
#
# Note: If using a target to run mutliple service units, remember
# to enable both the multiple unit files and the single timer.
#
[Unit]
Description=Petrified units via timers
#
# /usr/lib/systemd/user/petrified.target
#
# Note: If using a target to run mutliple service units, remember
# to enable both the multiple unit files and the single timer.
#
[Unit]
Description=Petrified units via timers as %u
#
# /usr/lib/systemd/user/petrified.timer
#
# Note: Only one timer is needed if running multiple service
# units for multiple interfaces. No need to duplicate.
#
[Unit]
Description=Petrified update every 6 hours as %u
[Timer]
Unit=petrified.service
OnActiveSec=0s
OnCalendar=0/6:00:00
Persistent=true
[Install]
WantedBy=multi-user.target
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment