On 2015/03/15 21:50, Stuart Henderson wrote:
> On 2015/03/15 17:37, System Administrator wrote:
> > I guess as long as /etc/fstab continues to support non-DUID device 
> > names, it can be manually edited after the initial system build. 
> > However, that also opens the window to transcription errors which can 
> > easily render the system non-operational, requiring recovery from 
> > external media, thus substantially complicating the deployment step.
> 
> It can be automatically edited, too, avoiding transcription errors.

Since I was asked off-list about this:

It doesn't need anything fancy, here's a shell script to read /etc/fstab
and output a converted format on stdout. Validate it with your own files
before relying on it in case I missed anything that it needs to skip.

#!/bin/ksh -e
while read p q; do
        if [[ -z $p ]] || echo $p | grep -E '(/|:|#|^swap$)' > /dev/null; then
                echo "$p $q"
        else
                r=$(disklabel $p | sed -nE 's,^# /dev/r(.*)c:$,/dev/\1,p')
                echo $r${p#*.} $q
        fi
done < /etc/fstab

Reply via email to