configure 4.3.2

- configure results: don't store unused stuff
- configure results: minor fixups
- coding style update  instead of
- coding style update [[ x = true ]] instead of [[ x = true ]]
- coding style update indention fixes
- new variable: APP_LANGUAGES
- configure results: use APP_LANGUAGES to auto-generate list of locale directories
parent 5a0cee96
......@@ -12,9 +12,9 @@
APP_NAME="BashStyle-NG"
APP_VERSION=8.99
APP_CODENAME="Hotride"
APP_LANGUAGES="de"
CFG_VERSION="4.3.1"
ERR_MSG=""
CFG_VERSION="4.3.2"
if [[ -d "/usr/lib/girepository-1.0/" ]]; then
export GIRPATH="/usr/lib/girepository-1.0/"
......@@ -32,23 +32,25 @@ PCDIR="${PREFIX}/share/pkgconfig/"
DATADIR="${PREFIX}/share/"
PROFILEDIR="/etc/"
for lang in ${APP_LANGUAGES[@]}; do
LC_MESSAGES_DIRS="${LC_MESSAGES_DIRS} ${lang}/LC_MESSAGES/"
done
export OLDPATH=${PATH}
export PATH="${PATH}:/sbin:/usr/sbin:/usr/local/sbin"
export_result ()
{
echo -e "MODE=\"${MODE}\"\
\nPREFIX=\"${PREFIX}\"\
echo -e "PREFIX=\"${PREFIX}\"\
\nDATADIR=\"${DATADIR}/bashstyle-ng/\"\
\nDATADIR_LIST=( ui rc/{,functions,internal,settings,styles} termcap/{bar,body} vim/{,colors} )\
\nDATADIR_LIST=( ui rc/{functions,internal,settings,styles} termcap/{bar,body} vim/{colors} )\
\nPROFILEDIR=\"${PROFILEDIR}/\"\
\nBINDIR=\"${BINDIR}\"\
\nLOCALEDIR=\"${DATADIR}/locale/\"\
\nLOCALEDIR_LIST=( de/LC_MESSAGES/ )\
\nLOCALEDIR_LIST=( ${LC_MESSAGES_DIRS} )\
\nICONDIR=\"${DATADIR}/icons/hicolor/32x32/apps/\"\
\nPCDIR=\"${PCDIR}/\"\
\nBASHFILE=\"${BASHFILE}\"\
\nMISSING=( ${MISSING} )" | sed -e 's,\/\/,\/,g' >> ${PWD}/.configure/results
\nBASHFILE=\"${BASHFILE}\"" | sed -e 's,\/\/,\/,g' >> ${PWD}/.configure/results
}
......@@ -9,7 +9,7 @@
# #
#########################################################
trap "kill -s TERM $TOP_PID" TERM
trap "kill -s TERM ${TOP_PID}" TERM
export TOP_PID=$$
check () {
......@@ -36,148 +36,148 @@ check_helper () {
check_apps () {
OPT=$1
shift
for ARG in "$@"; do
APP="${ARG/:*}"
DESC="${ARG/*:}"
DEP_RETURN=$(check $APP)
if [[ $DEP_RETURN == *found* ]]; then
ok_message $APP
elif [[ $DEP_RETURN != *found* && $OPT == true ]]; then
warn_message $APP "$DESC"
MISSING+=" $APP"
else fail_message m $APP
kill -s TERM $TOP_PID
fi
done
OPT=${1}
shift
for ARG in "${@}"; do
APP="${ARG/:*}"
DESC="${ARG/*:}"
DEP_RETURN=$(check ${APP})
if [[ ${DEP_RETURN} == *found* ]]; then
ok_message ${APP}
elif [[ ${DEP_RETURN} != *found* && ${OPT} == true ]]; then
warn_message ${APP} "${DESC}"
MISSING+=" ${APP}"
else fail_message m ${APP}
kill -s TERM ${TOP_PID}
fi
done
}
check_libs () {
OPT=$1
shift
OPT=${1}
shift
for ARG in "$@"; do
for ARG in "${@}"; do
LIB=$(gawk -F \: '{print $1}' <(echo $ARG))
VERSION=$(gawk -F \: '{print $2}' <(echo $ARG))
PC_FILE=$(gawk -F \: '{print $3}' <(echo $ARG))
DESC=$(gawk -F \: '{print $4}' <(echo $ARG))
LIB=$(gawk -F \: '{print $1}' <(echo ${ARG}))
VERSION=$(gawk -F \: '{print $2}' <(echo ${ARG}))
PC_FILE=$(gawk -F \: '{print $3}' <(echo ${ARG}))
DESC=$(gawk -F \: '{print $4}' <(echo ${ARG}))
pkg-config --exists $PC_FILE
EXIST_RETURN=$?
pkg-config --exists ${PC_FILE}
EXIST_RETURN=$?
pkg-config --atleast-version=$VERSION $PC_FILE
DEP_RETURN=$?
pkg-config --atleast-version=${VERSION} ${PC_FILE}
DEP_RETURN=$?
if [[ $EXIST_RETURN != 0 && ! $OPT == "true" ]]; then
fail_message m $LIB
kill -s TERM $TOP_PID
elif [[ $DEP_RETURN == 0 ]]; then
ok_message $LIB ${VERSION}+
elif [[ $EXIST_RETURN != 0 && $OPT == "true" ]]; then
warn_message $LIB "$DESC"
MISSING+=" $LIB"
else fail_message o $LIB $VERSION
kill -s TERM $TOP_PID
fi
if [[ ${EXIST_RETURN} != 0 && ! ${OPT} == true ]]; then
fail_message m $LIB
kill -s TERM ${TOP_PID}
elif [[ ${DEP_RETURN} == 0 ]]; then
ok_message $LIB ${VERSION}+
elif [[ ${EXIST_RETURN} != 0 && ${OPT} == true ]]; then
warn_message $LIB "${DESC}"
MISSING+=" $LIB"
else fail_message o $LIB ${VERSION}
kill -s TERM ${TOP_PID}
fi
done
done
}
check_gir () {
OPT=$1
shift
for ARG in "$@"; do
GIR=$(gawk -F \: '{print $1}' <(echo $ARG))
VERSION=$(gawk -F \: '{print $2}' <(echo $ARG))
TYPE_LIB=$(gawk -F \: '{print $3}' <(echo $ARG))
DESC=$(gawk -F \: '{print $4}' <(echo $ARG))
FILE=$(basename ${GIRPATH}/$TYPE_LIB* .typelib 2>/dev/null)
if [[ $FILE != ".typelib" ]]; then
EXIST_RETURN=0
XVER=$(gawk -F \- '{print $2}' <(echo $FILE))
DEP_RETURN=$(echo "$XVER >= $VERSION" | bc)
fi
if [[ $EXIST_RETURN != 0 && ! $OPT == "true" ]]; then
fail_message m $GIR
kill -s TERM $TOP_PID
elif [[ $DEP_RETURN == 1 ]]; then
ok_message $GIR ${VERSION}+
elif [[ $EXIST_RETURN != 0 && $OPT == "true" ]]; then
warn_message $GIR "$DESC"
MISSING+=" $GIR"
else fail_message o $GIR $VERSION
kill -s TERM $TOP_PID
fi
OPT=${1}
shift
for ARG in "${@}"; do
GIR=$(gawk -F \: '{print $1}' <(echo ${ARG}))
VERSION=$(gawk -F \: '{print $2}' <(echo ${ARG}))
TYPE_LIB=$(gawk -F \: '{print $3}' <(echo ${ARG}))
DESC=$(gawk -F \: '{print $4}' <(echo ${ARG}))
FILE=$(basename ${GIRPATH}/$TYPE_LIB* .typelib 2>/dev/null)
if [[ $FILE != ".typelib" ]]; then
EXIST_RETURN=0
XVER=$(gawk -F \- '{print $2}' <(echo $FILE))
DEP_RETURN=$(echo "$XVER >= ${VERSION}" | bc)
fi
if [[ ${EXIST_RETURN} != 0 && ! ${OPT} == true ]]; then
fail_message m ${GIR}
kill -s TERM ${TOP_PID}
elif [[ ${DEP_RETURN} == 1 ]]; then
ok_message ${GIR} ${VERSION}+
elif [[ ${EXIST_RETURN} != 0 && ${OPT} == true ]]; then
warn_message ${GIR} "${DESC}"
MISSING+=" ${GIR}"
else fail_message o ${GIR} ${VERSION}
kill -s TERM ${TOP_PID}
fi
done
done
}
check_python () {
section_message PY
if [[ ! -x $PYTHON ]]; then
fail_message p
kill -s TERM $TOP_PID
else
PYMINVER=270
PYMAXVER=350
PYVER=$($PYTHON --version 2>&1 | gawk '{ gsub(/\./,""); gsub(/\+/,""); gsub(/rc.*/,""); print $2 }')
if [[ $PYVER -lt $PYMINVER ]]; then
fail_message p-
kill -s TERM $TOP_PID
elif [[ $PYVER -gt $PYMAXVER ]]; then
fail_message p+
kill -s TERM $TOP_PID
section_message PY
if [[ ! -x ${PYTHON} ]]; then
fail_message p
kill -s TERM ${TOP_PID}
else
ok_message Python
PYMINVER=270
PYMAXVER=350
PYVER=$(${PYTHON} --version 2>&1 | gawk '{ gsub(/\./,""); gsub(/\+/,""); gsub(/rc.*/,""); print $2 }')
if [[ ${PYVER} -lt ${PYMINVER} ]]; then
fail_message p-
kill -s TERM ${TOP_PID}
elif [[ ${PYVER} -gt ${PYMAXVER} ]]; then
fail_message p+
kill -s TERM ${TOP_PID}
else
ok_message Python
fi
fi
fi
}
check_pymods () {
OPT=$1
shift
for ARG in "$@"; do
MOD=$(gawk -F \: '{print $1}' <(echo $ARG))
SMOD=$(gawk -F \: '{print $2}' <(echo $ARG))
DESC=$(gawk -F \: '{print $3}' <(echo $ARG))
if [[ $SMOD != "" ]]; then
DEP="$SMOD ($MOD)"
${PYTHON} -c "from $MOD import $SMOD" 2>/dev/null
else
DEP="$MOD"
${PYTHON} -c "import imp
imp.find_module('$MOD')" 2>/dev/null
fi
OPT=${1}
shift
for ARG in "${@}"; do
MOD=$(gawk -F \: '{print $1}' <(echo ${ARG}))
SMOD=$(gawk -F \: '{print $2}' <(echo ${ARG}))
DESC=$(gawk -F \: '{print $3}' <(echo ${ARG}))
if [[ ${SMOD} ]]; then
DEP="${SMOD} (${MOD})"
${PYTHON} -c "from ${MOD} import ${SMOD}" 2>/dev/null
else
DEP="${MOD}"
${PYTHON} -c "import imp
imp.find_module('${MOD}')" 2>/dev/null
fi
DEP_RETURN=$?
if [[ ${DEP_RETURN} == 0 ]]; then
ok_message "${DEP}"
elif [[ ${DEP_RETURN} != 0 && ${OPT} == true ]]; then
warn_message ${DEP} "${DESC}"
MISSING+=" ${DEP}"
else fail_message m ${DEP}
kill -s TERM ${TOP_PID}
fi
DEP_RETURN=$?
if [[ $DEP_RETURN == 0 ]]; then
ok_message "$DEP"
elif [[ $DEP_RETURN != 0 && $OPT == "true" ]]; then
warn_message $DEP "${DESC}"
MISSING+=" $DEP"
else fail_message m $DEP
kill -s TERM $TOP_PID
fi
done
done
}
......@@ -17,11 +17,11 @@ MAGENTA="\033[01;35m"
CYAN="\033[01;36m"
WHITE="\033[01;37m"
if [[ $TERM != *xterm* ]]; then
SMOOTHBLUE=$BLUE
ORANGE=$YELLOW
CREAM=$MAGENTA
SILVER=$WHITE
if [[ ${TERM} != *xterm* ]]; then
SMOOTHBLUE=${BLUE}
ORANGE=${YELLOW}
CREAM=${MAGENTA}
SILVER=${WHITE}
else
SMOOTHBLUE="\033[01;38;5;111m"
ORANGE="\033[01;38;5;714m"
......
......@@ -11,8 +11,8 @@
section_message () {
if [[ ${QUIET} != "true" ]]; then
case $1 in
if [[ ${QUIET} != true ]]; then
case ${1} in
APP ) echo -e "\n${RED}< Required ${WHITE}Applications" ;;
OPT_APP ) echo -e "\n${MAGENTA}< Optional ${WHITE}Applications" ;;
SBINAPP ) echo -e "\n${RED}< Required ${WHITE}SuperUser Applications" ;;
......@@ -39,10 +39,10 @@ start_message () {
ok_message () {
if [[ ${QUIET} != "true" ]]; then
if [[ $2 != "" ]]; then
echo -e "${WHITE}\t+ ${CYAN}$1${MAGENTA} >${GREEN} OK${SILVER} ( $2 )"
else echo -e "${WHITE}\t+ ${CYAN}$1${MAGENTA} >${GREEN} OK"
if [[ ${QUIET} != true ]]; then
if [[ ${2} != "" ]]; then
echo -e "${WHITE}\t+ ${CYAN}${1}${MAGENTA} >${GREEN} OK${SILVER} ( ${2} )"
else echo -e "${WHITE}\t+ ${CYAN}${1}${MAGENTA} >${GREEN} OK"
fi
fi
tput sgr0
......@@ -50,9 +50,9 @@ ok_message () {
fail_message () {
case $1 in
m ) echo -e "${WHITE}\t+ ${CYAN}$2${MAGENTA} >${RED} !MISSING!" ;;
o ) echo -e "${WHITE}\t+ ${CYAN}$2${MAGENTA} >${RED} !OLDER THAN $3!" ;;
case ${1} in
m ) echo -e "${WHITE}\t+ ${CYAN}${2}${MAGENTA} >${RED} !MISSING!" ;;
o ) echo -e "${WHITE}\t+ ${CYAN}${2}${MAGENTA} >${RED} !OLDER THAN $3!" ;;
p ) echo -e "${WHITE}\t+ ${CYAN}Python ($PYTHON)${MAGENTA} >${RED} !MISSING!" ;;
p- ) echo -e "${WHITE}\t+ ${CYAN}Python ($PYTHON)${MAGENTA} >${RED} !OLDER THAN 2.7.0!" ;;
p+ ) echo -e "${WHITE}\t+ ${CYAN}Python ($PYTHON)${MAGENTA} >${RED} !IS 3.5 OR ABOVE!" ;;
......@@ -63,8 +63,8 @@ fail_message () {
warn_message () {
echo -e "${WHITE}\t+ ${CYAN}$1${MAGENTA} >${YELLOW} Not Available\
\n\t > ${WHITE}$2"
echo -e "${WHITE}\t+ ${CYAN}${1}${MAGENTA} >${YELLOW} Not Available\
\n\t > ${WHITE}${2}"
tput sgr0
}
......@@ -99,6 +99,7 @@ help_message () {
echo -e "\n${GREEN}${APP_NAME} ${MAGENTA}v${APP_VERSION}${WHITE} / ${YELLOW}(Configure ${CFG_VERSION}) ${CYAN}help
\n${WHITE}Options:"
echo -e "${ORANGE}--help${WHITE} *|${GREEN} Display this help message\
\n${ORANGE}--mode=<mode>${WHITE} *|${GREEN} user (do checks) or maintainer (skip checks)\
\n${ORANGE}--prefix=<prefix>${WHITE} *|${GREEN} Change installation prefix (default: /usr)\
......@@ -111,7 +112,7 @@ help_message () {
\n${ORANGE}--python=<python>${WHITE} *|${GREEN} Make BashStyle-NG use a specific python (default: /usr/bin/python)\
\n${ORANGE}--no-postinstall${WHITE} *|${GREEN} Disable post-installation tasks (for package-maintainers)\
\n${ORANGE}--quiet${WHITE} *|${GREEN} Only display warnings, failures and results\
\n${ORANGE}--bashrc=<bashrc>${WHITE} *|${GREEN} Path to system bashrc (default: /etc/bashrc or /etc/bash.bashrc)"| column -t -s \*
\n${ORANGE}--bashrc=<bashrc>${WHITE} *|${GREEN} Path to system bashrc (default: /etc/bashrc or /etc/bash.bashrc)" | column -t -s \*
tput sgr0
}
......@@ -21,11 +21,11 @@ copy_in_files () {
substitute_values () {
sed -e "s>@VERSION@>$APP_VERSION>g" \
-e "s>@PREFIX@>$PREFIX>g" \
-e "s>@DATADIR@>$DATADIR>g" \
-e "s>@PYTHON@>$PYTHON>g" \
-e "s>@PROFILEDIR@>$PROFILEDIR>g" -i ${IN_FILES[@]}
sed -e "s>@VERSION@>${APP_VERSION}>g" \
-e "s>@PREFIX@>${PREFIX}>g" \
-e "s>@DATADIR@>${DATADIR}>g" \
-e "s>@PYTHON@>${PYTHON}>g" \
-e "s>@PROFILEDIR@>${PROFILEDIR}>g" -i ${IN_FILES[@]}
sed -e "s>//>/>g" -i ${IN_FILES[@]}
}
......@@ -21,7 +21,7 @@ rm -f ${PWD}/.configure/results
xcount=0
while [[ ${xcount} -lt $# ]]; do
case $1 in
case ${1} in
--mode=* ) MODE="${1/*=}" ;;
--prefix=* ) PREFIX="${1/*=}" ;;
--pcdir=* ) PCDIR="${1/*=}" ;;
......@@ -38,11 +38,11 @@ while [[ ${xcount} -lt $# ]]; do
${PWD}/.configure/results ;;
esac
shift
xcount=$(($xcount+1))
xcount=$((${xcount}+1))
done
unset xcount
if [[ ! $BASHFILE ]]; then
if [[ ! ${BASHFILE} ]]; then
BASHFILE_AUTO=true
if [[ -e /etc/bash.bashrc ]]; then
BASHFILE=/etc/bash.bashrc
......
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