Add kdbus-switch script and modified service files
authorSangyoon Jang <s89.jang@samsung.com>
Mon, 13 Jan 2014 09:39:32 +0000 (18:39 +0900)
committerGerrit Code Review <gerrit2@localhost>
Mon, 13 Jan 2014 09:54:34 +0000 (18:54 +0900)
Add optional flag --enable-kdbus-for-sbb allowing to compile with or without sbb support
Change-Id: I3e060783b51a6b220c8671bf96c54315842666fc

configure.ac
packaging/com.samsung.dbus.spec
packaging/conf_dbus.tar.gz [new file with mode: 0644]
packaging/conf_kdbus.tar.gz [new file with mode: 0644]
packaging/switch-to-dbus.sh [new file with mode: 0755]
packaging/switch-to-kdbus.sh [new file with mode: 0755]

index dd89f9a..91c092c 100644 (file)
@@ -157,6 +157,7 @@ AC_ARG_ENABLE(userdb-cache, AS_HELP_STRING([--enable-userdb-cache],[build with u
 AC_ARG_ENABLE(launchd, AS_HELP_STRING([--enable-launchd],[build with launchd auto-launch support]),enable_launchd=$enableval,enable_launchd=auto)
 AC_ARG_ENABLE(systemd, AS_HELP_STRING([--enable-systemd],[build with systemd at_console support]),enable_systemd=$enableval,enable_systemd=auto)
 AC_ARG_ENABLE(kdbus-transport, AS_HELP_STRING([--enable-kdbus-transport],[build with kdbus transport support]),enable_kdbus_transport=$enableval,enable_kdbus_transport=no)
+AC_ARG_ENABLE(kdbus-for-sbb, AS_HELP_STRING([--enable-kdbus-for-sbb],[build with kdbus sbb support]),enable_kdbus_for_sbb=$enableval,enable_kdbus_for_sbb=no)
 
 AC_ARG_WITH(init-scripts, AS_HELP_STRING([--with-init-scripts=[redhat]],[Style of init scripts to install]))
 AC_ARG_WITH(session-socket-dir, AS_HELP_STRING([--with-session-socket-dir=[dirname]],[Where to put sockets for the per-login-session message bus]))
@@ -1284,6 +1285,18 @@ fi
 
 AM_CONDITIONAL([ENABLE_KDBUS_TRANSPORT], [test x$enable_kdbus_transport = xyes])
 
+### sbb support
+if test x$enable_kdbus_for_sbb = xyes; then
+    KDBUS_LIBS=
+    #"-lcrypto"
+    #AC_SUBST([KDBUS_LIBS])
+    AC_DEFINE(KDBUS_FOR_SBB,1,[Enable SBB support])
+else
+    KDBUS_LIBS=
+fi
+
+AM_CONDITIONAL([ENABLE_KDBUS_FOR_SBB], [test x$enable_kdbus_for_sbb = xyes])
+
 #### Set up final flags
 LIBDBUS_LIBS="$THREAD_LIBS $NETWORK_libs $KDBUS_LIBS"
 AC_SUBST([LIBDBUS_LIBS])
@@ -1877,7 +1890,8 @@ echo "
         Building XML docs:        ${enable_xml_docs}
         Building cache support:   ${enable_userdb_cache}
         Building launchd support: ${have_launchd}
-       Building kdbus support:   ${enable_kdbus_transport}
+        Building kdbus support:   ${enable_kdbus_transport}
+        Building kdbus for sbb:   ${enable_kdbus_for_sbb}
         Init scripts style:       ${with_init_scripts}
         Abstract socket names:    ${ac_cv_have_abstract_sockets}
         System bus socket:        ${DBUS_SYSTEM_SOCKET}
@@ -1888,8 +1902,8 @@ echo "
         Console auth dir:         ${DBUS_CONSOLE_AUTH_DIR}
         Console owner file:       ${have_console_owner_file}
         Console owner file path:  ${DBUS_CONSOLE_OWNER_FILE}
-       System bus user:          ${DBUS_USER}
-       Session bus services dir: ${EXPANDED_DATADIR}/dbus-1/services
+        System bus user:          ${DBUS_USER}
+        Session bus services dir: ${EXPANDED_DATADIR}/dbus-1/services
         'make check' socket dir:  ${TEST_SOCKET_DIR}
 "
 if test x$have_launchd = xyes; then
index eedc959..f925362 100644 (file)
@@ -8,6 +8,10 @@ Source0:       %{name}-%{version}.tar.gz
 Source2:       dbus-user.socket
 Source3:       dbus-user.service
 Source4:       system.conf
+Source5:       switch-to-dbus.sh
+Source6:       switch-to-kdbus.sh
+Source7:       conf_dbus.tar.gz
+Source8:       conf_kdbus.tar.gz
 BuildRequires:  which
 BuildRequires:  expat-devel
 BuildRequires:  libtool
@@ -43,6 +47,7 @@ Headers and static libraries for D-Bus.
 %build
 ./autogen.sh --enable-abstract-sockets --enable-x11-autolaunch --with-x \
     --enable-kdbus-transport \
+    --enable-kdbus-for-sbb \
     --disable-static \
     --exec-prefix=/ \
     --bindir=%{_bindir} \
@@ -90,6 +95,12 @@ mkdir -p %{buildroot}%{_libdir}/systemd/user
 install -m0644 %{SOURCE2} %{buildroot}%{_libdir}/systemd/user/dbus.socket
 install -m0644 %{SOURCE3} %{buildroot}%{_libdir}/systemd/user/dbus.service
 
+install -m0755 %{SOURCE5} %{buildroot}%{_bindir}/switch-to-dbus.sh
+install -m0755 %{SOURCE6} %{buildroot}%{_bindir}/switch-to-kdbus.sh
+
+tar -xvzf %{SOURCE7} -C %{buildroot}/etc/dbus-1
+tar -xvzf %{SOURCE8} -C %{buildroot}/etc/dbus-1
+
 %post
 mkdir -p /opt/var/lib/dbus
 
@@ -117,6 +128,10 @@ mkdir -p /opt/var/lib/dbus
 %{_libdir}/systemd/user/*
 %dir %{_datadir}/dbus-1
 %{_datadir}/dbus-1/interfaces
+%{_bindir}/switch-to-dbus.sh
+%{_bindir}/switch-to-kdbus.sh
+%{_sysconfdir}/dbus-1/conf_dbus
+%{_sysconfdir}/dbus-1/conf_kdbus
 
 %files libs
 %{_libdir}/libdbus-1.so.3*
diff --git a/packaging/conf_dbus.tar.gz b/packaging/conf_dbus.tar.gz
new file mode 100644 (file)
index 0000000..45ddebc
Binary files /dev/null and b/packaging/conf_dbus.tar.gz differ
diff --git a/packaging/conf_kdbus.tar.gz b/packaging/conf_kdbus.tar.gz
new file mode 100644 (file)
index 0000000..6cdbd2c
Binary files /dev/null and b/packaging/conf_kdbus.tar.gz differ
diff --git a/packaging/switch-to-dbus.sh b/packaging/switch-to-dbus.sh
new file mode 100755 (executable)
index 0000000..8fd5f8e
--- /dev/null
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+CONF_DIR_PATH="/etc/dbus-1/conf_dbus"
+
+echo "copying legacy dbus modified service files..."
+rm /usr/lib/systemd/system/graphical.target.wants/xorg.target 2>/dev/null
+rm -rf /usr/lib/systemd/system/xorg* 2>/dev/null
+rm /usr/lib/systemd/user/tizen-middleware.target.wants/dbus.service 2>/dev/null
+ln -s /usr/lib/systemd/user/xorg.service /usr/lib/systemd/user/xorg.target.wants/
+ln -s /usr/lib/systemd/user/xorg_done.service /usr/lib/systemd/user/xorg.target.wants/
+cp -a $CONF_DIR_PATH/* /
+if [ "$?" -ne 0 ]; then
+       echo "error occured on copying!"
+else
+       echo "syncing..."
+       sync
+       echo "now reset and flash the kernel not using kdbus"
+fi
diff --git a/packaging/switch-to-kdbus.sh b/packaging/switch-to-kdbus.sh
new file mode 100755 (executable)
index 0000000..0b5694e
--- /dev/null
@@ -0,0 +1,14 @@
+#!/bin/sh
+
+CONF_DIR_PATH="/etc/dbus-1/conf_kdbus"
+
+echo "copying kdbus-modified service files..."
+rm /usr/lib/systemd/user/xorg.target.wants/* 2>/dev/null
+cp -a $CONF_DIR_PATH/* /
+if [ "$?" -ne 0 ]; then
+       echo "error occured on copying!"
+else
+       echo "syncing..."
+       sync
+       echo "now reset and flash the kernel using kdbus"
+fi