* Before, doing `$ PREFIX=/usr/local make install` would install files to`/usr/local/usr/local..` which is wrong * With this PR, files will be installed to the expected location e.g. `/usr/local/etc/restic` * `Makefile` almost completely rewritten * As e.g. `default.env` would source `_global.env`, `default.env` must be edited to find the right location of `_global.env` depending on what `$PREFIX` was set to. * see documented build stages in the `Makefile` itself. * Made sure that the rules are correct so that only modifed files are installed, not all at once unnecessarily like before. * A sub-goal was that the [PKGBUILD](https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=restic-systemd-automatic-backup#n20) for Arch should not need to do any custom install configuration, to keep everything easier to maintain. `$ make install` should work out of the box for Arch. * Additionally added the `-b` flag to `install(1)` that makes a backup of existing `etc/restic/*` files before installing a newer version. Fixes #49
20 lines
536 B
Bash
20 lines
536 B
Bash
#!/bin/bash
|
|
|
|
systemctl is-active dbus.service >/dev/null 2>&1 || exit 0
|
|
systemctl is-active NetworkManager.service >/dev/null 2>&1 || exit 0
|
|
|
|
metered_status=$(dbus-send --system --print-reply=literal \
|
|
--system --dest=org.freedesktop.NetworkManager \
|
|
/org/freedesktop/NetworkManager \
|
|
org.freedesktop.DBus.Properties.Get \
|
|
string:org.freedesktop.NetworkManager string:Metered \
|
|
| grep -o ".$")
|
|
|
|
if [[ $metered_status =~ (1|3) ]]; then
|
|
echo Current connection is metered
|
|
exit 1
|
|
else
|
|
exit 0
|
|
fi
|
|
|