summaryrefslogtreecommitdiff
path: root/user/dhcpcd/dhcpcd.post-upgrade
diff options
context:
space:
mode:
authorDan Theisen <djt@hxx.in>2018-07-05 22:52:23 -0700
committerDan Theisen <djt@hxx.in>2018-07-06 02:34:42 -0700
commit5b7b4d541766dcaa27db11fc82a5114790828deb (patch)
treeda97aafe9de37eaa211552bb96284941ae8b8d8c /user/dhcpcd/dhcpcd.post-upgrade
parentc48c8a420b98dbee6779508e31edc3886c915961 (diff)
downloadpackages-5b7b4d541766dcaa27db11fc82a5114790828deb.tar.gz
packages-5b7b4d541766dcaa27db11fc82a5114790828deb.tar.bz2
packages-5b7b4d541766dcaa27db11fc82a5114790828deb.tar.xz
packages-5b7b4d541766dcaa27db11fc82a5114790828deb.zip
user/dhcpcd: import, take, clean up
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