2 ############################################################
4 # author: CottonCandyOwner(CottonCandyOwner@126.com)
6 ############################################################
7 # Copyright (C) 2022- Free Software Foundation, Inc.
8 # This configure script is free software; the Free Software
9 # Foundation gives unlimited permission to copy, distribute
11 ############################################################
13 # shlib option program. if this cmd is used for set global
14 # paramters, use 'source shlibopt' instead of single shlibopt.
15 ############################################################
19 # @ create shlibinst, shliblist, shlibattr, shlibfunc as a ln file.
28 ##############################
29 # section: public comment info
30 ##############################
35 ##############################
36 # section: variable define
37 ##############################
42 ##############################
43 # section: private function
44 ##############################
49 ##############################
50 # section: public function
51 ##############################
55 syntax: shlibopt [option] <paramter>
56 description: set paramters for shlib using.
59 view the debug info module which is enabled.
61 --debug-on <module-name>
62 --debug-off <module-name>
63 enable/disable debug output for the specified module.
64 syntax of name is <module-name>-<type>. eg: shlibinc-inc.
66 -i dispaly debug enable list.
67 -e <module> enable debug string output of a specified module.
68 -d <module> disable debug string output of a specified module.
71 -a <path> append path to shlib path.
72 -c <path> clear the path in system. zero or none paramter delete
73 the latest path in shlib path.
75 -l [shlib] list shlib files in include path.
76 -i <file> install file to shlib path.
77 -u <file> uninstall file from shlib path.
79 -b init shlib on system boot.
80 -s <user> init shlib on session init.
81 -p init shlib on program start.
83 -v print shlib version info.
84 -h helper information.
87 [[ ! -v SHLIB_DBGOUT_OPT
]] && declare -g -x SHLIB_DBGOUT_OPT
=":"
90 # fsyntax: dbgflag_info
91 # fdesc: display module info in SHLIB_DBGOUT_OPT.
95 echo "$SHLIB_DBGOUT_OPT" |
tr -s ':' '
100 # fsyntax: dbgflag_set <module-name>
101 # fdesc: set module enable in SHLIB_DBGOUT_OPT.
105 if [[ ! "$SHLIB_DBGOUT_OPT" =~
"$1" ]]; then
106 [[ ! -v SHLIB_DBGOUT_OPT
]] && declare -g -x SHLIB_DBGOUT_OPT
107 SHLIB_DBGOUT_OPT
+="$1:"
108 echo "SHLIB_DBGOUT_OPT=$SHLIB_DBGOUT_OPT"
113 # fsyntax: dbgflag_unset <module-name>
114 # fdesc: unset module in SHLIB_DBGOUT_OPT.
118 if [[ "$SHLIB_DBGOUT_OPT" =~
"$1" ]]; then
119 SHLIB_DBGOUT_OPT
=${SHLIB_DBGOUT_OPT//$1:/}
135 # init_dbglogout 2 shlibopt 20000
140 #while getopts :xie:d:ga:c:li:u:bspvh opt; do
141 while [[ "$1" != "" ]]; do
142 if [[ ${1:0:1} != - ]]; then
147 if [[ ${1:1:1} == - ]]; then
169 echo "OPTIND=$OPTIND"
170 echo "optstr=$optstr"
180 get_shlib_path |
while read line
; do
181 echo -ne "\033[32m[$line]\n\033[0m"
182 find $line/* |
grep -E "\.shlib\$"
186 tmp
=( $
(get_shlib_path
) )
190 tmp
=( $
(get_shlib_path
) )
196 if [[ -z "$(cat $ROOTFS/etc/bash.bashrc | grep -E '. shlibinc')" ]]; then
197 echo ". shlibinc" > $ROOTFS/etc
/bash.bashrc
201 if [[ -z "$(cat $ROOTFS/home/$user/.bashrc | grep -E '. shlibinc')" ]]; then
202 echo ". shlibinc" > $ROOTFS/home
/$user/.bashrc
210 info
"shlib v$SHLIB_VERSION"
213 info
"$shlibopt_usage"
216 warn
"does not use '-$opt' opt.\n"
227 ##############################
229 ##############################