diff options
author | Chris Severance | 2015-09-01 19:58:34 -0400 |
---|---|---|
committer | Chris Severance | 2015-09-01 19:58:34 -0400 |
commit | 62f45c160a78577abc2bf53965e83155826029ec (patch) | |
tree | 37ad192ba97d4eae38aa7d6949bb8a43feae84f9 /PKGBUILD | |
parent | 1f3c04df42806dc0b556b6de3f1383e70d9df2f3 (diff) | |
download | aur-62f45c160a78577abc2bf53965e83155826029ec.tar.gz |
Update to 0.2.1
Diffstat (limited to 'PKGBUILD')
-rw-r--r--[-rwxr-xr-x] | PKGBUILD | 155 |
1 files changed, 107 insertions, 48 deletions
diff --git a/PKGBUILD b/PKGBUILD index c9e5ee4362b2..c97e388080c6 100755..100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -1,55 +1,114 @@ +# Maintainer: Chris Severance aur.severach aATt spamgourmet dott com # Contributor: Matt Parnell <parwok@gmail.com> -pkgname=update-dnsomatic -pkgver=0.2.0 -pkgrel=3 -pkgdesc="A perl based utility that updates OpenDNS via crontab, and is simpler than inyadn" -arch=(i686 x86_64) -url="http://prawnuk.blogspot.com/2008/11/dnsomatic-updater.html" +# BUG: So far as I can tell updating multiple hosts with a single request is no longer supported by the DNS-O-Matic service. +# The code could be updated to put out a separate request for each host. This is a big more than sed can do. +# Future BUG: When multiple hosts is implemented, don't wait for IP to change when new hosts are added. +# Until this is fixed server connections are not attempted when multiple hosts are specified. +# FIXED: The interactive stuff in the old PKGBUILD has been moved to install +# FIXED: Connections are not be attempted for default user = userid or password = password +# FIXED: Launches with cron as root or systemd timer as user nobody +# TODO: Implement IP change log +# TODO: Implement all Dynamic DNS services including DNS-O-Matic. +# TODO: Add version to config so we can discard it on same version upgrades and installs. +# TODO: Add settings promotion to new config files. +# TODO: Better variable detection in config (I suspect blank lines aren't handled well) + +# If upgrading from an old version you might get a file conflict +# update-dnsomatic: /etc/update-dnsomatic/myip exists in filesystem +# To solve +# sudo mv /etc/update-dnsomatic/myip /etc/update-dnsomatic/myip.pacsave + +# Starting out it's hard to tell what to put in for myhost. In your DNS-O-Matic account screen you see +# Service +# username :: myhost +# For OpenDNS myhost is just a phrase like Home, Office, or Gramma + +set -u +pkgname='update-dnsomatic' +pkgver='0.2.1' +pkgrel='1' +pkgdesc='A perl utility that updates OpenDNS DNS-O-Matic, and is simpler than inyadn' +arch=('i686' 'x86_64') +url='http://prawnuk.blogspot.com/2008/11/dnsomatic-updater.html' # Seán Doher license=('GPL') -groups=() depends=('perl' 'perl-libwww' 'perl-crypt-ssleay' 'perl-lwp-protocol-https') -makedepends=() -provides=() -conflicts=() -replaces=() -backup=() -source=(http://update-dnsomatic.googlecode.com/files/$pkgname-$pkgver.tar.gz) -noextract=() -md5sums=('d6688165372ce1a8cc57b879713903a2') - -prepare() -{ - cd "$srcdir/$pkgname-$pkgver" - msg "You must insert your OpenDNS username and password. Opening...make sure to save." - - sleep 2 - - # If you don't have either of these you really shouldn't be using linux - if [ -x /usr/bin/vi ] - then vi config || return 1 - else - nano config || return 1 - fi -} +optdepends=('cron: use cron instead of systemd timers') +backup='etc/update-dnsomatic/config' +source=("http://update-dnsomatic.googlecode.com/files/${pkgname}-${pkgver}.tar.gz") +sha256sums=('e4b44ffc8caf1114464ca2ae7a925ca06b632379befa88ac39e36c09253a4715') +install="${pkgname}.install" -build() -{ - return 0 -} +package() { + set -u + cd "${pkgname}-${pkgver}" + install -Dpm640 'config' -t "${pkgdir}/etc/update-dnsomatic/" + chmod 775 "${pkgdir}/etc/update-dnsomatic/" + # This lets pacman -Qo show us as the owner of this file. It also lets pacman delete this file. + install -Dm664 /dev/null "${pkgdir}/etc/update-dnsomatic/myip" + install -Dpm754 'update-dnsomatic' -t "${pkgdir}/usr/bin/" + + local _codedouble=' +use Getopt::Long; +my $arg_daemon=0; + +if (!GetOptions ( + "daemon" => \$arg_daemon +) or @ARGV > 0) { + die("$0: Invalid command line options: @ARGV\n"); +}' + _codedouble="$(echo "${_codedouble}" | sed -e 's:\\:\\\\:g' | tr '\n' '\r' | sed -e 's:\r:\\n:g')" # escape \n for sed replacement + + # Fix permissions + sed -i -e '# Fix permissions on new file creation for systemd to run as nobody' \ + -e 's:^sub write_new_ip {$:&\n umask 0002;:g' \ + -e '# Fix some horrible spacing' \ + -e 's:\s\+$::g' \ + -e '# Block unsupported multiple hosts rather than spam the servers' \ + -e '# Prevent spamming servers with blank or default userid:password' \ + -e 's:^\(\s\+\)close(CONFIG);$:&\n\1if (index($config{myhost}, ",") >= 0) {\n\1\1write_log("err", "Multiple myhost is not supported by DNS-O-Matic. Fix /etc/update-dnsomatic/config");\n\1\1exit(1);\n\1}\n\1if (!$config{user} or !$config{pass} or $config{user} eq "userid" or $config{pass} eq "password") {\n\1\1write_log("err", "User and pass must be set in /etc/update-dnsomatic/config");\n\1\1exit(1);\n\1}:g' \ + -e '# getopts code for doubled log entries in systemctl status update-dnsomatic.service' \ + -e 's/^use Sys::Syslog;$'"/&${_codedouble}/g" \ + -e '# Stop doubled log entries' \ + -e 's:^\(\s\+print "\$msg\\n"\);$:\1 if (!$arg_daemon);:g' \ + "${pkgdir}/usr/bin/update-dnsomatic" + unset _codedouble + + install -Dm644 <(cat << EOF +# Automatically generated by ${pkgname}-${pkgver} PKGBUILD from Arch Linux AUR +# http://aur.archlinux.org/ + +[Unit] +Description=OpenDNS DNS-O-Matic updater ${pkgname} + +[Timer] +OnBootSec=5min +OnCalendar=*:0/10 +Persistent=true + +[Install] +WantedBy=multi-user.target +EOF + ) "${pkgdir}/usr/lib/systemd/system/${pkgname}.timer" + + install -Dm644 <(cat << EOF +# Automatically generated by ${pkgname}-${pkgver} PKGBUILD from Arch Linux AUR +# http://aur.archlinux.org/ + +[Unit] +Description=OpenDNS DNS-O-Matic updater ${pkgname} + +[Service] +Type=oneshot +ExecStart=/usr/bin/update-dnsomatic --daemon +Nice=19 +IOSchedulingClass=best-effort +IOSchedulingPriority=7 +User=nobody +Group=nobody +EOF + ) "${pkgdir}/usr/lib/systemd/system/${pkgname}.service" -package() -{ - cd "$srcdir/$pkgname-$pkgver" - - mkdir ${pkgdir}/etc - mkdir ${pkgdir}/etc/update-dnsomatic - mkdir ${pkgdir}/usr/ - mkdir ${pkgdir}/usr/bin/ - - install -m600 config ${pkgdir}/etc/update-dnsomatic/config - install -m700 update-dnsomatic ${pkgdir}/usr/bin/update-dnsomatic - - msg "Done!...now just add it to the crontab." - msg "Sample to update every 10 minutes: */10 * * * * /usr/local/bin/update-dnsomatic" + set +u } +set +u |