]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Default DBDIR from /var/db to /var/db/dhcpcd.
authorRoy Marples <roy@marples.name>
Tue, 8 Nov 2016 12:17:20 +0000 (12:17 +0000)
committerRoy Marples <roy@marples.name>
Tue, 8 Nov 2016 12:17:20 +0000 (12:17 +0000)
Move dhcpcd.duid and dhcpcd.secret from /etc into /var/db/dhcpcd.
Move leases and RDM monotonc from /var/db into /var/db/dhcpcd.
All moves files have the dhcpcd{.-} prefix dropped.

Makefile
README
configure
defs.h
dhcpcd.8.in

index 7d68a04c987bfcbebf8d5735e02d4e84eac53931..f18f8e020a630bad1afb54761326a227fc0a9e58 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -130,8 +130,36 @@ _maninstall: ${MAN5} ${MAN8}
 
 _confinstall:
        ${INSTALL} -d ${DESTDIR}${SYSCONFDIR}
+       # Install a new default config if not present
        test -e ${DESTDIR}${SYSCONFDIR}/dhcpcd.conf || \
                ${INSTALL} -m ${CONFMODE} dhcpcd.conf ${DESTDIR}${SYSCONFDIR}
+       # Attempt to move files from sysconfig to dbdir
+       if [ ! -e ${DESTDIR}${DBDIR}/duid -a \
+           -e ${DESTDIR}${SYSCONFDIR}/dhcpcd.duid ]; \
+       then \
+               mv ${DESTDIR}${SYSCONFDIR}/dhcpcd.duid \
+                       ${DESTDIR}${DBDIR}/duid; \
+       fi
+       if [ ! -e ${DESTDIR}${DBDIR}/secret -a \
+           -e ${DESTDIR}${SYSCONFDIR}/dhcpcd.secret ]; \
+       then \
+               mv ${DESTDIR}${SYSCONFDIR}/dhcpcd.secret \
+                       ${DESTDIR}${DBDIR}/secret; \
+       fi
+       # Move leases to new location
+       for lease in ${DESTDIR}${DBDIR}/../dhcpcd-*.lease*; do \
+               [ -f "$$lease" ] || continue; \
+               newlease=$$(basename "$$lease" | ${SED} -e "s/dhcpcd-//"); \
+               mv "$$lease" ${DESTDIR}${DBDIR}/"$$newlease"; \
+       done
+       # Move RDM monotonic to new location
+       if [ ! -e ${DESTDIR}${DBDIR}/rdm_monotonic -a \
+           -e ${DESTDIR}${DBDIR}/../dhcpcd-rdm.monotonic ]; \
+       then \
+               mv ${DESTDIR}${DBDIR}/../dhcpcd-rdm.monotonic \
+                       ${DESTDIR}${DBDIR}/rdm_monotonic; \
+       fi
+       
 hooks:
        cd dhcpcd-hooks; ${MAKE}; cd ..; done
 
diff --git a/README b/README
index 50a69c77f9c624abb8d1b9ba66b3b1bf4cdfee20..711cd4a5383355799d2d79631f491d348118def5 100644 (file)
--- a/README
+++ b/README
@@ -169,8 +169,19 @@ happen in a custom OS hook:
 
 Compatibility
 -------------
-dhcpcd-5.0 is only fully command line compatible with dhcpcd-4.0
-For compatibility with older versions, use dhcpcd-4.0
+dhcpcd-5 is only fully command line compatible with dhcpcd-4
+For compatibility with older versions, use dhcpcd-4
+
+
+Upgrading
+---------
+dhcpcd-7 defaults the database directory to /var/db/dhcpcd instead of /var/db
+and now stores dhcpcd.duid and dhcpcd.secret in there instead of /etc.
+of /etc.
+The Makefile _confinstall target will attempt to move the files correctly from
+the old locations to the new locations.
+Of course this won't work if dhcpcd-7 is packaged up, so packagers will need to
+install similar logic into their dhcpcd package.
 
 
 ChangeLog
index 19c17131ad91ffd323a6c86f0e1b869b438f1864..bb1f2ea144d367ca5b29f8411a76288897b08298 100755 (executable)
--- a/configure
+++ b/configure
@@ -182,7 +182,7 @@ done
 : ${LIBDIR:=$PREFIX/lib}
 : ${LIBEXECDIR:=$PREFIX/libexec}
 : ${STATEDIR:=/var}
-: ${DBDIR:=$STATEDIR/db}
+: ${DBDIR:=$STATEDIR/db/dhcpcd}
 : ${RUNDIR:=$STATEDIR/run}
 : ${MANDIR:=${PREFIX:-/usr}/share/man}
 : ${DATADIR:=${PREFIX:-/usr}/share}
diff --git a/defs.h b/defs.h
index 17bbdf2bc06d4f860b867dbc45a99ec7f3400d1f..27b0e3949499c665a0ab163825fece991d3ff53c 100644 (file)
--- a/defs.h
+++ b/defs.h
 # define DEVDIR                        LIBDIR "/" PACKAGE "/dev"
 #endif
 #ifndef DUID
-# define DUID                  SYSCONFDIR "/" PACKAGE ".duid"
+# define DUID                  DBDIR "/duid"
 #endif
 #ifndef SECRET
-# define SECRET                        SYSCONFDIR "/" PACKAGE ".secret"
+# define SECRET                        DBDIR "/secret"
 #endif
 #ifndef LEASEFILE
-# define LEASEFILE             DBDIR "/" PACKAGE "-%s%s.lease"
+# define LEASEFILE             DBDIR "/%s%s.lease"
 #endif
 #ifndef LEASEFILE6
 # define LEASEFILE6            LEASEFILE "6"
@@ -61,7 +61,7 @@
 # define UNPRIVSOCKET          RUNDIR "/" PACKAGE ".unpriv.sock"
 #endif
 #ifndef RDM_MONOFILE
-# define RDM_MONOFILE          DBDIR "/" PACKAGE "-rdm.monotonic"
+# define RDM_MONOFILE          DBDIR "/rdm_monotonic"
 #endif
 
 #ifndef NO_SIGNALS
index aa260f8187d302b812ac983bfdc1774727a32f0f..bb73abce7e0ecfb893df13b09e81bb9d9eb27bd9 100644 (file)
@@ -22,7 +22,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd August 15, 2016
+.Dd November 8, 2016
 .Dt DHCPCD 8
 .Os
 .Sh NAME
@@ -751,10 +751,6 @@ knows which process to signal.
 .It Pa @SYSCONFDIR@/dhcpcd.conf
 Configuration file for dhcpcd.
 If you always use the same options, put them here.
-.It Pa @SYSCONFDIR@/dhcpcd.duid
-Text file that holds the DUID used to identify the host.
-.It Pa @SYSCONFDIR@/dhcpcd.secret
-Text file that holds a secret key known only to the host.
 .It Pa @SCRIPT@
 Bourne shell script that is run to configure or de-configure an interface.
 .It Pa @LIBDIR@/dhcpcd/dev
@@ -765,15 +761,19 @@ A directory containing bourne shell scripts that are run by the above script.
 Each script can be disabled by using the
 .Fl C , Fl Fl nohook
 option described above.
-.It Pa @DBDIR@/dhcpcd\- Ns Ar interface Ns Ar -ssid Ns .lease
+.It Pa @DBDIR@/duid
+Text file that holds the DUID used to identify the host.
+.It Pa @DBDIR@/secret
+Text file that holds a secret key known only to the host.
+.It Pa @DBDIR@/ Ns Ar interface Ns Ar -ssid Ns .lease
 The actual DHCP message sent by the server.
 We use this when reading the last
 lease and use the files mtime as when it was issued.
-.It Pa @DBDIR@/dhcpcd\- Ns Ar interface Ns Ar -ssid Ns .lease6
+.It Pa @DBDIR@/ Ns Ar interface Ns Ar -ssid Ns .lease6
 The actual DHCPv6 message sent by the server.
 We use this when reading the last
 lease and use the files mtime as when it was issued.
-.It Pa @DBDIR@/dhcpcd-rdm.monotonic
+.It Pa @DBDIR@/rdm_monotonic
 Stores the monotonic counter used in the
 .Ar replay
 field in Authentication Options.