#!/bin/sh
#
# $Id: file_status_etc_resolvconf,v 1.4 2004/10/29 15:54:33 jg Exp $
#
#
# Project     :  SCPM (System Configuration Profile Management)
# Module      :  SCPM utilities
# File        :  file_status_etc_resolvconf
# Description :  Determines modification status of /etc/resolv.conf
# Author      :  Joachim Gleissner <jg@suse.de>
#
# Copyright 2002-2004 SuSE Linux AG
#
# Released under the terms of the GNU General Public License
# (see file COPYRIGHT in project root directory).
#

RESOLV_CONF=$1

test -x /sbin/modify_resolvconf || { echo "need /sbin/modify_resolvconf" ; exit 2 ; }

# special case missing resolv.conf
test ! -e "$RESOLV_CONF" && RESOLV_CONF=/dev/null

if [ "$3" = "uptodate" ]; then
        while grep -q '^# Backup' $RESOLV_CONF
        do
                R="$( sed -n -e '/^# Backup.*/s/^# Backup: *//p' /etc/resolv.conf $RESOLV_CONF )"
                test -e "$R" || break
                RESOLV_CONF="$R"
        done
else
    /sbin/modify_resolvconf check >/dev/null 2>&1 || { echo not_modified; exit 0; }
fi

diff -q $RESOLV_CONF $2 >/dev/null || { echo modified; exit 1; }

echo not_modified
exit 0
