comparison sbin/fjail @ 223:dce9ba905c32

Propose settings for host.hostuuid and host.hostid when configuring jails
author Franz Glasner <f.glasner@feldmann-mg.com>
date Wed, 31 Aug 2022 12:55:51 +0200
parents 16238e9032a9
children 6713d97b4180
comparison
equal deleted inserted replaced
222:16238e9032a9 223:dce9ba905c32
329 # command_configure mountpoint 329 # command_configure mountpoint
330 # 330 #
331 command_configure() { 331 command_configure() {
332 # mountpoint 332 # mountpoint
333 local _mp 333 local _mp
334 local _new_hostuuid _new_hostid
334 335
335 _mp="$1" 336 _mp="$1"
336 337
337 if [ -z "${_mp}" ]; then 338 if [ -z "${_mp}" ]; then
338 echo "ERROR: no mountpoint given" >&2 339 echo "ERROR: no mountpoint given" >&2
354 355
355 # Timezone to CET 356 # Timezone to CET
356 if [ ! -f "${_mp}/etc/localtime" ]; then 357 if [ ! -f "${_mp}/etc/localtime" ]; then
357 echo "Setting timezone to Europe/Berlin" 358 echo "Setting timezone to Europe/Berlin"
358 ln -s ../usr/share/zoneinfo/Europe/Berlin "${_mp}/etc/localtime" 359 ln -s ../usr/share/zoneinfo/Europe/Berlin "${_mp}/etc/localtime"
360 echo "Europe/Berlin" > "${_mp}/var/db/zoneinfo"
359 else 361 else
360 echo "WARNING: \"${_mp}/etc/localtime\" exists already -- not changed" 362 echo "WARNING: \"${_mp}/etc/localtime\" exists already -- not changed"
361 fi 363 fi
362 364
363 # XXX FIXME What about hostid in vnet jails (see /etc/rc.d/hostid and /etc/rc.d/hostid_save) 365 #
366 # hostid and hostuuid should be set (at least for consistency ressons)
367 # in vnet jails (see /etc/rc.d/hostid and /etc/rc.d/hostid_save).
368 # They can be set in the jail.conf.
369 # Print one here that can be pasted into the jail.conf if needed.
370 #
371 # hostid and hostuuid for non-vnet jails are inherited from the parent/host.
372 #
373 # See also /etc/rc.d/hostid and /etc/rc.d/hostid_save.
374 #
375 _new_hostuuid="$(uuidgen)"
376 _new_hostid="$(echo -n ${_new_hostuuid} | /sbin/md5)"
377 _new_hostid="0x${_new_hostid%%????????????????????????}"
378
379 echo "Proposed hostuuid/hostid:"
380 echo " host.hostuuid = \"${_new_hostuuid}\";"
381 echo " host.hostid = $((_new_hostid));"
382 #echo " host.hostid = ${_new_hostid};"
364 } 383 }
365 384
366 385
367 # 386 #
368 # "copy" -- ZFS copy of datasets 387 # "copy" -- ZFS copy of datasets