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






7 comments:

waveacme said...

Thanks, it's helpful.

Anonymous said...

Thanks !

Anonymous said...

Thanks a lot

Anonymous said...

bash command should be
cat > test/test << EOF
config 'test' 'abc'
option 'test_var' 'value'
EOF

Leo Hung said...

thank you , it's very useful ! test with ubuntu 14.04 LTS

Xue Liu said...

Thanks. It is very good.

you may need sudo apt-get install libjson0 libjson0-dev in Ubuntu 16.04

viswanath said...

AWS Training in Bangalore - Live Online & Classroom
myTectra Amazon Web Services (AWS) certification training helps you to gain real time hands on experience on AWS. myTectra offers AWS training in Bangalore using classroom and AWS Online Training globally. AWS Training at myTectra delivered by the experienced professional who has atleast 4 years of relavent AWS experince and overall 8-15 years of IT experience. myTectra Offers AWS Training since 2013 and retained the positions of Top AWS Training Company in Bangalore and India.


IOT Training in Bangalore - Live Online & Classroom
IOT Training course observes iot as the platform for networking of different devices on the internet and their inter related communication. Reading data through the sensors and processing it with applications sitting in the cloud and thereafter passing the processed data to generate different kind of output is the motive of the complete curricula. Students are made to understand the type of input devices and communications among the devices in a wireless media.

Post a Comment

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