2013-06-21

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






1 comments:

waveacme said...

Thanks, it's helpful.

Post a Comment

 
Design by Free WordPress Themes | Bloggerized by Lasantha - Premium Blogger Themes | Top WordPress Themes