#!/bin/sh # Check that saving preserves mode and ownership; for this test to make # much sense (if any) the user running it should have at least one # supplementary group root=$abs_top_builddir/build/preserve hosts=$root/etc/hosts init_dirs() { rm -rf $root mkdir -p $(dirname $hosts) } stat_inode() { ls -il $1 | awk '{ print $1 }' } AUGTOOL="augtool --nostdinc -r $root -I $abs_top_srcdir/lenses" init_dirs printf '127.0.0.1\tlocalhost\n' > $hosts chmod 0600 $hosts group=$(groups | tr ' ' '\n' | tail -1) chgrp $group $hosts [ -x /usr/bin/chcon ] && selinux=yes || selinux=no [ x$SKIP_TEST_PRESERVE_SELINUX = x1 ] && selinux=no if [ $selinux = yes ] ; then /usr/bin/chcon -t etc_t $hosts > /dev/null 2>/dev/null || selinux=no fi $AUGTOOL >/dev/null < /dev/null < /dev/null < $hosts exp_inode=$(stat_inode $hosts) $AUGTOOL -b > /dev/null <