# Copyright (c) 2012 Tresys Technology LLC, Columbia, Maryland, USA
#
# This software was developed by Tresys Technology LLC
# with U.S. Government sponsorship.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

add_modprobe_entries() {
# Adds an entry or uncomments the specified entry if it exists.
# 
#  arguments:
#    add_modprobe_entries (entry, FILE)
#      entry - entry to check for and add
#      FILE  - File to which the entry should be added.  If this file
#		does not exist, the file should be created with the entry as
#		it's only contents.
#
	entry=$1 FILE=$2
	
	. $(dirname $0)/set_general_entry
	
	if /bin/grep -r "$entry" /etc/modprobe.d; then
		exit 0
	fi

	if [ -f $FILE ]; then
		safe_add_field "($entry)" "" $FILE
	else
		/bin/echo "${entry}" > $FILE
	fi
}
