#=========================================================#
# Make One Linux -- molmakerc file
#   (C)2005-2006 Keicho Kondo <dgel@users.sourceforge.jp>
#=========================================================#

## === Define === ##
MOLVERSION="$(cat /etc/mol/VERSION)"

# set color
RESET="]R"       # Reset fb color mode
CRE="
[K"       # Erase to end of line
CLEAR="c"        # Clear and reset Screen
NORMAL="[0;39m"  # Normal Color
RED="[1;31m"     # Failure or error message
GREEN="[1;32m"   # Success message
YELLOW="[1;33m"  # Descriptions
BLUE="[1;34m"    # System message
MAGENTA="[1;35m" # Found devices or drivers
CYAN="[1;36m"    # Questions
WHITE="[1;37m"   # Hint


## === Road Config File === ##
. /etc/mol/molmake.conf


## === Road Function === ##
# Check OK
chkok()
{
	echo -n "${BLUE}.${NORMAL}"
}

# Check Failed
chkfail()
{
	echo "${RED}Failed${NORMAL}"
	exit 1
}

# Make List
mklist()
{
	cnt=0
	line=$(wc -l $1 | awk '{print $1}')
	while [ "$line" -gt "$cnt" ]
	do
		cnt=$(expr $cnt + 1)
		LIST="$(head -n $cnt $1 | tail -n 1)"
		LIST="$(echo $LIST | sed -e 's/\\\ /\ /g')"
		LIST="$(echo $LIST | sed -e 's/\ /\\\ /g')"
		[ -z "$LIST" ] && continue
		[ "$1" = "$EX_FILE_LIST" ] && echo $LIST
		[ "$1" = "$EX_PKG_LIST" ]  && rpm -ql $LIST
		if [ "$1" = "$IN_MOD_LIST" ]
		then
			case "$LIST" in *.ko) echo $LIST && continue ;; esac
			echo ${LIST}.ko
		fi
	done
}


## === Check Executing User Account === ##
EXECUSER=`id -un`
if [ "${EXECUSER}" != "root" ]
then
	echo -n "${BLUE}Please login by root account!${NORMAL}"
	echo "${RED}Failed.${NORMAL}"
	exit 1
fi

