3 # Test that we correctly preserve symlinks when saving a file
5 ROOT=$abs_top_builddir/build/test-put-symlink
6 LENSES=$abs_top_srcdir/lenses
8 REAL_HOSTS=$ROOT/other/hosts
11 mkdir -p $(dirname $HOSTS)
12 mkdir -p $(dirname $REAL_HOSTS)
14 cat <<EOF > $REAL_HOSTS
18 (cd $(dirname $HOSTS) && ln -s ../other/hosts $(basename $HOSTS))
20 augtool --nostdinc -I $LENSES -b -r $ROOT > /dev/null <<EOF
21 set /files/etc/hosts/1/alias myhost
25 HOSTS_AUGSAVE=${HOSTS}.augsave
26 if [ ! -f $HOSTS_AUGSAVE ] ; then
27 echo "Missing /etc/hosts.augsave"
30 if [ -h $HOSTS_AUGSAVE ] ; then
31 echo "The file /etc/hosts.augsave is a symlink"
34 if [ ! -h $HOSTS ] ; then
35 echo "/etc/hosts is not a symbolic link"
39 LINK=$(readlink $HOSTS)
40 if [ "x$LINK" != "x../other/hosts" ] ; then
41 echo "/etc/hosts does not link to ../other/hosts"
45 if ! grep myhost $REAL_HOSTS >/dev/null; then
46 echo "/other/hosts does not contain the modification"