summaryrefslogtreecommitdiff
path: root/user/dhcpcd/dhcpcd.post-upgrade
diff options
context:
space:
mode:
Diffstat (limited to 'user/dhcpcd/dhcpcd.post-upgrade')
-rw-r--r--user/dhcpcd/dhcpcd.post-upgrade24
1 files changed, 24 insertions, 0 deletions
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