From: Roy Marples Date: Tue, 8 Nov 2016 12:17:20 +0000 (+0000) Subject: Default DBDIR from /var/db to /var/db/dhcpcd. X-Git-Tag: v7.0.0-beta1~125 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4e40c20810dfec3e2512c0844f058dd57202eb6b;p=thirdparty%2Fdhcpcd.git Default DBDIR from /var/db to /var/db/dhcpcd. 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. --- diff --git a/Makefile b/Makefile index 7d68a04c..f18f8e02 100644 --- 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 50a69c77..711cd4a5 100644 --- 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 diff --git a/configure b/configure index 19c17131..bb1f2ea1 100755 --- 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 17bbdf2b..27b0e394 100644 --- a/defs.h +++ b/defs.h @@ -40,13 +40,13 @@ # 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 diff --git a/dhcpcd.8.in b/dhcpcd.8.in index aa260f81..bb73abce 100644 --- a/dhcpcd.8.in +++ b/dhcpcd.8.in @@ -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.