ubuntu安装UCI

以下安装教程在ubuntu 10.04 和 ubuntu 16.04 上测试通过。

##准备环境
###安装cmake

sudo apt-get install cmake

###安装依赖库libubox
克隆libubox源码

git clone http://git.nbd.name/luci2/libubox.git libubox.git
cd libubox.git

编译

cmake -DBUILD_LUA=off

安装

sudo make install

##安装UCI
克隆UCI源码

git clone https://git.openwrt.org/project/uci.git uci.git
cd uci.git

编译

cmake -DBUILD_LUA=off

安装

sudo make install

添加依赖库路径
编辑**/etc/ld.so.conf文件,在最后一行添加上"/usr/local/lib"**

test@test-desktop:~/uci.git$ cat /etc/ld.so.conf
include /etc/ld.so.conf.d/*.conf
/usr/local/lib

执行ldconfig命令使依赖路径生效

sudo ldconfig

完成上述步骤后可以敲入uci命令获得以下结果表示uci安装成功

test@test-desktop:/usr/local/lib$ uci
Usage: uci [<options>] <command> [<arguments>]

Commands:
	batch
	export     [<config>]
	import     [<config>]
	changes    [<config>]
	commit     [<config>]
	add        <config> <section-type>
	add_list   <config>.<section>.<option>=<string>
	del_list   <config>.<section>.<option>=<string>
	show       [<config>[.<section>[.<option>]]]
	get        <config>.<section>[.<option>]
	set        <config>.<section>[.<option>]=<value>
	delete     <config>[.<section>[[.<option>][=<id>]]]
	rename     <config>.<section>[.<option>]=<name>
	revert     <config>[.<section>[.<option>]]
	reorder    <config>.<section>=<position>

Options:
	-c <path>  set the search path for config files (default: /etc/config)
	-d <str>   set the delimiter for list values in uci show
	-f <file>  use <file> as input instead of stdin
	-m         when importing, merge data into an existing package
	-n         name unnamed sections on export (default)
	-N         don't name unnamed sections
	-p <path>  add a search path for config change files
	-P <path>  add a search path for config change files and use as default
	-q         quiet mode (don't print error messages)
	-s         force strict mode (stop on parser errors, default)
	-S         disable strict mode
	-X         do not use extended syntax on 'show'

附:UCI默认加载配置文件的默认路径是在/etc/config当中,可以通过修改UCI源码的’uci.h’当中的宏UCI_CONFDIR来自定义路径

#define UCI_CONFDIR "/etc/config" 

修改后需要重新编译安装才能生效。

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值