build_inf.sh: change the protocal for github repo
[pti/rtp.git] / meta-stx / recipes-core / stx-config / workerconfig.inc
1 #
2 ## Copyright (C) 2019 Wind River Systems, Inc.
3 #
4 #  Licensed under the Apache License, Version 2.0 (the "License");
5 #  you may not use this file except in compliance with the License.
6 #  You may obtain a copy of the License at
7 #
8 #      http://www.apache.org/licenses/LICENSE-2.0
9 #
10 #  Unless required by applicable law or agreed to in writing, software
11 #  distributed under the License is distributed on an "AS IS" BASIS,
12 #  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 #  See the License for the specific language governing permissions and
14 #  limitations under the License.
15
16 PACKAGES += " \
17         workerconfig \
18         workerconfig-standalone \
19         workerconfig-subfunction \
20         "
21
22 RDEPENDS_workerconfig += "bash"
23 RDEPENDS_workerconfig-standalone += "workerconfig"
24 RDEPENDS_workerconfig-subfunction += "workerconfig"
25
26 systemddir = "${sysconfdir}/systemd/system"
27
28 do_install_append () {
29         cd ${S}/workerconfig/workerconfig/
30         oe_runmake GOENABLEDDIR=${D}/${sysconfdir}/goenabled.d  INITDDIR=${D}/${sysconfdir}/init.d \
31                 SYSTEMDDIR=${D}/${systemddir} install
32
33         sed -i -e 's|/usr/local/bin|${bindir}|' \
34                 ${D}${sysconfdir}/init.d/worker_config
35 }
36
37 FILES_workerconfig += " \
38         ${sysconfdir}/init.d/worker_config \
39         "
40
41 FILES_workerconfig-standalone += " \
42         ${systemddir}/config/workerconfig-standalone.service \
43         ${sysconfdir}/goenabled.d/config_goenabled_check.sh \
44         "
45
46 FILES_workerconfig-subfunction += "  \
47         ${sysconfdir}/systemd/system/config/workerconfig-combined.service \
48         "
49
50 pkg_postinst_workerconfig-standalone () {
51         if [ ! -e $D${systemddir}/workerconfig.service ]; then
52                 cp $D${systemddir}/config/workerconfig-standalone.service $D${systemddir}/workerconfig.service
53         else
54                 rm -f $D${systemddir}/workerconfig.service
55                 cp $D${systemddir}/config/workerconfig-standalone.service $D${systemddir}/workerconfig.service
56         fi
57
58         # enable workerconfig service by default
59         OPTS=""
60         if [ -n "$D" ]; then
61                 OPTS="--root=$D"
62         fi
63         if [ -z "$D" ]; then
64                 systemctl daemon-reload
65         fi
66
67         systemctl $OPTS enable workerconfig.service
68
69         if [ -z "$D" ]; then
70                 systemctl --no-block restart workerconfig.service
71         fi
72 }
73
74
75 pkg_postinst_workerconfig-subfunction () {
76         if [ ! -e $D${systemddir}/workerconfig.service ]; then
77                 cp $D${systemddir}/config/workerconfig-combined.service $D${systemddir}/workerconfig.service
78         else
79                 rm -f $D${systemddir}/workerconfig.service
80                 cp $D${systemddir}/config/workerconfig-combined.service $D${systemddir}/workerconfig.service
81         fi
82
83         # enable workerconfig service by default
84         OPTS=""
85         if [ -n "$D" ]; then
86                 OPTS="--root=$D"
87         fi
88         if [ -z "$D" ]; then
89                 systemctl daemon-reload
90         fi
91
92         systemctl $OPTS enable workerconfig.service
93
94         if [ -z "$D" ]; then
95                 systemctl --no-block restart workerconfig.service
96         fi
97 }