0b2dc4e4dd3e8a3d0c2d4c55d2014652ac9f6444
[AGL/meta-agl-demo.git] / recipes-config / systemd-sync / systemd-agl-sync_1.0.bb
1 SUMMARY = "Systemd synchronization script"
2 DESCRIPTION = "\
3 Systemd synchronization script \
4 reload daemon at the first boot. \
5 "
6 LICENSE = "Apache-2.0"
7 LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10"
8
9 #This script should be the last to be execute at the first boot
10 POST_INSTALL_LEVEL = "X0"
11 POST_INSTALL_SCRIPT ?= "${POST_INSTALL_LEVEL}-${PN}.sh"
12
13 do_install() {
14     install -d ${D}/${sysconfdir}/agl-postinsts
15     cat > ${D}/${sysconfdir}/agl-postinsts/${POST_INSTALL_SCRIPT} <<EOF
16 #!/bin/sh -e
17 echo "restart daemon ..."
18 result=0
19 systemctl daemon-reload
20 if [ \$? -ne 0 ]; then
21     result=1
22 fi
23 systemctl restart sockets.target
24 if [ \$? -ne 0 ]; then
25     result=1
26 fi
27
28 if [ \$result -eq 0 ]; then
29     echo "restart daemon OK"
30     exit \$result
31 else
32     echo "restart daemon failed"
33     exit \$result
34 fi
35 EOF
36     chmod a+x ${D}/${sysconfdir}/agl-postinsts/${POST_INSTALL_SCRIPT}
37 }
38
39 FILES:${PN} = "${sysconfdir}/agl-postinsts/${POST_INSTALL_SCRIPT}"