The following HOWTO introduces the building of UCI (Unified Configuration Interface) on Ubuntu.
- Some extra package are required:
sudo apt-get install cmake lua5.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 - Please follow the next steps to build libubox:
mkdir build
cd build
cmake ..
make ubox - 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 - Get UCI source from git:
git clone git://nbd.name/uci.git uci
cd uci - Please follow the next steps to build uci:
mkdir build
cd build
cmake ..
make uci cli - 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 - 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
在centos 6.4 上试验过,uci 命令 找不到动态库,将动态库拷贝到 /lib 下面!!!!