Update recipes
[scm/bb/meta-tizen.git] / recipes-tizen / net-config / net-config.inc
1 DESCRIPTION = "TIZEN Network Configuration Module"
2 HOMEPAGE = "http://nohomepage.org"
3 SECTION = "System/Network"
4 LICENSE = "Apache-2.0"
5
6 SRC_URI = ""
7
8 S = "${WORKDIR}/git"
9
10 inherit autotools-brokensep
11
12 BBCLASSEXTEND = ""
13 PROVIDES = ""
14
15 #PROVIDES by net-config
16
17
18 RDEPENDS = ""
19 #RDEPENDS of net-config (${PN})
20 RDEPENDS_${PN} += "systemd"
21 RDEPENDS_${PN} += "vconf"
22
23
24 DEPENDS = ""
25 #DEPENDS of net-config
26 DEPENDS += "libwifi-direct"
27 inherit tizen_cmake
28 DEPENDS += "syspopup"
29 inherit pkgconfig
30 DEPENDS += "dlog"
31 DEPENDS += "glib-2.0"
32 DEPENDS += "systemd"
33 DEPENDS += "libtapi"
34 DEPENDS += "vconf"
35 DEPENDS += "dbus-glib"
36
37 do_prep() {
38  cd ${S}
39  chmod -Rf a+rX,u+w,g-w,o-w ${S}
40  #setup -q
41  cp ${S}/packaging/net-config.manifest .
42  
43  
44  
45 }
46 do_patch_append() {
47     bb.build.exec_func('do_prep', d)
48 }
49
50 do_configure() {
51 }
52
53 do_compile() {
54  cd ${S}
55  LANG=C
56  export LANG
57  unset DISPLAY
58  LD_AS_NEEDED=1; export LD_AS_NEEDED ;
59  
60  
61    cmake \
62          -DCMAKE_VERBOSE_MAKEFILE=ON \
63          -DCMAKE_INSTALL_PREFIX:PATH=${prefix} \
64          -DCMAKE_INSTALL_LIBDIR:PATH=${prefix}/lib \
65          -DINCLUDE_INSTALL_DIR:PATH=${prefix}/include \
66          -DLIB_INSTALL_DIR:PATH=${prefix}/lib \
67          -DSYSCONF_INSTALL_DIR:PATH=${sysconfdir} \
68          -DSHARE_INSTALL_PREFIX:PATH=${prefix}/share \
69          -DCMAKE_SKIP_RPATH:BOOL=ON \
70          -DBUILD_SHARED_LIBS:BOOL=ON \
71          -DCMAKE_TOOLCHAIN_FILE=${WORKDIR}/toolchain.cmake \
72          ${EXTRA_OECMAKE} . -DCMAKE_INSTALL_PREFIX=${prefix}
73  
74  make -j16
75  
76  
77  
78  
79 }
80
81 do_install() {
82  export RPM_BUILD_ROOT=${D}
83  cd ${S}
84  LANG=C
85  export LANG
86  unset DISPLAY
87  rm -rf ${D}
88  mkdir -p ${D}
89  
90  
91    oe_runmake \
92          DESTDIR=${D} \
93          INSTALL_ROOT=${D} \
94          BINDIR=${prefix}/bin \
95    install  
96    rm -f ${D}${infodir}/dir 
97    find ${D} -regex ".*\.la$" | xargs rm -f -- 
98    find ${D} -regex ".*\.a$" | xargs rm -f --
99  
100  mkdir -p ${D}${prefix}/share/dbus-1/system-services
101  cp resources/usr/share/dbus-1/services/net.netconfig.service ${D}${prefix}/share/dbus-1/system-services/net.netconfig.service
102  mkdir -p ${D}${sysconfdir}/dbus-1/system.d
103  cp resources/etc/dbus-1/system.d/net-config.conf ${D}${sysconfdir}/dbus-1/system.d/net-config.conf
104  
105  # Systemd service file
106  mkdir -p ${D}${systemd_unitdir}/system
107  cp resources/usr/lib/systemd/system/net-config.service ${D}${systemd_unitdir}/system/net-config.service
108  mkdir -p ${D}${systemd_unitdir}/system/multi-user.target.wants/
109  ln -s ../net-config.service ${D}${systemd_unitdir}/system/multi-user.target.wants/net-config.service
110  
111  #License
112  mkdir -p ${D}${prefix}/share/license
113  cp LICENSE.APLv2 ${D}${prefix}/share/license/net-config
114  
115  
116 }
117
118 pkg_postinst_${PN}() {
119     #!/bin/sh -e
120
121     vconftool set -t int memory/dnet/state 0 -i
122     vconftool set -t int memory/wifi/state 0 -i
123     vconftool set -t int memory/wifi/transfer_state 0 -i
124     vconftool set -t int memory/wifi/strength 0 -i
125     vconftool set -t int memory/wifi/bgscan_mode 0 -i
126     vconftool set -t int memory/dnet/wifi 0 -i
127     vconftool set -t int memory/dnet/network_config 0 -i
128     vconftool set -t int memory/dnet/status 0 -i
129     vconftool set -t string memory/dnet/ip "" -i
130     vconftool set -t string memory/dnet/proxy "" -i
131     vconftool set -t string memory/wifi/connected_ap_name "" -i
132     vconftool set -t string db/wifi/bssid_address ""
133     #Default Call Statistics
134     vconftool set -t int db/dnet/statistics/cellular/totalsnt "0"
135     vconftool set -t int db/dnet/statistics/cellular/totalrcv "0"
136     vconftool set -t int db/dnet/statistics/cellular/lastsnt "0"
137     vconftool set -t int db/dnet/statistics/cellular/lastrcv "0"
138     vconftool set -t int db/dnet/statistics/wifi/totalsnt "0"
139     vconftool set -t int db/dnet/statistics/wifi/totalrcv "0"
140     vconftool set -t int db/dnet/statistics/wifi/lastsnt "0"
141     vconftool set -t int db/dnet/statistics/wifi/lastrcv "0"
142     vconftool set -t int file/private/wifi/last_power_state "0"
143     systemctl daemon-reload
144     if [ "$1" == "1" ]; then
145         systemctl restart net-config.service
146     fi
147
148 }
149
150 pkg_prerm_${PN}() {
151     #!/bin/sh -e
152
153     if [ "$1" == "0" ]; then
154         systemctl stop net-config.service
155     fi
156
157 }
158
159 pkg_postrm_${PN}() {
160     #!/bin/sh -e
161
162     systemctl daemon-reload
163     if [ "$1" == "1" ]; then
164         systemctl restart net-config.service
165     fi
166
167 }
168
169 PACKAGES = "${PN}-dbg ${PN}-doc ${PN}-locale"
170 PACKAGES += " net-config "
171
172 net-config_files = ""
173 net-config_files += "${prefix}/sbin/*"
174 net-config_files += "${prefix}/share/dbus-1/system-services/*"
175 net-config_files += "${sysconfdir}/dbus-1/system.d/*"
176 net-config_files += "${systemd_unitdir}/system/net-config.service"
177 net-config_files += "${systemd_unitdir}/system/multi-user.target.wants/net-config.service"
178 net-config_files += "${prefix}/share/license/net-config"
179 MANIFESTFILES_${PN} = "net-config.manifest"
180
181 FILES_${PN} = "${net-config_files}"
182
183 PKG_net-config= "net-config"
184
185 require net-config-extraconf.inc
186