-
Notifications
You must be signed in to change notification settings - Fork 0
/
funcs
63 lines (52 loc) · 2.03 KB
/
funcs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/bin/bash
lib_dir=$(dirname "$(readlink -f "${0}")")
CSO_FUNCS_MSG_LOGFILE=''
_die_(){
echo -e "Error: ${*}"
exit 1
}
tblib="${lib_dir}/tblib"
arrsxmllib="${lib_dir}/tbxmalib"
[ -f "${tblib}" ] && source "${tblib}" || _die_ "Missing library file : ${tblib}"
[ -f "${arrsxmllib}" ] && source "${arrsxmllib}" || _die_ "Missing library file : \"${arrsxmllib}\""
unset _die_
ACSO_FUNCS_MSG_LOGFILE=''
ACSO_FUNCS_TMPFIL_TMPL="/tmp/${appname}_%s_$(date '+%w%W')"
# Little hack to try and trick mkcompile_h - they *whould unset when the script completes
hostname(){ echo "nowhere" ; }
whoami() { echo "no-one" ; }
function load_makefile_info(){
#lets keep our main script namespace clean
local kernel_makefile kernel_infopara dots __p __v IFS
[ $# -eq 1 ] && kernel_makefile="${1}" || kernel_makefile="Makefile"
[ ! -f "${kernel_makefile}" ] && exception "useage : load_makefile_info file not found:\"${1}\""
kernel_infopara=$(head -n 6 ${kernel_makefile})
IFS=$'\n'
for line in ${kernel_infopara}; do
[[ "${line}" =~ .*"#".* ]] && continue #skip anything that has a comment in it
IFS="="
read -r __p __v <<< "${line}"
IFS=$'\n'
__v=$(echo "${__v}" | sed -e 's/^[[:space:]]*//')
eval "ACSO_KERNEL_${__p//[[:space:]]}=\"${__v}\""
done
IFS=$OIFS
ACSO_KERNEL_STRING=''
ACSO_KERNEL_STRING_ERROR=$TRUE
[ -n "${ACSO_KERNEL_VERSION}" ] && ACSO_KERNEL_STRING="${ACSO_KERNEL_VERSION}"
if [ -n "${ACSO_KERNEL_STRING}" ] ; then
[ -n "${ACSO_KERNEL_PATCHLEVEL}" ] && ACSO_KERNEL_STRING+=".${ACSO_KERNEL_PATCHLEVEL}"
[ -n "${ACSO_KERNEL_SUBLEVEL}" ] && ACSO_KERNEL_STRING+=".${ACSO_KERNEL_SUBLEVEL}"
[ -n "${ACSO_KERNEL_EXTRAVERSION}" ] && ACSO_KERNEL_STRING+="${ACSO_KERNEL_EXTRAVERSION}"
dots="${ACSO_KERNEL_STRING//[^.]}"
if [ "${#dots}" -eq 2 ]; then
ACSO_KERNEL_STRING_ERROR=$FALSE
ACSO_KERNEL_FULLNAME="linux-${ACSO_KERNEL_STRING}"
ACSO_KERNEL_LOGFILE="../${ACSO_KERNEL_FULLNAME}_Build.log"
else
ACSO_KERNEL_STRING_ERROR=$TRUE
ACSO_KERNEL_FULLNAME=''
ACSO_KERNEL_LOGFILE="../${appname}_log"
fi
fi
}