more configure script work

parent 62db77bf
......@@ -7,73 +7,3 @@ ERR_MSG=""
export OLDPATH=$PATH
export PATH="$PATH:/sbin:/usr/sbin:/usr/local/sbin"
source $PWD/.configure/color
section_message () {
case $1 in
Required )
echo -e "\n${RED}Required ${WHITE}$2:\n"
;;
Optional )
echo -e "\n${MAGENTA}Optional ${WHITE}$2:\n"
;;
esac
tput sgr0
}
start_message () {
echo -e "\n${GREEN}BashStyle-NG${YELLOW} v${xVERSION} ${CYAN}${CODENAME}"
tput sgr0
}
ok_message () {
if [[ $2 != "" ]]; then
echo -e "${WHITE}\t+ ${CYAN}$1${MAGENTA} >${GREEN} O.K.${SILVER} ( $2 )"
else echo -e "${WHITE}\t+ ${CYAN}$1${MAGENTA} >${GREEN} O.K."
fi
tput sgr0
}
fail_message () {
if [[ $1 == "m" ]]; then
echo -e "${WHITE}\t+ ${CYAN}$2${MAGENTA} >${RED} !MISSING!"
elif [[ $1 == "o" ]]; then
echo -e "${WHITE}\t+ ${CYAN}$2${MAGENTA} >${RED} !OLDER THAN $3!"
fi
tput sgr0
}
warn_message () {
echo -e "${WHITE}\t+ ${CYAN}$1${MAGENTA} >${YELLOW} Not Available"
tput sgr0
}
maintainer_message () {
echo -e "\n${RED}Maintainer Mode ${WHITE}/ ${GREEN}Disabled Checks\n"
tput sgr0
}
end_message () {
echo -e "\n${YELLOW}Prefix:${WHITE} $PREFIX\n"
if [[ $ERR_MSG != "" ]]; then
echo -e "${YELLOW}Notes:\
\n${WHITE}${ERR_MSG}\n"
fi
tput sgr0
}
......@@ -26,7 +26,7 @@ while (( $DONE_COUNTER <= $CHKS_COUNTER )); do
}
check_libs () {
SECTION=$1
CHKS_COUNTER=$(grep -w ${SECTION}[0-9]* .configure/depends | wc -l)
DONE_COUNTER=1
......@@ -37,9 +37,9 @@ while (( $DONE_COUNTER <= $CHKS_COUNTER )); do
DEPENDENCY=$(grep -w ${SECTION}${DONE_COUNTER} .configure/depends | gawk '{print $2}')
VERSION=$(grep -w ${SECTION}${DONE_COUNTER} .configure/depends | gawk '{print $3}')
PC_FILE=$(grep -w ${SECTION}${DONE_COUNTER} .configure/depends | gawk '{print $4}')
pkg-config --exists $PC_FILE &>/dev/null
pkg-config --exists $PC_FILE
EXIST_RETURN=$?
pkg-config --atleast-version=$VERSION $PC_FILE &>/dev/null
pkg-config --atleast-version=$VERSION $PC_FILE
DEP_RETURN=$?
if [[ $EXIST_RETURN != 0 && ! $SECTION == OPT* ]]; then
fail_message m $DEPENDENCY
......@@ -67,7 +67,7 @@ section_message $2 $3
while (( $DONE_COUNTER <= $CHKS_COUNTER )); do
DEPENDENCY=$(grep -w ${SECTION}${DONE_COUNTER} .configure/depends | gawk '{print $2}')
python -c "import $DEPENDENCY" &>/dev/null
python -c "import $DEPENDENCY"
DEP_RETURN=$?
if [[ $DEP_RETURN == 0 ]]; then
ok_message $DEPENDENCY
......
#!/bin/bash
GREEN="\033[01;32m"
RED="\033[01;31m"
WHITE="\033[01;37m"
GREEN="\033[01;32m"
YELLOW="\033[01;33m"
CYAN="\033[01;36m"
BLUE="\033[01;34m"
MAGENTA="\033[01;35m"
CYAN="\033[01;36m"
WHITE="\033[01;37m"
if [[ $TERM != *xterm* ]]; then
SMOOTHBLUE=$BLUE
......
#!/bin/bash
section_message () {
case $1 in
Required )
echo -e "\n${RED}Required ${WHITE}$2:\n"
;;
Optional )
echo -e "\n${MAGENTA}Optional ${WHITE}$2:\n"
;;
esac
tput sgr0
}
start_message () {
echo -e "\n${GREEN}BashStyle-NG${YELLOW} v${xVERSION} ${CYAN}${CODENAME}"
tput sgr0
}
ok_message () {
if [[ $2 != "" ]]; then
echo -e "${WHITE}\t+ ${CYAN}$1${MAGENTA} >${GREEN} O.K.${SILVER} ( $2 )"
else echo -e "${WHITE}\t+ ${CYAN}$1${MAGENTA} >${GREEN} O.K."
fi
tput sgr0
}
fail_message () {
if [[ $1 == "m" ]]; then
echo -e "${WHITE}\t+ ${CYAN}$2${MAGENTA} >${RED} !MISSING!"
elif [[ $1 == "o" ]]; then
echo -e "${WHITE}\t+ ${CYAN}$2${MAGENTA} >${RED} !OLDER THAN $3!"
fi
tput sgr0
}
warn_message () {
echo -e "${WHITE}\t+ ${CYAN}$1${MAGENTA} >${YELLOW} Not Available"
tput sgr0
}
maintainer_message () {
echo -e "\n${RED}Maintainer Mode ${WHITE}/ ${GREEN}Disabled Checks\n"
tput sgr0
}
end_message () {
echo -e "\n${YELLOW}Prefix:${WHITE} $PREFIX\n"
if [[ $ERR_MSG != "" ]]; then
echo -e "${YELLOW}Notes:\
\n${WHITE}${ERR_MSG}\n"
fi
tput sgr0
}
......@@ -2,6 +2,11 @@
shopt -s extglob
source $PWD/.configure/base
source $PWD/.configure/color
source $PWD/.configure/messages
source $PWD/.configure/help
source $PWD/.configure/checks
source $PWD/.configure/substitute
case $1 in
......@@ -22,23 +27,17 @@ case $1 in
maintainer_message
# load modules
source $PWD/.configure/check_deps
source $PWD/.configure/substitute
# perform actions
copy_in_files
substitute_values
# reset $PATH
export PATH="$OLDPATH"
end_message
;;
*help )
source $PWD/.configure/help
display_help
;;
......@@ -56,24 +55,19 @@ case $1 in
;;
esac
# load modules
source $PWD/.configure/check_deps
source $PWD/.configure/substitute
# perform actions
start_message
check_apps APP Required Applications
check_apps OPT_APP Optional Applications
check_apps OPT_SBINAPP Optional Superuser-Applications
check_libs LIB Required Libraries
check_pymods PYMOD Required Python-Modules
# adjust code
check_apps APP Required Applications
check_apps OPT_APP Optional Applications
check_apps OPT_SBINAPP Optional Superuser-Applications
check_libs LIB Required Libraries
check_pymods PYMOD Required Python-Modules
copy_in_files
substitute_values
# reset $PATH
export PATH="$OLDPATH"
end_message
;;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment