Mercurial > hgrepos > FreeBSD > ports > sysutils > local-bsdtools
changeset 226:73f2436fdf86
Make "hostid" a separate command for printint hostid proposals
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Thu, 01 Sep 2022 09:32:03 +0200 |
| parents | ffd24013d346 |
| children | a7a9fd895d30 |
| files | sbin/fjail |
| diffstat | 1 files changed, 36 insertions(+), 19 deletions(-) [+] |
line wrap: on
line diff
--- a/sbin/fjail Wed Aug 31 13:04:25 2022 +0200 +++ b/sbin/fjail Thu Sep 01 09:32:03 2022 +0200 @@ -69,6 +69,10 @@ Configure some basic parts of the system at MOUNTPOINT: disable root password, syslog and other basic configuration settings + hostid + + Print proposals for a hostuuid and hostid + copy [OPTIONS] SOURCE-DATASET DEST-DATASET Copy a tree of ZFS datasets with "zfs send -R" and "zfs receive". @@ -324,6 +328,34 @@ # +# "hostid" -- print a proposal for hostid/hostuuid settings in a jail +# +# command_hostid +# +command_hostid() { + # + # hostid and hostuuid should be set (at least for consistency ressons) + # in vnet jails (see /etc/rc.d/hostid and /etc/rc.d/hostid_save). + # They can be set in the jail.conf. + # Print one here that can be pasted into the jail.conf if needed. + # + # hostid and hostuuid for non-vnet jails are inherited from the parent/host. + # + # See also /etc/rc.d/hostid and /etc/rc.d/hostid_save. + # + local _new_hostuuid _new_hostid + _new_hostuuid="$(uuidgen)" + _new_hostid="$(echo -n ${_new_hostuuid} | /sbin/md5)" + _new_hostid="0x${_new_hostid%%????????????????????????}" + + echo "Proposed hostuuid/hostid:" + echo " host.hostuuid = \"${_new_hostuuid}\";" + echo " host.hostid = $((_new_hostid));" + #echo " host.hostid = ${_new_hostid};" +} + + +# # "configure" -- configure the mountpoint # # command_configure mountpoint @@ -331,7 +363,6 @@ command_configure() { # mountpoint local _mp - local _new_hostuuid _new_hostid _mp="$1" @@ -373,24 +404,7 @@ # Call newaliases within the jail chroot "${_mp}" /usr/bin/newaliases - # - # hostid and hostuuid should be set (at least for consistency ressons) - # in vnet jails (see /etc/rc.d/hostid and /etc/rc.d/hostid_save). - # They can be set in the jail.conf. - # Print one here that can be pasted into the jail.conf if needed. - # - # hostid and hostuuid for non-vnet jails are inherited from the parent/host. - # - # See also /etc/rc.d/hostid and /etc/rc.d/hostid_save. - # - _new_hostuuid="$(uuidgen)" - _new_hostid="$(echo -n ${_new_hostuuid} | /sbin/md5)" - _new_hostid="0x${_new_hostid%%????????????????????????}" - - echo "Proposed hostuuid/hostid:" - echo " host.hostuuid = \"${_new_hostuuid}\";" - echo " host.hostid = $((_new_hostid));" - #echo " host.hostid = ${_new_hostid};" + command_hostid } @@ -700,6 +714,9 @@ configure) command_configure "$@" ;; + hostid) + command_hostid "$@" + ;; copy) command_copy "$@" ;;
