Add systemd synchronization script
[AGL/meta-agl.git] / meta-app-framework / recipes-core / 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
8 #This script should be the last to be execute at the first boot
9 POST_INSTALL_LEVEL = "90"
10 POST_INSTALL_SCRIPT ?= "${POST_INSTALL_LEVEL}-${PN}.sh"
11
12 do_install() {
13     install -d ${D}/${sysconfdir}/agl-postinsts
14     cat > ${D}/${sysconfdir}/agl-postinsts/${POST_INSTALL_SCRIPT} <<EOF
15 #!/bin/sh -e
16 echo "restart daemon ..."
17 result=0
18 systemctl daemon-reload
19 if [ \$? -ne 0 ]; then
20     result=1
21 fi
22 systemctl restart sockets.target
23 if [ \$? -ne 0 ]; then
24     result=1
25 fi
26
27 if [ \$result -eq 0 ]; then
28     echo "restart daemon OK"
29     exit \$result
30 else
31     echo "restart daemon failed"
32     exit \$result
33 fi
34 EOF
35     chmod a+x ${D}/${sysconfdir}/agl-postinsts/${POST_INSTALL_SCRIPT}
36 }
37
38 FILES_${PN} = "${sysconfdir}/agl-postinsts/${POST_INSTALL_SCRIPT}"