[buildd-tools-devel] Bug#623913: Wishlist bug 623913

Robert Pendell shinji at elite-systems.org
Wed Aug 3 02:43:29 UTC 2011


The sed line is bugged and doesn't work as expected.  It's pulling the first
column but that only works if it happens to be the second column.  You
really need to pull the second column directly.  I have a very crude version
that works but it's could be done better another way.

                grep -v '#' "$FSTAB" | grep ro | grep bind | awk '{$1=$1}1'
\
                    | tr -s ' ' | sed 's/\( \+\)/ /g' | cut -d' ' -f2 \
                    | while read ro_mountpoint; do
                        echo "Remounting $ro_mountpoint read-only"
                        mount -o remount,ro
"$CHROOT_MOUNT_LOCATION$ro_mountpoint"
                done

It runs the file through 3 greps.  One to eliminate commented lines and the
next two reduce it to read-only binds only.  Note that the bind and ro
parameter order won't matter because it isn't matching ro,bind.  It just
matching ro then bind.  The next 3 parts are a weird series of awk, tr, and
sed that work quite well to remove extra spaces and convert tabs to spaces
for the cut command that finishes it off to select only the second field.
The other change was to replace the info command with echo so I can see it
in the shell and remove the / between $CHROOT_MOUNT_LOCATION and
$ro_mountpoint.

Like I said I'm sure there is a much more elegant way to do this but it
works well for me.

Robert Pendell
shinji at elite-systems.org
CAcert Assurer
"A perfect world is one of chaos."
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.alioth.debian.org/pipermail/buildd-tools-devel/attachments/20110802/f5c629fa/attachment.html>


More information about the Buildd-tools-devel mailing list