Using UCI on Ubuntu

The following HOWTO introduces the building of UCI (Unified Configuration Interface) on Ubuntu.

  1. Some extra package are required:

    sudo apt-get install cmake lua5.2

  2. The libubox library is required. It should to compiled from source. To do this, first you have to get the source from git:  

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


  3. Please follow the next steps to build libubox:

    mkdir build
    cd build
    cmake ..
    make ubox


  4. Install libubox:

    sudo mkdir -p /usr/local/include/libubox
    sudo cp ../*.h /usr/local/include/libubox
    sudo cp libubox.so /usr/local/lib
    sudo ldconfig


  5. Get UCI source from git:

    git clone git://nbd.name/uci.git uci
    cd uci


  6. Please follow the next steps to build uci:

    mkdir build
    cd build
    cmake ..
    make uci cli


  7. Install uci:

    sudo mkdir -p /usr/local/include/uci
    sudo cp ../uci.h ../uci_config.h /usr/local/include/uci
    sudo cp ../uci_blob.h ../ucimap.h /usr/local/include/uci
    sudo cp libuci.so /usr/local/lib
    sudo cp uci /usr/local/bin
    sudo ldconfig


  8. Testing:

    mkdir test
    cat > test/test << EOF
    > config 'test' 'abc'
    > option 'test_var' 'value'
    > EOF


    uci -c `pwd`/test show test
    Output:
    test.abc=test
    test.abc.test_var=value


    uci -c `pwd`/test set test.abc.test_var=foobar
    uci -c `pwd`/test commit test


    uci -c `pwd`/test show test
    Output:
    test.abc=test
    test.abc.test_var=foobar
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值