summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/run-postinsts
diff options
context:
space:
mode:
authorTudor Florea <tudor.florea@enea.com>2015-10-09 22:59:03 +0200
committerTudor Florea <tudor.florea@enea.com>2015-10-09 22:59:03 +0200
commit972dcfcdbfe75dcfeb777150c136576cf1a71e99 (patch)
tree97a61cd7e293d7ae9d56ef7ed0f81253365bb026 /meta/recipes-devtools/run-postinsts
downloadpoky-972dcfcdbfe75dcfeb777150c136576cf1a71e99.tar.gz
initial commit for Enea Linux 5.0 arm
Signed-off-by: Tudor Florea <tudor.florea@enea.com>
Diffstat (limited to 'meta/recipes-devtools/run-postinsts')
-rwxr-xr-xmeta/recipes-devtools/run-postinsts/run-postinsts/run-postinsts89
-rw-r--r--meta/recipes-devtools/run-postinsts/run-postinsts/run-postinsts.init3
-rw-r--r--meta/recipes-devtools/run-postinsts/run-postinsts/run-postinsts.service16
-rw-r--r--meta/recipes-devtools/run-postinsts/run-postinsts_1.0.bb42
4 files changed, 150 insertions, 0 deletions
diff --git a/meta/recipes-devtools/run-postinsts/run-postinsts/run-postinsts b/meta/recipes-devtools/run-postinsts/run-postinsts/run-postinsts
new file mode 100755
index 0000000000..f547a7b7bd
--- /dev/null
+++ b/meta/recipes-devtools/run-postinsts/run-postinsts/run-postinsts
@@ -0,0 +1,89 @@
1#!/bin/sh
2#
3# Copyright 2007 Openedhand Ltd.
4#
5# Author: Richard Purdie <rpurdie@openedhand.com>
6#
7
8# The following script will run all the scriptlets found in #SYSCONFDIR#/deb-postinsts,
9# #SYSCONFDIR#/ipk-postinsts or #SYSCONFDIR#/rpm-posinsts.
10
11# the order of this list is important, do not change!
12backend_list="rpm deb ipk"
13
14pm_installed=false
15
16for pm in $backend_list; do
17 pi_dir="#SYSCONFDIR#/$pm-postinsts"
18
19 [ -d $pi_dir ] && break
20
21 case $pm in
22 "deb")
23 if [ -s "/var/lib/dpkg/status" ]; then
24 pm_installed=true
25 break
26 fi
27 ;;
28
29 "ipk")
30 pm_installed=true
31 ;;
32 esac
33done
34
35remove_rcsd_link () {
36 if [ -n "`which update-rc.d`" ]; then
37 update-rc.d -f run-postinsts remove
38 fi
39}
40
41if [ -z "$pi_dir" ]; then
42 remove_rcsd_link
43 exit 0
44fi
45
46[ -e #SYSCONFDIR#/default/postinst ] && . #SYSCONFDIR#/default/postinst
47
48if [ "$POSTINST_LOGGING" = "1" ]; then
49 rm -f $LOGFILE
50 append_log=">>$LOGFILE 2>&1"
51fi
52
53exec_postinst_scriptlets() {
54 for i in `ls $pi_dir`; do
55 i=$pi_dir/$i
56 echo "Running postinst $i..."
57 [ "$POSTINST_LOGGING" = "1" ] && eval echo "Running postinst $i..." $append_log
58 if [ -x $i ]; then
59 eval sh -c $i $append_log
60 rm $i
61 else
62 echo "ERROR: postinst $i failed."
63 [ "$POSTINST_LOGGING" = "1" ] && eval echo "ERROR: postinst $i failed." $append_log
64 remove_pi_dir=0
65 fi
66 done
67}
68
69remove_pi_dir=1
70if $pm_installed; then
71 case $pm in
72 "ipk")
73 eval opkg-cl configure $append_log
74 ;;
75
76 "deb")
77 eval dpkg --configure -a $append_log
78 ;;
79 esac
80else
81 exec_postinst_scriptlets
82fi
83
84# since all postinstalls executed successfully, remove the postinstalls directory
85# and the rcS.d link
86if [ $remove_pi_dir = 1 ]; then
87 rm -rf $pi_dir
88 remove_rcsd_link
89fi
diff --git a/meta/recipes-devtools/run-postinsts/run-postinsts/run-postinsts.init b/meta/recipes-devtools/run-postinsts/run-postinsts/run-postinsts.init
new file mode 100644
index 0000000000..473a1f7f6a
--- /dev/null
+++ b/meta/recipes-devtools/run-postinsts/run-postinsts/run-postinsts.init
@@ -0,0 +1,3 @@
1#!/bin/sh
2
3run-postinsts
diff --git a/meta/recipes-devtools/run-postinsts/run-postinsts/run-postinsts.service b/meta/recipes-devtools/run-postinsts/run-postinsts/run-postinsts.service
new file mode 100644
index 0000000000..85a043949e
--- /dev/null
+++ b/meta/recipes-devtools/run-postinsts/run-postinsts/run-postinsts.service
@@ -0,0 +1,16 @@
1[Unit]
2Description=Run pending postinsts
3DefaultDependencies=no
4After=systemd-remount-fs.service systemd-tmpfiles-setup.service tmp.mount
5Before=sysinit.target
6ConditionPathExistsGlob=#SYSCONFDIR#/*-postinsts
7
8[Service]
9Type=oneshot
10ExecStart=#SBINDIR#/run-postinsts
11ExecStartPost=#BASE_BINDIR#/systemctl disable run-postinsts.service
12RemainAfterExit=No
13TimeoutSec=0
14
15[Install]
16WantedBy=sysinit.target
diff --git a/meta/recipes-devtools/run-postinsts/run-postinsts_1.0.bb b/meta/recipes-devtools/run-postinsts/run-postinsts_1.0.bb
new file mode 100644
index 0000000000..64f85c262d
--- /dev/null
+++ b/meta/recipes-devtools/run-postinsts/run-postinsts_1.0.bb
@@ -0,0 +1,42 @@
1SUMMARY = "Runs postinstall scripts on first boot of the target device"
2SECTION = "devel"
3PR = "r9"
4LICENSE = "MIT"
5LIC_FILES_CHKSUM = "file://${COREBASE}/LICENSE;md5=4d92cd373abda3937c2bc47fbc49d690 \
6 file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
7
8SRC_URI = "file://run-postinsts \
9 file://run-postinsts.init \
10 file://run-postinsts.service"
11
12inherit allarch systemd update-rc.d
13
14INITSCRIPT_NAME = "run-postinsts"
15INITSCRIPT_PARAMS = "start 99 S ."
16
17SYSTEMD_SERVICE_${PN} = "run-postinsts.service"
18
19do_configure() {
20 :
21}
22
23do_compile () {
24 :
25}
26
27do_install() {
28 install -d ${D}${sbindir}
29 install -m 0755 ${WORKDIR}/run-postinsts ${D}${sbindir}/
30
31 install -d ${D}${sysconfdir}/init.d/
32 install -m 0755 ${WORKDIR}/run-postinsts.init ${D}${sysconfdir}/init.d/run-postinsts
33
34 install -d ${D}${systemd_unitdir}/system/
35 install -m 0644 ${WORKDIR}/run-postinsts.service ${D}${systemd_unitdir}/system/
36
37 sed -i -e 's:#SYSCONFDIR#:${sysconfdir}:g' \
38 -e 's:#SBINDIR#:${sbindir}:g' \
39 -e 's:#BASE_BINDIR#:${base_bindir}:g' \
40 ${D}${sbindir}/run-postinsts \
41 ${D}${systemd_unitdir}/system/run-postinsts.service
42}