From 6c874d58da240648ed3e67e6355e1b8ba69f9eea Mon Sep 17 00:00:00 2001 From: Imran Zaman Date: Thu, 4 Dec 2014 16:32:23 +0200 Subject: [PATCH] Fix session scripts and package update Change-Id: Ia796872f3eec0b0e6698d9d1d5e626b75728342d Signed-off-by: Imran Zaman --- .gitignore | 1 + .../etc/session.d/genivi-session-multiseat | 4 +- .../etc/session.d/genivi-session-singleseat | 4 +- .../tizen-ivi/etc/session.d/genivi-session-vtc1010 | 4 +- dists/debian/install | 1 + dists/rpm/tizen/packaging/tlm.spec | 12 +++-- dists/rpm/tlm-suse.spec | 1 + docs/html/api-index-full.html | 4 +- packaging/tlm.spec | 12 +++-- src/utils/Makefile.am | 10 +++- src/utils/Makefile.in | 39 ++++++++++++-- src/utils/tlm-weston-launch.c | 63 ++++++++++++++++++++++ 12 files changed, 137 insertions(+), 18 deletions(-) create mode 100644 src/utils/tlm-weston-launch.c diff --git a/.gitignore b/.gitignore index 40a4943..7134a3c 100644 --- a/.gitignore +++ b/.gitignore @@ -36,5 +36,6 @@ tests/tlm-test.conf src/daemon/tlm src/sessiond/tlm-sessiond src/utils/tlm-client +src/utils/tlm-weston-launch tests/config/configtest tests/daemon/daemontest diff --git a/data/tizen-ivi/etc/session.d/genivi-session-multiseat b/data/tizen-ivi/etc/session.d/genivi-session-multiseat index 09e4d0c..4d75a62 100755 --- a/data/tizen-ivi/etc/session.d/genivi-session-multiseat +++ b/data/tizen-ivi/etc/session.d/genivi-session-multiseat @@ -1,7 +1,9 @@ #!/bin/sh # +#WESTON_LAUNCH=/usr/bin/tlm-weston-launch +WESTON_LAUNCH=weston-launch export WAYLAND_SERVER_DIR=/tmp export WAYLAND_SERVER_GROUP=weston-launch export WAYLAND_SERVER_MODE=0660 export WESTON_CONFIG=/etc/xdg/weston/weston-genivi.ini -/usr/bin/weston-launch -- -i0 --current-mode --log=/tmp/genivi-weston.log --shell=desktop-shell.so +$WESTON_LAUNCH -- -i0 --current-mode --log=/tmp/genivi-weston.log --shell=desktop-shell.so diff --git a/data/tizen-ivi/etc/session.d/genivi-session-singleseat b/data/tizen-ivi/etc/session.d/genivi-session-singleseat index e7056dd..2adafdd 100755 --- a/data/tizen-ivi/etc/session.d/genivi-session-singleseat +++ b/data/tizen-ivi/etc/session.d/genivi-session-singleseat @@ -1,7 +1,9 @@ #!/bin/sh # +#WESTON_LAUNCH=/usr/bin/tlm-weston-launch +WESTON_LAUNCH=weston-launch export WAYLAND_SERVER_DIR=/tmp export WAYLAND_SERVER_GROUP=weston-launch export WAYLAND_SERVER_MODE=0660 export WESTON_CONFIG=/etc/xdg/weston/weston-genivi.ini -/usr/bin/weston-launch -- -i0 --current-mode --log=/tmp/genivi-weston.log +$WESTON_LAUNCH -- -i0 --current-mode --log=/tmp/genivi-weston.log diff --git a/data/tizen-ivi/etc/session.d/genivi-session-vtc1010 b/data/tizen-ivi/etc/session.d/genivi-session-vtc1010 index 8911190..b8dbc46 100755 --- a/data/tizen-ivi/etc/session.d/genivi-session-vtc1010 +++ b/data/tizen-ivi/etc/session.d/genivi-session-vtc1010 @@ -1,7 +1,9 @@ #!/bin/sh # +#WESTON_LAUNCH=/usr/bin/tlm-weston-launch +WESTON_LAUNCH=weston-launch export WAYLAND_SERVER_DIR=/tmp export WAYLAND_SERVER_GROUP=weston-launch export WAYLAND_SERVER_MODE=0660 export WESTON_CONFIG=/etc/xdg/weston/weston-genivi-vtc1010.ini -/usr/bin/weston-launch -- -i0 --current-mode --log=/tmp/genivi-weston.log +$WESTON_LAUNCH -- -i0 --current-mode --log=/tmp/genivi-weston.log diff --git a/dists/debian/install b/dists/debian/install index bc61868..dfcd9e8 100644 --- a/dists/debian/install +++ b/dists/debian/install @@ -4,3 +4,4 @@ /usr/lib/tlm/plugins/*.so* /etc/tlm.conf /usr/bin/tlm-client +/usr/bin/tlm-weston-launch diff --git a/dists/rpm/tizen/packaging/tlm.spec b/dists/rpm/tizen/packaging/tlm.spec index 90afe3d..b2e9a7c 100644 --- a/dists/rpm/tizen/packaging/tlm.spec +++ b/dists/rpm/tizen/packaging/tlm.spec @@ -157,10 +157,13 @@ install -m 755 data/tizen-common/etc/session.d/* %{buildroot}%{_sysconfdir}/sess /usr/bin/systemctl daemon-reload -%postun -/sbin/ldconfig -/usr/bin/systemctl disable tlm -/usr/bin/systemctl daemon-reload +%preun +if [ $1 == 0 ]; then + /usr/bin/systemctl disable tlm + /usr/bin/systemctl daemon-reload +fi + +%postun -p /sbin/ldconfig %if "%{profile}" == "ivi" @@ -208,6 +211,7 @@ fi %{_bindir}/%{name} %{_bindir}/%{name}-sessiond %{_bindir}/%{name}-client +%{_bindir}/%{name}-weston-launch %{_libdir}/lib%{name}*.so.* %{_libdir}/%{name}/plugins/*.so* %{_unitdir}/tlm.service diff --git a/dists/rpm/tlm-suse.spec b/dists/rpm/tlm-suse.spec index 55209d9..3397e33 100644 --- a/dists/rpm/tlm-suse.spec +++ b/dists/rpm/tlm-suse.spec @@ -78,6 +78,7 @@ rm -rf %{buildroot} %{_bindir}/%{name} %{_bindir}/%{name}-sessiond %{_bindir}/%{name}-client +%{_bindir}/%{name}-weston-launch %{_libdir}/lib%{name}*.so.* %{_libdir}/%{name}/plugins/*.so* %exclude %{_libdir}/tlm/plugins/*.la diff --git a/docs/html/api-index-full.html b/docs/html/api-index-full.html index 193f3cb..dd1983b 100644 --- a/docs/html/api-index-full.html +++ b/docs/html/api-index-full.html @@ -237,11 +237,11 @@
-TlmError, enum in Errors +TLM_ERROR, macro in Errors
-TLM_ERROR, macro in Errors +TlmError, enum in Errors
diff --git a/packaging/tlm.spec b/packaging/tlm.spec index 90afe3d..b2e9a7c 100644 --- a/packaging/tlm.spec +++ b/packaging/tlm.spec @@ -157,10 +157,13 @@ install -m 755 data/tizen-common/etc/session.d/* %{buildroot}%{_sysconfdir}/sess /usr/bin/systemctl daemon-reload -%postun -/sbin/ldconfig -/usr/bin/systemctl disable tlm -/usr/bin/systemctl daemon-reload +%preun +if [ $1 == 0 ]; then + /usr/bin/systemctl disable tlm + /usr/bin/systemctl daemon-reload +fi + +%postun -p /sbin/ldconfig %if "%{profile}" == "ivi" @@ -208,6 +211,7 @@ fi %{_bindir}/%{name} %{_bindir}/%{name}-sessiond %{_bindir}/%{name}-client +%{_bindir}/%{name}-weston-launch %{_libdir}/lib%{name}*.so.* %{_libdir}/%{name}/plugins/*.so* %{_unitdir}/tlm.service diff --git a/src/utils/Makefile.am b/src/utils/Makefile.am index 688bc37..1c40109 100644 --- a/src/utils/Makefile.am +++ b/src/utils/Makefile.am @@ -1,6 +1,6 @@ ## Process this file with automake to produce Makefile.in -bin_PROGRAMS = tlm-client +bin_PROGRAMS = tlm-client tlm-weston-launch tlm_client_SOURCES = tlm-client.c tlm_client_CFLAGS = \ @@ -17,4 +17,10 @@ tlm_client_LDADD = \ $(top_builddir)/src/common/dbus/libtlm-dbus-glue.la \ $(TLM_LIBS) -CLEANFILES = *.gcno *.gcda \ No newline at end of file +tlm_weston_launch_SOURCES = tlm-weston-launch.c +tlm_weston_launch_CFLAGS = \ + -I$(top_builddir)/src \ + -DBINDIR='"$(bindir)"' \ + $(DEPS_CFLAGS) + +CLEANFILES = *.gcno *.gcda diff --git a/src/utils/Makefile.in b/src/utils/Makefile.in index 134bcb3..14d2646 100644 --- a/src/utils/Makefile.in +++ b/src/utils/Makefile.in @@ -78,7 +78,7 @@ PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ -bin_PROGRAMS = tlm-client$(EXEEXT) +bin_PROGRAMS = tlm-client$(EXEEXT) tlm-weston-launch$(EXEEXT) subdir = src/utils DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(top_srcdir)/depcomp @@ -108,6 +108,14 @@ am__v_lt_1 = tlm_client_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(tlm_client_CFLAGS) \ $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +am_tlm_weston_launch_OBJECTS = \ + tlm_weston_launch-tlm-weston-launch.$(OBJEXT) +tlm_weston_launch_OBJECTS = $(am_tlm_weston_launch_OBJECTS) +tlm_weston_launch_LDADD = $(LDADD) +tlm_weston_launch_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(tlm_weston_launch_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \ + -o $@ AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false @@ -142,8 +150,8 @@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = -SOURCES = $(tlm_client_SOURCES) -DIST_SOURCES = $(tlm_client_SOURCES) +SOURCES = $(tlm_client_SOURCES) $(tlm_weston_launch_SOURCES) +DIST_SOURCES = $(tlm_client_SOURCES) $(tlm_weston_launch_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ @@ -326,6 +334,12 @@ tlm_client_LDADD = \ $(top_builddir)/src/common/dbus/libtlm-dbus-glue.la \ $(TLM_LIBS) +tlm_weston_launch_SOURCES = tlm-weston-launch.c +tlm_weston_launch_CFLAGS = \ + -I$(top_builddir)/src \ + -DBINDIR='"$(bindir)"' \ + $(DEPS_CFLAGS) + CLEANFILES = *.gcno *.gcda all: all-am @@ -415,6 +429,10 @@ tlm-client$(EXEEXT): $(tlm_client_OBJECTS) $(tlm_client_DEPENDENCIES) $(EXTRA_tl @rm -f tlm-client$(EXEEXT) $(AM_V_CCLD)$(tlm_client_LINK) $(tlm_client_OBJECTS) $(tlm_client_LDADD) $(LIBS) +tlm-weston-launch$(EXEEXT): $(tlm_weston_launch_OBJECTS) $(tlm_weston_launch_DEPENDENCIES) $(EXTRA_tlm_weston_launch_DEPENDENCIES) + @rm -f tlm-weston-launch$(EXEEXT) + $(AM_V_CCLD)$(tlm_weston_launch_LINK) $(tlm_weston_launch_OBJECTS) $(tlm_weston_launch_LDADD) $(LIBS) + mostlyclean-compile: -rm -f *.$(OBJEXT) @@ -422,6 +440,7 @@ distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tlm_client-tlm-client.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tlm_weston_launch-tlm-weston-launch.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ @@ -461,6 +480,20 @@ tlm_client-tlm-client.obj: tlm-client.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tlm_client_CFLAGS) $(CFLAGS) -c -o tlm_client-tlm-client.obj `if test -f 'tlm-client.c'; then $(CYGPATH_W) 'tlm-client.c'; else $(CYGPATH_W) '$(srcdir)/tlm-client.c'; fi` +tlm_weston_launch-tlm-weston-launch.o: tlm-weston-launch.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tlm_weston_launch_CFLAGS) $(CFLAGS) -MT tlm_weston_launch-tlm-weston-launch.o -MD -MP -MF $(DEPDIR)/tlm_weston_launch-tlm-weston-launch.Tpo -c -o tlm_weston_launch-tlm-weston-launch.o `test -f 'tlm-weston-launch.c' || echo '$(srcdir)/'`tlm-weston-launch.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/tlm_weston_launch-tlm-weston-launch.Tpo $(DEPDIR)/tlm_weston_launch-tlm-weston-launch.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='tlm-weston-launch.c' object='tlm_weston_launch-tlm-weston-launch.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tlm_weston_launch_CFLAGS) $(CFLAGS) -c -o tlm_weston_launch-tlm-weston-launch.o `test -f 'tlm-weston-launch.c' || echo '$(srcdir)/'`tlm-weston-launch.c + +tlm_weston_launch-tlm-weston-launch.obj: tlm-weston-launch.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tlm_weston_launch_CFLAGS) $(CFLAGS) -MT tlm_weston_launch-tlm-weston-launch.obj -MD -MP -MF $(DEPDIR)/tlm_weston_launch-tlm-weston-launch.Tpo -c -o tlm_weston_launch-tlm-weston-launch.obj `if test -f 'tlm-weston-launch.c'; then $(CYGPATH_W) 'tlm-weston-launch.c'; else $(CYGPATH_W) '$(srcdir)/tlm-weston-launch.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/tlm_weston_launch-tlm-weston-launch.Tpo $(DEPDIR)/tlm_weston_launch-tlm-weston-launch.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='tlm-weston-launch.c' object='tlm_weston_launch-tlm-weston-launch.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tlm_weston_launch_CFLAGS) $(CFLAGS) -c -o tlm_weston_launch-tlm-weston-launch.obj `if test -f 'tlm-weston-launch.c'; then $(CYGPATH_W) 'tlm-weston-launch.c'; else $(CYGPATH_W) '$(srcdir)/tlm-weston-launch.c'; fi` + mostlyclean-libtool: -rm -f *.lo diff --git a/src/utils/tlm-weston-launch.c b/src/utils/tlm-weston-launch.c new file mode 100644 index 0000000..d0ef0a6 --- /dev/null +++ b/src/utils/tlm-weston-launch.c @@ -0,0 +1,63 @@ +#include "config.h" + +#include +#include +#include +#include +#include +#include + +#define MAX_ARGV_SIZE 128 + + +void start_weston_launcher(int argc, char *argv[]) { + char *child_argv[MAX_ARGV_SIZE] = {0, 0, }; + int i = 0, j = 0; + + child_argv[i++] = "/bin/sh"; + child_argv[i++] = "-c"; + child_argv[i++] = BINDIR "/weston-launch"; + + if (i + argc >= MAX_ARGV_SIZE) argc -= i; + + for (j = 0; j < argc; ++j) + child_argv[i + j] = argv[j]; + child_argv[i + j] = NULL; + + execv(child_argv[0], child_argv); + + fprintf(stderr, "exec failed: %s", strerror(errno)); +} + +static void help() { + fprintf(stdout, "tlm-weston-launch - Starts weston-launch in background"); +} + +int main(int argc, char *argv[]) { + struct option opts[] = { + { "help", no_argument, NULL, 'h' }, + { 0, 0, NULL, 0 } + }; + pid_t child_pid = 0; + int i, c; + + while ((c = getopt_long(argc, argv, "h", opts, &i)) != -1) { + switch(c) { + case 'h': + help(); + return 0; + } + } + + if ((child_pid = fork()) < 0) { + fprintf(stderr, "fork() failed: %s", strerror(errno)); + return -1; + } + + if (child_pid == 0) { + start_weston_launcher(argc, argv); + return 0; + } + + return 0; +} -- 2.7.4