From 7b7b6b9f369a2b707e8ed9334e0d81cdb588e2b1 Mon Sep 17 00:00:00 2001
From: Rainer Keller <rainer.keller@theqtcompany.com>
Date: Thu, 16 Jul 2015 10:33:14 +0200
Subject: [PATCH] Add Emulator sdcardmountd

Change-Id: Ib760d0c25c645b1c44216081c42714f8e9a8ca32
Reviewed-by: Samuli Piippo <samuli.piippo@theqtcompany.com>
---
 conf/distro/include/emulator.conf             |  1 +
 .../b2qt-addons/b2qt-emulator-sdcardmountd.bb | 49 +++++++++++++++++++
 .../sdcardmountd.sh                           | 42 ++++++++++++++++
 3 files changed, 92 insertions(+)
 create mode 100644 recipes-qt/b2qt-addons/b2qt-emulator-sdcardmountd.bb
 create mode 100755 recipes-qt/b2qt-addons/b2qt-emulator-sdcardmountd/sdcardmountd.sh

diff --git a/conf/distro/include/emulator.conf b/conf/distro/include/emulator.conf
index 79ebd07a..0457756b 100644
--- a/conf/distro/include/emulator.conf
+++ b/conf/distro/include/emulator.conf
@@ -46,6 +46,7 @@ MACHINE_EXTRA_INSTALL_QT = "\
         qtglesstream \
         b2qt-emulator-proxy \
         b2qt-emulator-vinput \
+        b2qt-emulator-sdcardmountd \
         "
 MACHINE_EXTRA_INSTALL_QT_SDK = "\
         qtglesstream-dev \
diff --git a/recipes-qt/b2qt-addons/b2qt-emulator-sdcardmountd.bb b/recipes-qt/b2qt-addons/b2qt-emulator-sdcardmountd.bb
new file mode 100644
index 00000000..cb0b2ce2
--- /dev/null
+++ b/recipes-qt/b2qt-addons/b2qt-emulator-sdcardmountd.bb
@@ -0,0 +1,49 @@
+#############################################################################
+##
+## Copyright (C) 2015 Digia Plc and/or its subsidiary(-ies).
+##
+## This file is part of the Qt Enterprise Embedded Scripts of the Qt
+## framework.
+##
+## $QT_BEGIN_LICENSE$
+## Commercial License Usage Only
+## Licensees holding valid commercial Qt license agreements with Digia
+## with an appropriate addendum covering the Qt Enterprise Embedded Scripts,
+## may use this file in accordance with the terms contained in said license
+## agreement.
+##
+## For further information use the contact form at
+## http://www.qt.io/contact-us.
+##
+##
+## $QT_END_LICENSE$
+##
+#############################################################################
+
+DESCRIPTION = "SD-Card mount daemon for Emulator"
+LICENSE = "QtEnterprise"
+LIC_FILES_CHKSUM = "file://sdcardmountd.h;md5=ba04e32af7257890758a149b0c14d11a;beginline=1;endline=17"
+
+inherit qt5-module
+
+SRC_URI = " \
+    git://codereview.qt-project.org/tqtc-boot2qt/emulator;branch=${BRANCH};protocol=ssh \
+    file://sdcardmountd.sh \
+    "
+
+SRCREV = "1d001910d45349ae2a44fa01516baaa7ff4c9eda"
+BRANCH = "master"
+
+S = "${WORKDIR}/git/src/helperlibs/sdcarddaemon"
+
+DEPENDS = "qtbase qtsimulator"
+
+do_install_append() {
+	install -m 0755 -d ${D}${sysconfdir}/init.d
+	install -m 0755 ${WORKDIR}/sdcardmountd.sh ${D}${sysconfdir}/init.d/
+}
+
+INITSCRIPT_NAME = "sdcardmountd.sh"
+INITSCRIPT_PARAMS = "defaults 97 10"
+
+inherit update-rc.d
diff --git a/recipes-qt/b2qt-addons/b2qt-emulator-sdcardmountd/sdcardmountd.sh b/recipes-qt/b2qt-addons/b2qt-emulator-sdcardmountd/sdcardmountd.sh
new file mode 100755
index 00000000..565d9b56
--- /dev/null
+++ b/recipes-qt/b2qt-addons/b2qt-emulator-sdcardmountd/sdcardmountd.sh
@@ -0,0 +1,42 @@
+#!/bin/sh
+#############################################################################
+##
+## Copyright (C) 2015 Digia Plc and/or its subsidiary(-ies).
+##
+## This file is part of the Qt Enterprise Embedded Scripts of the Qt
+## framework.
+##
+## $QT_BEGIN_LICENSE$
+## Commercial License Usage Only
+## Licensees holding valid commercial Qt license agreements with Digia
+## with an appropriate addendum covering the Qt Enterprise Embedded Scripts,
+## may use this file in accordance with the terms contained in said license
+## agreement.
+##
+## For further information use the contact form at
+## http://www.qt.io/contact-us.
+##
+##
+## $QT_END_LICENSE$
+##
+#############################################################################
+
+DAEMON=/usr/bin/sdcardmountd
+
+case "$1" in
+start)
+    start-stop-daemon --start --quiet --exec $DAEMON &
+    ;;
+stop)
+    start-stop-daemon --stop --quiet --exec $DAEMON
+    ;;
+restart)
+    start-stop-daemon --stop --quiet --exec $DAEMON
+    sleep 1
+    start-stop-daemon --start --quiet --exec $DAEMON &
+    ;;
+*)
+    echo "Usage: $0 {start|stop|restart}"
+    exit 1
+esac
+exit 0
-- 
GitLab