-Name: net-config
-Summary: TIZEN Network Configuration Module
-Version: 0.1.90_29
-Release: 1
-Group: System/Network
-License: Apache-2.0
-Source0: %{name}-%{version}.tar.gz
-Source1001: net-config.manifest
-
-BuildRequires: cmake
-BuildRequires: pkgconfig(glib-2.0)
-BuildRequires: pkgconfig(dbus-glib-1)
-BuildRequires: pkgconfig(dlog)
-BuildRequires: pkgconfig(vconf)
-BuildRequires: pkgconfig(wifi-direct)
-BuildRequires: pkgconfig(tapi)
-BuildRequires: pkgconfig(syspopup-caller)
-Requires(post): /usr/bin/vconftool
-BuildRequires: pkgconfig(libsystemd-daemon)
-%{?systemd_requires}
+Name: net-config
+Summary: TIZEN Network Configuration service
+Version: 1.1.93
+Release: 2
+Group: System/Network
+License: Apache-2.0
+Source0: %{name}-%{version}.tar.gz
+BuildRequires: pkgconfig(dlog)
+BuildRequires: pkgconfig(tapi)
+BuildRequires: pkgconfig(vconf)
+BuildRequires: pkgconfig(bundle)
+BuildRequires: pkgconfig(gio-2.0)
+BuildRequires: pkgconfig(glib-2.0)
+BuildRequires: pkgconfig(eventsystem)
+BuildRequires: pkgconfig(alarm-service)
+BuildRequires: pkgconfig(syspopup-caller)
+BuildRequires: pkgconfig(capi-system-info)
+BuildRequires: pkgconfig(capi-appfw-application)
+BuildRequires: pkgconfig(capi-network-wifi-direct)
+BuildRequires: pkgconfig(capi-vpnsvc)
+BuildRequires: cmake
+BuildRequires: pkgconfig(sqlite3)
+BuildRequires: pkgconfig(libtzplatform-config)
+Requires: vconf
+Requires: connman
+Requires: systemd
+Requires(post): systemd
+Requires(preun): systemd
+Requires(postun): systemd
+
+%define upgrade_script_path /usr/share/upgrade/scripts
%description
-TIZEN Network Configuration Module
+TIZEN Network Configuration service
%prep
%setup -q
-cp %{SOURCE1001} .
-
%build
-%cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix}
+cmake -DCMAKE_INSTALL_PREFIX=%{_prefix} \
+ -DTIZEN_WLAN_PASSPOINT=1 \
+ -DTIZEN_WLAN_USE_P2P_INTERFACE=1 \
+%if 0%{?model_build_feature_wlan_concurrent_mode}
+ -DWLAN_CONCURRENT_MODE=1 \
+%endif
+%if ! 0%{?model_build_feature_wlan_p2p_disable}
+ -DTIZEN_P2P_ENABLE=1 \
+%endif
+%if ! 0%{?model_build_feature_network_tethering_disable}
+ -DTIZEN_TETHERING_ENABLE=1 \
+%endif
+%if "%{profile}" == "mobile"
+ -DTIZEN_TELEPHONY_ENABLE=1 \
+ -DTIZEN_WLAN_BOARD_SPRD=1 \
+%else
+%if "%{profile}" == "tv"
+ -DTIZEN_TV=1 \
+%endif
+%endif
+%if 0%{?model_build_feature_wlan_wearable} == 1
+ -DTIZEN_WEARABLE=1 \
+ -DTIZEN_CAPTIVE_PORTAL=1 \
+%endif
+ .
make %{?_smp_mflags}
%install
%make_install
-mkdir -p %{buildroot}%{_datadir}/dbus-1/system-services
-cp resources/usr/share/dbus-1/services/net.netconfig.service %{buildroot}%{_datadir}/dbus-1/system-services/net.netconfig.service
-mkdir -p %{buildroot}%{_sysconfdir}/dbus-1/system.d
-cp resources/etc/dbus-1/system.d/net-config.conf %{buildroot}%{_sysconfdir}/dbus-1/system.d/net-config.conf
-mkdir -p %{buildroot}/opt/etc
-cp resources/opt/etc/resolv.conf %{buildroot}/opt/etc/resolv.conf
-
-# Systemd service file
+#Systemd service file
+mkdir -p %{buildroot}%{_libdir}/systemd/system/
+%if "%{?_lib}" == "lib64"
mkdir -p %{buildroot}%{_unitdir}
+%endif
+
+%if "%{profile}" == "tv"
+cp resources/usr/lib/systemd/system/net-config_tv.service %{buildroot}%{_libdir}/systemd/system/net-config.service
+mkdir -p %{buildroot}%{_libdir}/udev/rules.d/
+cp resources/usr/lib/udev/rules.d/99-wifiusb-dev.rules %{buildroot}%{_libdir}/udev/rules.d/99-wifiusb-dev.rules
+%else
+cp resources/usr/lib/systemd/system/net-config.service %{buildroot}%{_libdir}/systemd/system/net-config.service
+%if "%{?_lib}" == "lib64"
cp resources/usr/lib/systemd/system/net-config.service %{buildroot}%{_unitdir}/net-config.service
+%endif
+%endif
+
+mkdir -p %{buildroot}%{_libdir}/systemd/system/multi-user.target.wants/
+ln -s ../net-config.service %{buildroot}%{_libdir}/systemd/system/multi-user.target.wants/net-config.service
+%if "%{?_lib}" == "lib64"
mkdir -p %{buildroot}%{_unitdir}/multi-user.target.wants/
ln -s ../net-config.service %{buildroot}%{_unitdir}/multi-user.target.wants/net-config.service
+%endif
-#License
-mkdir -p %{buildroot}%{_datadir}/license
-cp LICENSE.APLv2 %{buildroot}%{_datadir}/license/net-config
+mkdir -p %{buildroot}%{_datadir}/dbus-1/system-services/
+cp resources/usr/share/dbus-1/system-services/net.netconfig.service %{buildroot}%{_datadir}/dbus-1/system-services/net.netconfig.service
-%post
+mkdir -p %{buildroot}%{_sysconfdir}/
+cp resources/etc/resolv.conf %{buildroot}%{_sysconfdir}/resolv.conf
-vconftool set -t int memory/dnet/state 0 -i
-vconftool set -t int memory/wifi/state 0 -i
-vconftool set -t int memory/wifi/transfer_state 0 -i
-vconftool set -t int memory/wifi/strength 0 -i
-vconftool set -t int memory/wifi/bgscan_mode 0 -i
+#DBus DAC (net-config.manifest enables DBus SMACK)
+mkdir -p %{buildroot}%{_sysconfdir}/dbus-1/system.d
+cp resources/etc/dbus-1/system.d/net-config.conf %{buildroot}%{_sysconfdir}/dbus-1/system.d/net-config.conf
-vconftool set -t int memory/dnet/wifi 0 -i
-vconftool set -t int memory/dnet/network_config 0 -i
-vconftool set -t int memory/dnet/status 0 -i
-vconftool set -t string memory/dnet/ip "" -i
-vconftool set -t string memory/dnet/proxy "" -i
+%if 0%{?model_build_feature_wlan_wearable} == 1
+#softreset scripts
+mkdir -p %{buildroot}/usr/system/RestoreDir/softreset
+cp resources/usr/system/RestoreDir/softreset/network_softreset.sh %{buildroot}/usr/system/RestoreDir/softreset/network_softreset.sh
+%endif
+
+#License
+mkdir -p %{buildroot}%{_datadir}/license
+cp LICENSE %{buildroot}%{_datadir}/license/net-config
-vconftool set -t string memory/wifi/connected_ap_name "" -i
+#OS Upgrade
+mkdir -p %{buildroot}%{upgrade_script_path}
+cp -f scripts/netconfig_upgrade.sh %{buildroot}%{upgrade_script_path}
-vconftool set -t string db/wifi/bssid_address ""
+%post
+chsmack -a 'System::Shared' %{_sysconfdir}/resolv.conf
-#Default Call Statistics
-vconftool set -t int db/dnet/statistics/cellular/totalsnt "0"
-vconftool set -t int db/dnet/statistics/cellular/totalrcv "0"
-vconftool set -t int db/dnet/statistics/cellular/lastsnt "0"
-vconftool set -t int db/dnet/statistics/cellular/lastrcv "0"
-vconftool set -t int db/dnet/statistics/wifi/totalsnt "0"
-vconftool set -t int db/dnet/statistics/wifi/totalrcv "0"
-vconftool set -t int db/dnet/statistics/wifi/lastsnt "0"
-vconftool set -t int db/dnet/statistics/wifi/lastrcv "0"
+#Network logs
+#mkdir -p /opt/usr/data/network
+#chmod 755 /opt/usr/data/network
+#chsmack -a 'System' /opt/usr/data/network
-vconftool set -t int file/private/wifi/last_power_state "0"
+#Add net-config.service to systemd extra default dependency ignore list
+mkdir -p %{_sysconfdir}/systemd/default-extra-dependencies/ignore-units.d/
+ln -sf %{_libdir}/systemd/system/net-config.service %{_sysconfdir}/systemd/default-extra-dependencies/ignore-units.d/
+%if "%{?_lib}" == "lib64"
+ln -sf %{_unitdir}/net-config.service %{_sysconfdir}/systemd/default-extra-dependencies/ignore-units.d/
+%endif
-systemctl daemon-reload
-if [ "$1" == "1" ]; then
- systemctl restart net-config.service
-fi
+#systemctl daemon-reload
+#systemctl restart net-config.service
%preun
-if [ "$1" == "0" ]; then
- systemctl stop net-config.service
-fi
+#systemctl stop net-config.service
%postun
-systemctl daemon-reload
-if [ "$1" == "1" ]; then
- systemctl restart net-config.service
-fi
+#systemctl daemon-reload
+
%files
-%manifest %{name}.manifest
-%{_sbindir}/*
-%attr(644,root,root) /opt/etc/resolv.conf
-%{_datadir}/dbus-1/system-services/*
-%{_sysconfdir}/dbus-1/system.d/*
-%{_unitdir}/net-config.service
-%{_unitdir}/multi-user.target.wants/net-config.service
+%manifest net-config.manifest
+%attr(500,root,root) %{_sbindir}/*
+%attr(644,root,root) %{_sysconfdir}/resolv.conf
+%attr(644,root,root) %{_datadir}/dbus-1/system-services/*
+#DBus DAC
+%attr(644,root,root) %{_sysconfdir}/dbus-1/system.d/*
+%attr(644,root,root) %{_libdir}/systemd/system/net-config.service
+%attr(644,root,root) %{_libdir}/systemd/system/multi-user.target.wants/net-config.service
+%if "%{?_lib}" == "lib64"
+%attr(644,root,root) %{_unitdir}/net-config.service
+%attr(644,root,root) %{_unitdir}/multi-user.target.wants/net-config.service
+%endif
%{_datadir}/license/net-config
+%if "%{profile}" == "tv"
+%attr(644,root,root) %{_libdir}/udev/rules.d/99-wifiusb-dev.rules
+%endif
+%if 0%{?model_build_feature_wlan_wearable} == 1
+%attr(700,root,root) /usr/system/RestoreDir/softreset/network_softreset.sh
+%endif
+%{upgrade_script_path}/netconfig_upgrade.sh
+