Date: Fri, 23 Dec 2022 17:53:13 +0100 (CET) From: Ronald Klop <ronald-lists@klop.ws> To: "Tobias C. Berner" <tcberner@FreeBSD.org> Cc: dev-commits-src-all@FreeBSD.org, src-committers@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: 62a149bf6219 - main - Add new rc: machine_id to generate /etc/machine-id Message-ID: <876513140.46.1671814393751@mailrelay> In-Reply-To: <202212231636.2BNGaluc012056@gitrepo.freebsd.org> References: <202212231636.2BNGaluc012056@gitrepo.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
------=_Part_45_1998427481.1671814393669 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable Hi, What is the difference or overlap of this and /etc/hostid ? Regards, Ronald. =C3=82=20 Van: "Tobias C. Berner" <tcberner@FreeBSD.org> Datum: vrijdag, 23 december 2022 17:36 Aan: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commi= ts-src-main@FreeBSD.org Onderwerp: git: 62a149bf6219 - main - Add new rc: machine_id to generate /e= tc/machine-id >=20 > The branch main has been updated by tcberner (ports committer): >=20 > URL: https://cgit.FreeBSD.org/src/commit/?id=3D62a149bf621947fb7475c64b1f= f04fe19fe16b29 >=20 > commit 62a149bf621947fb7475c64b1ff04fe19fe16b29 > Author: Tobias C. Berner <tcberner@FreeBSD.org> > AuthorDate: 2022-12-17 09:18:03 +0000 > Commit: Tobias C. Berner <tcberner@FreeBSD.org> > CommitDate: 2022-12-23 16:33:19 +0000 >=20 > Add new rc: machine_id to generate /etc/machine-id > =20 > This new default-enabled rc will generate a /etc/machine-id file if i= t > does not exist, and pre-fill it with a newly generated UUID of versio= n 4 > [2]. > =20 > The file is generated in /var/db/machine-id and symlinked to > /etc/machine-id to allow for read-only root partitions. > =20 > This file is amongst other things used by libraries like GLib. > =20 > Bump FreeBSD version 1400076 to be able to easily add support for old= er > version of FreeBSD via a package. > =20 > [1] Linux machine-id(5): https://www.man7.org/linux/man-pages/man5/ma= chine-id.5.html > [2] f176fe8e7f638e585afcd2f4dd52a522c4648f63 > =20 > Approved by: bapt > MFC after: 1 week > Differential Revision: https://reviews.freebsd.org/D37722 > --- > etc/Makefile | 2 ++ > libexec/rc/rc.conf | 3 +++ > libexec/rc/rc.d/Makefile | 1 + > libexec/rc/rc.d/machine_id | 34 ++++++++++++++++++++++++++++++++++ > sys/sys/param.h | 2 +- > 5 files changed, 41 insertions(+), 1 deletion(-) >=20 > diff --git a/etc/Makefile b/etc/Makefile > index 3036b7acdd19..10d2f7ea2c5c 100644 > --- a/etc/Makefile > +++ b/etc/Makefile > @@ -59,6 +59,8 @@ distribution: > ${_+_}cd ${SRCTOP}/usr.sbin/rmt; ${MAKE} etc-rmt > ${INSTALL_SYMLINK} -T "package=3Druntime" ../var/run/os-release \ > ${DESTDIR}/etc/os-release > + ${INSTALL_SYMLINK} -T "package=3Druntime" ../var/db/machine-id \ > + ${DESTDIR}/etc/machine-id > .if ${MK_UNBOUND} !=3D "no" > if [ ! -e ${DESTDIR}/etc/unbound ]; then \ > ${INSTALL_SYMLINK} -T "package=3Dunbound" \ > diff --git a/libexec/rc/rc.conf b/libexec/rc/rc.conf > index d10855e1e5fa..a1f6a3f69e8d 100644 > --- a/libexec/rc/rc.conf > +++ b/libexec/rc/rc.conf > @@ -694,6 +694,9 @@ harvest_mask=3D"511" # Entropy device harvests all b= ut the very invasive sources. > osrelease_enable=3D"YES" # Update /var/run/os-release on boot (or NO). > osrelease_file=3D"/var/run/os-release" # File to update for os-release. > osrelease_perms=3D"444" # Default permission for os-release file. > +machine_id_enable=3D"YES" # Create /var/db/machine-id on boot if miss= ing (or NO). > +machine_id_file=3D"/var/db/machine-id" # File to update for machine-id= . > +machine_id_perms=3D"444" # Default permissions for machine-id file. > dmesg_enable=3D"YES" # Save dmesg(8) to /var/run/dmesg.boot > watchdogd_enable=3D"NO" # Start the software watchdog daemon > watchdogd_flags=3D"" # Flags to watchdogd (if enabled) > diff --git a/libexec/rc/rc.d/Makefile b/libexec/rc/rc.d/Makefile > index 0e43b1cd94dc..e990dea60721 100644 > --- a/libexec/rc/rc.d/Makefile > +++ b/libexec/rc/rc.d/Makefile > @@ -52,6 +52,7 @@ CONFS=3D DAEMON \ > local \ > localpkg \ > lockd \ > + machine_id \ > mixer \ > motd \ > mountcritlocal \ > diff --git a/libexec/rc/rc.d/machine_id b/libexec/rc/rc.d/machine_id > new file mode 100644 > index 000000000000..7cfd7b2d92f8 > --- /dev/null > +++ b/libexec/rc/rc.d/machine_id > @@ -0,0 +1,34 @@ > +#!/bin/sh > +# > +# $FreeBSD$ > +# > + > +# PROVIDE: machine_id > +# REQUIRE: mountcritremote FILESYSTEMS > +# BEFORE: LOGIN > + > +. /etc/rc.subr > + > +: ${machine_id_file:=3D/var/db/machine-id} > +: ${machine_id_perms:=3D444} > +name=3D"machine_id" > +desc=3D"Update ${machine_id_file}" > +rcvar=3D"machine_id_enable" > +start_cmd=3D"machine_id_start" > +stop_cmd=3D":" > + > + > +machine_id_start() > +{ > + if [ ! -f ${machine_id_file} ] ; then > + startmsg -n "Creating ${machine_id_file} " > + t=3D$(mktemp -t machine-id) > + /bin/uuidgen -r -o $t > + install -C -o root -g wheel -m ${machine_id_perms} "$t" "${machin= e_id_file}" > + rm -f "$t" > + startmsg 'done.' > + fi > +} > + > +load_rc_config $name > +run_rc_command "$1" > diff --git a/sys/sys/param.h b/sys/sys/param.h > index bb56fe1140cf..9b123a38a7a8 100644 > --- a/sys/sys/param.h > +++ b/sys/sys/param.h > @@ -76,7 +76,7 @@ > * cannot include sys/param.h and should only be updated here. > */ > #undef __FreeBSD_version > -#define __FreeBSD_version 1400075 > +#define __FreeBSD_version 1400076 > =20 > /* > * __FreeBSD_kernel__ indicates that this system uses the kernel of Free= BSD, > =C3=82=20 >=20 >=20 >=20 =C3=82=20 ------=_Part_45_1998427481.1671814393669 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable <html><head></head><body>Hi,<br> <br> What is the difference or overlap of this and /etc/hostid ?<br> <br> Regards,<br> Ronald.<br> <br> =C3=82 <p><strong>Van:</strong> "Tobias C. Berner" <tcberner@FreeBSD.org><br= > <strong>Datum:</strong> vrijdag, 23 december 2022 17:36<br> <strong>Aan:</strong> src-committers@FreeBSD.org, dev-commits-src-all@FreeB= SD.org, dev-commits-src-main@FreeBSD.org<br> <strong>Onderwerp:</strong> git: 62a149bf6219 - main - Add new rc: machine_= id to generate /etc/machine-id</p> <blockquote style=3D"padding-right: 0px; padding-left: 5px; margin-left: 5p= x; border-left: #000000 2px solid; margin-right: 0px"> <div class=3D"MessageRFC822Viewer" id=3D"P"> <div class=3D"TextPlainViewer" id=3D"P.P">The branch main has been updated = by tcberner (ports committer):<br> <br> URL: <a href=3D"https://cgit.FreeBSD.org/src/commit/?id=3D62a149bf621947fb7= 475c64b1ff04fe19fe16b29">https://cgit.FreeBSD.org/src/commit/?id=3D62a149bf= 621947fb7475c64b1ff04fe19fe16b29</a><br> <br> commit 62a149bf621947fb7475c64b1ff04fe19fe16b29<br> Author: Tobias C. Berner <tcberner@FreeBSD.org&g= t;<br> AuthorDate: 2022-12-17 09:18:03 +0000<br> Commit: Tobias C. Berner <tcberner@FreeBSD.org&g= t;<br> CommitDate: 2022-12-23 16:33:19 +0000<br> <br> Add new rc: machine_id to generate /etc/machine-id<= br> <br> This new default-enabled rc will generate a /etc/ma= chine-id file if it<br> does not exist, and pre-fill it with a newly genera= ted UUID of version 4<br> [2].<br> <br> The file is generated in /var/db/machine-id and sym= linked to<br> /etc/machine-id to allow for read-only root partiti= ons.<br> <br> This file is amongst other things used by libraries= like GLib.<br> <br> Bump FreeBSD version 1400076 to be able to easily a= dd support for older<br> version of FreeBSD via a package.<br> <br> [1] Linux machine-id(5): <a href=3D"https://www.man= 7.org/linux/man-pages/man5/machine-id.5.html">https://www.man7.org/linux/ma= n-pages/man5/machine-id.5.html</a><br> [2] f176fe8e7f638e585afcd2f4dd52a522c4648f63<br> <br> Approved by: &n= bsp; bapt<br> MFC after: &nbs= p; 1 week<br> Differential Revision: <a href=3D"https://rev= iews.freebsd.org/D37722">https://reviews.freebsd.org/D37722</a><br> ---<br> etc/Makefile &n= bsp; | 2 ++<br> libexec/rc/rc.conf | = 3 +++<br> libexec/rc/rc.d/Makefile | 1 +<br> libexec/rc/rc.d/machine_id | 34 ++++++++++++++++++++++++++++++++++<br= > sys/sys/param.h  = ; | 2 +-<br> 5 files changed, 41 insertions(+), 1 deletion(-)<br> <br> diff --git a/etc/Makefile b/etc/Makefile<br> index 3036b7acdd19..10d2f7ea2c5c 100644<br> --- a/etc/Makefile<br> +++ b/etc/Makefile<br> @@ -59,6 +59,8 @@ distribution:<br> ${_+_}cd ${SRCTOP}/usr.sbin/rmt; ${MAKE} etc-rmt<br= > ${INSTALL_SYMLINK} -T "package=3Druntime" ../var/ru= n/os-release \<br> ${DESTDIR}/etc/os-release<b= r> + ${INSTALL_SYMLINK} -T "package=3Druntime" ../var/db/machine-i= d \<br> + ${DESTDIR}/etc/machine-id<br> .if ${MK_UNBOUND} !=3D "no"<br> if [ ! -e ${DESTDIR}/etc/unbound ]; then \<br> ${INSTALL_SYMLINK} -T "pack= age=3Dunbound" \<br> diff --git a/libexec/rc/rc.conf b/libexec/rc/rc.conf<br> index d10855e1e5fa..a1f6a3f69e8d 100644<br> --- a/libexec/rc/rc.conf<br> +++ b/libexec/rc/rc.conf<br> @@ -694,6 +694,9 @@ harvest_mask=3D"511" # Entropy device harvests al= l but the very invasive sources.<br> osrelease_enable=3D"YES" # Update /var/run/os-release on boot (or NO)= .<br> osrelease_file=3D"/var/run/os-release" # File to update for os-releas= e.<br> osrelease_perms=3D"444" # Default permission for os-release fil= e.<br> +machine_id_enable=3D"YES" # Create /var/db/machine-id on= boot if missing (or NO).<br> +machine_id_file=3D"/var/db/machine-id" # File to update for ma= chine-id.<br> +machine_id_perms=3D"444" # Default permissions for machine-id file.<br> dmesg_enable=3D"YES" # Save dmesg(8) to /var/run/dmesg.boot<br> watchdogd_enable=3D"NO" # Start the software watchdog daemon<br= > watchdogd_flags=3D"" # Flags to watchdogd (if enabled)<br> diff --git a/libexec/rc/rc.d/Makefile b/libexec/rc/rc.d/Makefile<br> index 0e43b1cd94dc..e990dea60721 100644<br> --- a/libexec/rc/rc.d/Makefile<br> +++ b/libexec/rc/rc.d/Makefile<br> @@ -52,6 +52,7 @@ CONFS=3D DAEMON \<br> local \<br> localpkg \<br> lockd \<br> + machine_id \<br> mixer \<br> motd \<br> mountcritlocal \<br> diff --git a/libexec/rc/rc.d/machine_id b/libexec/rc/rc.d/machine_id<br> new file mode 100644<br> index 000000000000..7cfd7b2d92f8<br> --- /dev/null<br> +++ b/libexec/rc/rc.d/machine_id<br> @@ -0,0 +1,34 @@<br> +#!/bin/sh<br> +#<br> +# $FreeBSD$<br> +#<br> +<br> +# PROVIDE: machine_id<br> +# REQUIRE: mountcritremote FILESYSTEMS<br> +# BEFORE: LOGIN<br> +<br> +. /etc/rc.subr<br> +<br> +: ${machine_id_file:=3D/var/db/machine-id}<br> +: ${machine_id_perms:=3D444}<br> +name=3D"machine_id"<br> +desc=3D"Update ${machine_id_file}"<br> +rcvar=3D"machine_id_enable"<br> +start_cmd=3D"machine_id_start"<br> +stop_cmd=3D":"<br> +<br> +<br> +machine_id_start()<br> +{<br> + if [ ! -f ${machine_id_file} ] ; then<br> + startmsg -n "Creating ${machine_id_fi= le} "<br> + t=3D$(mktemp -t machine-id)<br> + /bin/uuidgen -r -o $t<br> + install -C -o root -g wheel -m ${mach= ine_id_perms} "$t" "${machine_id_file}"<br> + rm -f "$t"<br> + startmsg 'done.'<br> + fi<br> +}<br> +<br> +load_rc_config $name<br> +run_rc_command "$1"<br> diff --git a/sys/sys/param.h b/sys/sys/param.h<br> index bb56fe1140cf..9b123a38a7a8 100644<br> --- a/sys/sys/param.h<br> +++ b/sys/sys/param.h<br> @@ -76,7 +76,7 @@<br> * cannot include sys/param.h and should only be updated here.<b= r> */<br> #undef __FreeBSD_version<br> -#define __FreeBSD_version 1400075<br> +#define __FreeBSD_version 1400076<br> <br> /*<br> * __FreeBSD_kernel__ indicates that this system uses the kernel= of FreeBSD,<br> =C3=82 </div> <hr></div> </blockquote> <br> =C3=82 </body></html> ------=_Part_45_1998427481.1671814393669--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?876513140.46.1671814393751>