Date: Sat, 05 May 2012 06:41:25 -0700 From: merlyn@stonehenge.com (Randal L. Schwartz) To: vermaden <vermaden@interia.pl> Cc: freebsd-fs@FreeBSD.org, freebsd-questions@freebsd.org, bryan@shatow.net Subject: Re: HOWTO: FreeBSD ZFS Madness (Boot Environments) Message-ID: <86d36iycca.fsf@red.stonehenge.com> In-Reply-To: <mvldhyocegbxysykainf@hamg> (vermaden@interia.pl's message of "Sat, 05 May 2012 08:19:11 %2B0200") References: <pfwjphodwzuumbfqsxjn@xcww> <86ipgbg2p6.fsf@red.stonehenge.com> <ijlvdasdjkuxpbatycve@qzwb> <86d36jzk16.fsf@red.stonehenge.com> <867gwrzjwc.fsf@red.stonehenge.com> <86397fzjgi.fsf@red.stonehenge.com> <86y5p7y478.fsf@red.stonehenge.com> <mvldhyocegbxysykainf@hamg>
next in thread | previous in thread | raw e-mail | index | archive | help
>>>>> "vermaden" == vermaden <vermaden@interia.pl> 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@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.posterous.com/ for Smalltalk discussion
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?86d36iycca.fsf>
