opensubscriber
   Find in this group all groups
 
Unknown more information…

f : freebsd-questions@freebsd.org 5 May 2012 • 9:41PM -0400

Re: HOWTO: FreeBSD ZFS Madness (Boot Environments)
by Randal L. Schwartz

REPLY TO AUTHOR
 
REPLY TO GROUP




>>>>> "vermaden" == vermaden  <vermaden@inte...> writes:


vermaden> To the point, check these two code snippets, they should
vermaden> do EXACLY the same, logic is the same, the differece is
vermaden> only the syntax.

vermaden> snippet 1:

vermaden>         [ ${MOUNT} -eq 0 ] && {
vermaden>           zfs set mountpoint=${TMPMNT} ${POOL}/ROOT/${2}
vermaden>           zfs mount ${POOL}/ROOT/${2}
vermaden>         } || {
vermaden>           TMPMNT=${MOUNT}
vermaden>         }

vermaden> snippet 2:

vermaden>         if [ ${MOUNT} -eq 0 ]; then
vermaden>           zfs set mountpoint=${TMPMNT} ${POOL}/ROOT/${2}
vermaden>           zfs mount ${POOL}/ROOT/${2}
vermaden>         else
vermaden>           TMPMNT=${MOUNT}
vermaden>         fi

No, no and no.  I got burned by that about 30 years ago in shell
programming.  Every time I see someone use that, I shriek just a little
bit.

vermaden> ... or to rewrite it under if/then/else which I did for the whole
vermaden> *beadm* utility and I no longer use || and && syntax,
vermaden> anywhere.

Good to see you've finally been burned.  You'll never make that mistake
again. :)

vermaden> After reboot ...

vermaden> # zfs destroy -R zroot/ROOT
vermaden> # zfs create -o mountpoint=none zroot/ROOT
vermaden> # zfs send zpool@be | zfs recv zroot/ROOT/be
vermaden> # fetch https://raw.github.com/vermaden/beadm/master/beadm
vermaden> # chmod +x beadm
vermaden> # ./beadm list
vermaden> # ./beadm activate be
vermaden> # reboot

vermaden> Now You should have a working system with boot environments.

OK, I'll give that a try. Thanks for being persistent with me.

--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@ston...> <URL:http://www.stonehenge.com/merlyn/>
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.posterous.com/ for Smalltalk discussion
_______________________________________________
freebsd-questions@free... mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscribe@free..."

Bookmark with:

Delicious   Digg   reddit   Facebook   StumbleUpon

Related Messages

opensubscriber is not affiliated with the authors of this message nor responsible for its content.