From 5b7b4d541766dcaa27db11fc82a5114790828deb Mon Sep 17 00:00:00 2001 From: Dan Theisen Date: Thu, 5 Jul 2018 22:52:23 -0700 Subject: user/dhcpcd: import, take, clean up --- user/dhcpcd/dhcpcd.post-upgrade | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 user/dhcpcd/dhcpcd.post-upgrade (limited to 'user/dhcpcd/dhcpcd.post-upgrade') diff --git a/user/dhcpcd/dhcpcd.post-upgrade b/user/dhcpcd/dhcpcd.post-upgrade new file mode 100644 index 000000000..f1e7dc924 --- /dev/null +++ b/user/dhcpcd/dhcpcd.post-upgrade @@ -0,0 +1,24 @@ +#!/bin/sh + +ver_new="$1" +ver_old="$2" + +# Move dhcpcd.duid and dhcpcd.secret to new location when upgrading +# to dhcpcd 7.x. +# See https://roy.marples.name/blog/dhcpcd-7-finally-enters-beta. +if [ "$(apk version -t "$ver_old" '7.0.0-r0')" = '<' ]; then + dbdir='/var/lib/dhcpcd' + duid_old='/etc/dhcpcd.duid' + secret_old='/etc/dhcpcd.secret' + + if [ -f $duid_old ] && [ ! -f $dbdir/duid ]; then + echo "* Moving $duid_old to $dbdir/duid" >&2 + mv $duid_old $dbdir/duid + fi + if [ -f $secret_old ] && [ ! -f $dbdir/secret ]; then + echo "* Moving $secret_old to $dbdir/secret" >&2 + mv $secret_old $dbdir/secret + fi +fi + +exit 0 -- cgit v1.2.3-60-g2f50