diff options
-rw-r--r-- | .gitlab-ci.yml | 11 | ||||
-rw-r--r-- | classes/image_types_ostree.bbclass | 15 | ||||
-rw-r--r-- | classes/image_types_ota.bbclass | 2 | ||||
-rw-r--r-- | conf/distro/poky-sota-systemd.conf | 2 | ||||
-rw-r--r-- | conf/distro/poky-sota.conf | 2 | ||||
-rw-r--r-- | conf/local.conf.base.append | 18 | ||||
-rw-r--r-- | conf/local.conf.systemd.append (renamed from conf/local.conf.sample.append) | 20 | ||||
-rw-r--r-- | lib/oeqa/selftest/cases/updater_qemux86_64.py | 36 | ||||
-rw-r--r-- | lib/oeqa/selftest/cases/updater_raspberrypi.py | 16 | ||||
-rw-r--r-- | recipes-connectivity/networkd-dhcp-conf/networkd-dhcp-conf.bb | 2 | ||||
-rw-r--r-- | recipes-sota/aktualizr/aktualizr_git.bb | 9 | ||||
-rwxr-xr-x | recipes-sota/ostree/files/touch-ostree | 21 | ||||
-rw-r--r-- | recipes-sota/ostree/ostree-booted_1.0.bb | 15 | ||||
-rwxr-xr-x | scripts/envsetup.sh | 18 |
14 files changed, 136 insertions, 51 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d08a7e6..0340e60 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml | |||
@@ -45,6 +45,17 @@ Build core-image-minimal: | |||
45 | except: | 45 | except: |
46 | - pushes | 46 | - pushes |
47 | 47 | ||
48 | Build core-image-minimal (rpi): | ||
49 | extends: .bitbake | ||
50 | |||
51 | stage: test | ||
52 | variables: | ||
53 | TEST_BUILD_DIR: 'build-core-image-minimal-rpi' | ||
54 | BITBAKE_TARGETS: 'core-image-minimal' | ||
55 | TEST_MACHINE: 'raspberrypi3' | ||
56 | except: | ||
57 | - pushes | ||
58 | |||
48 | Oe-selftest qemux86_64: | 59 | Oe-selftest qemux86_64: |
49 | extends: .oe-selftest | 60 | extends: .oe-selftest |
50 | 61 | ||
diff --git a/classes/image_types_ostree.bbclass b/classes/image_types_ostree.bbclass index 7ffe99d..0f0fd28 100644 --- a/classes/image_types_ostree.bbclass +++ b/classes/image_types_ostree.bbclass | |||
@@ -13,11 +13,11 @@ BUILD_OSTREE_TARBALL ??= "1" | |||
13 | SYSTEMD_USED = "${@oe.utils.ifelse(d.getVar('VIRTUAL-RUNTIME_init_manager') == 'systemd', 'true', '')}" | 13 | SYSTEMD_USED = "${@oe.utils.ifelse(d.getVar('VIRTUAL-RUNTIME_init_manager') == 'systemd', 'true', '')}" |
14 | 14 | ||
15 | IMAGE_CMD_TAR = "tar --xattrs --xattrs-include=*" | 15 | IMAGE_CMD_TAR = "tar --xattrs --xattrs-include=*" |
16 | CONVERSION_CMD_tar = "touch ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}; ${IMAGE_CMD_TAR} --numeric-owner -cf ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}.tar -C ${OTA_IMAGE_ROOTFS} . || [ $? -eq 1 ]" | 16 | CONVERSION_CMD_tar = "touch ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}; ${IMAGE_CMD_TAR} --numeric-owner -cf ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}.tar -C ${TAR_IMAGE_ROOTFS} . || [ $? -eq 1 ]" |
17 | CONVERSIONTYPES_append = " tar" | 17 | CONVERSIONTYPES_append = " tar" |
18 | 18 | ||
19 | REQUIRED_DISTRO_FEATURES = "usrmerge" | 19 | REQUIRED_DISTRO_FEATURES = "usrmerge" |
20 | OTA_IMAGE_ROOTFS_task-image-ostree = "${OSTREE_ROOTFS}" | 20 | TAR_IMAGE_ROOTFS_task-image-ostree = "${OSTREE_ROOTFS}" |
21 | do_image_ostree[dirs] = "${OSTREE_ROOTFS}" | 21 | do_image_ostree[dirs] = "${OSTREE_ROOTFS}" |
22 | do_image_ostree[cleandirs] = "${OSTREE_ROOTFS}" | 22 | do_image_ostree[cleandirs] = "${OSTREE_ROOTFS}" |
23 | do_image_ostree[depends] = "coreutils-native:do_populate_sysroot virtual/kernel:do_deploy ${INITRAMFS_IMAGE}:do_image_complete" | 23 | do_image_ostree[depends] = "coreutils-native:do_populate_sysroot virtual/kernel:do_deploy ${INITRAMFS_IMAGE}:do_image_complete" |
@@ -186,13 +186,20 @@ IMAGE_CMD_ostreecommit () { | |||
186 | IMAGE_TYPEDEP_ostreepush = "ostreecommit" | 186 | IMAGE_TYPEDEP_ostreepush = "ostreecommit" |
187 | do_image_ostreepush[depends] += "aktualizr-native:do_populate_sysroot ca-certificates-native:do_populate_sysroot" | 187 | do_image_ostreepush[depends] += "aktualizr-native:do_populate_sysroot ca-certificates-native:do_populate_sysroot" |
188 | IMAGE_CMD_ostreepush () { | 188 | IMAGE_CMD_ostreepush () { |
189 | # Print warnings if credetials are not set or if the file has not been found. | 189 | # send a copy of the repo manifest to backend if available |
190 | local SEND_MANIFEST="" | ||
191 | # check if garage-push supports the --repo-manifest option before trying | ||
192 | if $(garage-push --help | grep -q '^\s*--repo-manifest') && [ -f ${IMAGE_ROOTFS}${sysconfdir}/manifest.xml ]; then | ||
193 | SEND_MANIFEST="--repo-manifest ${IMAGE_ROOTFS}${sysconfdir}/manifest.xml" | ||
194 | fi | ||
195 | |||
190 | if [ -n "${SOTA_PACKED_CREDENTIALS}" ]; then | 196 | if [ -n "${SOTA_PACKED_CREDENTIALS}" ]; then |
191 | if [ -e ${SOTA_PACKED_CREDENTIALS} ]; then | 197 | if [ -e ${SOTA_PACKED_CREDENTIALS} ]; then |
192 | garage-push -vv --repo=${OSTREE_REPO} \ | 198 | garage-push -vv --repo=${OSTREE_REPO} \ |
193 | --ref=${OSTREE_BRANCHNAME} \ | 199 | --ref=${OSTREE_BRANCHNAME} \ |
194 | --credentials=${SOTA_PACKED_CREDENTIALS} \ | 200 | --credentials=${SOTA_PACKED_CREDENTIALS} \ |
195 | --cacert=${STAGING_ETCDIR_NATIVE}/ssl/certs/ca-certificates.crt | 201 | --cacert=${STAGING_ETCDIR_NATIVE}/ssl/certs/ca-certificates.crt \ |
202 | $SEND_MANIFEST | ||
196 | else | 203 | else |
197 | bbwarn "SOTA_PACKED_CREDENTIALS file does not exist." | 204 | bbwarn "SOTA_PACKED_CREDENTIALS file does not exist." |
198 | fi | 205 | fi |
diff --git a/classes/image_types_ota.bbclass b/classes/image_types_ota.bbclass index 31e3887..2cc8913 100644 --- a/classes/image_types_ota.bbclass +++ b/classes/image_types_ota.bbclass | |||
@@ -38,7 +38,7 @@ calculate_size () { | |||
38 | } | 38 | } |
39 | 39 | ||
40 | OTA_SYSROOT = "${WORKDIR}/ota-sysroot" | 40 | OTA_SYSROOT = "${WORKDIR}/ota-sysroot" |
41 | OTA_IMAGE_ROOTFS_task-image-ota = "${OTA_SYSROOT}" | 41 | TAR_IMAGE_ROOTFS_task-image-ota = "${OTA_SYSROOT}" |
42 | IMAGE_TYPEDEP_ota = "ostreecommit" | 42 | IMAGE_TYPEDEP_ota = "ostreecommit" |
43 | do_image_ota[dirs] = "${OTA_SYSROOT}" | 43 | do_image_ota[dirs] = "${OTA_SYSROOT}" |
44 | do_image_ota[cleandirs] = "${OTA_SYSROOT}" | 44 | do_image_ota[cleandirs] = "${OTA_SYSROOT}" |
diff --git a/conf/distro/poky-sota-systemd.conf b/conf/distro/poky-sota-systemd.conf index b30b322..0dc50b0 100644 --- a/conf/distro/poky-sota-systemd.conf +++ b/conf/distro/poky-sota-systemd.conf | |||
@@ -2,7 +2,7 @@ require conf/distro/poky.conf | |||
2 | 2 | ||
3 | require conf/distro/sota.conf.inc | 3 | require conf/distro/sota.conf.inc |
4 | 4 | ||
5 | DISTRO = "poky-sota" | 5 | DISTRO = "poky-sota-systemd" |
6 | DISTRO_NAME = "OTA-enabled Linux" | 6 | DISTRO_NAME = "OTA-enabled Linux" |
7 | DISTRO_VERSION = "1.0" | 7 | DISTRO_VERSION = "1.0" |
8 | DISTRO_CODENAME = "sota" | 8 | DISTRO_CODENAME = "sota" |
diff --git a/conf/distro/poky-sota.conf b/conf/distro/poky-sota.conf index 3fb1d20..bfac90f 100644 --- a/conf/distro/poky-sota.conf +++ b/conf/distro/poky-sota.conf | |||
@@ -5,3 +5,5 @@ DISTRO = "poky-sota" | |||
5 | DISTRO_NAME = "OTA-enabled Linux" | 5 | DISTRO_NAME = "OTA-enabled Linux" |
6 | DISTRO_VERSION = "1.0" | 6 | DISTRO_VERSION = "1.0" |
7 | DISTRO_CODENAME = "sota" | 7 | DISTRO_CODENAME = "sota" |
8 | |||
9 | IMAGE_INSTALL_append_sota = " ostree-booted" | ||
diff --git a/conf/local.conf.base.append b/conf/local.conf.base.append new file mode 100644 index 0000000..36b2f59 --- /dev/null +++ b/conf/local.conf.base.append | |||
@@ -0,0 +1,18 @@ | |||
1 | # | ||
2 | # meta-updater configuration, see README.adoc and aktualizr's | ||
3 | # documentation for more options and detailed documentation | ||
4 | # | ||
5 | |||
6 | MACHINE = "##MACHINE##" | ||
7 | DISTRO = "##DISTRO##" | ||
8 | |||
9 | # General SOTA setup | ||
10 | #SOTA_CLIENT_PROV = "aktualizr-shared-prov" | ||
11 | #SOTA_PACKED_CREDENTIALS = "/path/to/credentials.zip" | ||
12 | |||
13 | # Uncomment this line to start an ssh server at boot automatically | ||
14 | #IMAGE_FEATURES += "ssh-server-dropbear" | ||
15 | |||
16 | # Uncomment this line to set the log level of aktualizr to 'debug' (from 'info' | ||
17 | # by default) | ||
18 | #IMAGE_INSTALL_append += " aktualizr-log-debug" | ||
diff --git a/conf/local.conf.sample.append b/conf/local.conf.systemd.append index fc565f8..12e0182 100644 --- a/conf/local.conf.sample.append +++ b/conf/local.conf.systemd.append | |||
@@ -1,23 +1,3 @@ | |||
1 | |||
2 | # | ||
3 | # meta-updater configuration, see README.adoc and aktualizr's | ||
4 | # documentation for more options and detailed documentation | ||
5 | # | ||
6 | |||
7 | MACHINE = "##MACHINE##" | ||
8 | DISTRO = "poky-sota-systemd" | ||
9 | |||
10 | # General SOTA setup | ||
11 | #SOTA_CLIENT_PROV = "aktualizr-shared-prov" | ||
12 | #SOTA_PACKED_CREDENTIALS = "/path/to/credentials.zip" | ||
13 | |||
14 | # Uncomment this line to start an ssh server at boot automatically | ||
15 | #IMAGE_FEATURES += "ssh-server-dropbear" | ||
16 | |||
17 | # Uncomment this line to set the log level of aktualizr to 'debug' (from 'info' | ||
18 | # by default) | ||
19 | #IMAGE_INSTALL_append += " aktualizr-log-debug" | ||
20 | |||
21 | # Store systemd logs in persistent storage | 1 | # Store systemd logs in persistent storage |
22 | # | 2 | # |
23 | # It greatly helps diagnosing issues on testing devices but should be | 3 | # It greatly helps diagnosing issues on testing devices but should be |
diff --git a/lib/oeqa/selftest/cases/updater_qemux86_64.py b/lib/oeqa/selftest/cases/updater_qemux86_64.py index 4506300..5f152ad 100644 --- a/lib/oeqa/selftest/cases/updater_qemux86_64.py +++ b/lib/oeqa/selftest/cases/updater_qemux86_64.py | |||
@@ -465,4 +465,40 @@ class ResourceControlTests(OESelftestTestCase): | |||
465 | stdout, stderr, retcode = self.qemu_command('systemctl --no-pager show --property=ExecMainStatus aktualizr') | 465 | stdout, stderr, retcode = self.qemu_command('systemctl --no-pager show --property=ExecMainStatus aktualizr') |
466 | self.assertIn(b'ExecMainStatus=0', stdout, 'Aktualizr did not restart') | 466 | self.assertIn(b'ExecMainStatus=0', stdout, 'Aktualizr did not restart') |
467 | 467 | ||
468 | |||
469 | class NonSystemdTests(OESelftestTestCase): | ||
470 | def setUpLocal(self): | ||
471 | layer = "meta-updater-qemux86-64" | ||
472 | result = runCmd('bitbake-layers show-layers') | ||
473 | if re.search(layer, result.output) is None: | ||
474 | self.meta_qemu = metadir() + layer | ||
475 | runCmd('bitbake-layers add-layer "%s"' % self.meta_qemu) | ||
476 | else: | ||
477 | self.meta_qemu = None | ||
478 | self.append_config('MACHINE = "qemux86-64"') | ||
479 | self.append_config('SOTA_CLIENT_PROV = " aktualizr-shared-prov "') | ||
480 | self.append_config('IMAGE_FSTYPES_remove = "ostreepush garagesign garagecheck"') | ||
481 | self.append_config('DISTRO = "poky-sota"') | ||
482 | self.append_config('IMAGE_INSTALL_remove += " aktualizr-resource-control"') | ||
483 | self.qemu, self.s = qemu_launch(machine='qemux86-64') | ||
484 | |||
485 | def tearDownLocal(self): | ||
486 | qemu_terminate(self.s) | ||
487 | if self.meta_qemu: | ||
488 | runCmd('bitbake-layers remove-layer "%s"' % self.meta_qemu, ignore_status=True) | ||
489 | |||
490 | def qemu_command(self, command): | ||
491 | return qemu_send_command(self.qemu.ssh_port, command) | ||
492 | |||
493 | def test_provisioning(self): | ||
494 | print('Checking if systemd is not installed...') | ||
495 | stdout, stderr, retcode = self.qemu_command('systemctl') | ||
496 | self.assertTrue(retcode != 0, 'systemd is installed while it is not supposed to: ' + str(stdout)) | ||
497 | |||
498 | stdout, stderr, retcode = self.qemu_command('aktualizr --run-mode once') | ||
499 | self.assertEqual(retcode, 0, 'Failed to run aktualizr: ' + str(stdout) + str(stderr)) | ||
500 | |||
501 | machine = get_bb_var('MACHINE', 'core-image-minimal') | ||
502 | verifyProvisioned(self, machine) | ||
503 | |||
468 | # vim:set ts=4 sw=4 sts=4 expandtab: | 504 | # vim:set ts=4 sw=4 sts=4 expandtab: |
diff --git a/lib/oeqa/selftest/cases/updater_raspberrypi.py b/lib/oeqa/selftest/cases/updater_raspberrypi.py index 8efc941..fae631e 100644 --- a/lib/oeqa/selftest/cases/updater_raspberrypi.py +++ b/lib/oeqa/selftest/cases/updater_raspberrypi.py | |||
@@ -29,26 +29,10 @@ class RpiTests(OESelftestTestCase): | |||
29 | else: | 29 | else: |
30 | self.meta_upd_rpi = None | 30 | self.meta_upd_rpi = None |
31 | 31 | ||
32 | # This is trickier that I would've thought. The fundamental problem is | ||
33 | # that the qemu layer changes the u-boot file extension to .rom, but | ||
34 | # raspberrypi still expects .bin. To prevent this, the qemu layer must | ||
35 | # be temporarily removed if it is present. It has to be removed by name | ||
36 | # without the complete path, but to add it back when we are done, we | ||
37 | # need the full path. | ||
38 | p = re.compile(r'meta-updater-qemux86-64\s*(\S*meta-updater-qemux86-64)\s') | ||
39 | m = p.search(result.output) | ||
40 | if m and m.lastindex > 0: | ||
41 | self.meta_qemu = m.group(1) | ||
42 | runCmd('bitbake-layers remove-layer meta-updater-qemux86-64') | ||
43 | else: | ||
44 | self.meta_qemu = None | ||
45 | |||
46 | self.append_config('MACHINE = "raspberrypi3"') | 32 | self.append_config('MACHINE = "raspberrypi3"') |
47 | self.append_config('SOTA_CLIENT_PROV = " aktualizr-shared-prov "') | 33 | self.append_config('SOTA_CLIENT_PROV = " aktualizr-shared-prov "') |
48 | 34 | ||
49 | def tearDownLocal(self): | 35 | def tearDownLocal(self): |
50 | if self.meta_qemu: | ||
51 | runCmd('bitbake-layers add-layer "%s"' % self.meta_qemu, ignore_status=True) | ||
52 | if self.meta_upd_rpi: | 36 | if self.meta_upd_rpi: |
53 | runCmd('bitbake-layers remove-layer "%s"' % self.meta_upd_rpi, ignore_status=True) | 37 | runCmd('bitbake-layers remove-layer "%s"' % self.meta_upd_rpi, ignore_status=True) |
54 | if self.meta_rpi: | 38 | if self.meta_rpi: |
diff --git a/recipes-connectivity/networkd-dhcp-conf/networkd-dhcp-conf.bb b/recipes-connectivity/networkd-dhcp-conf/networkd-dhcp-conf.bb index 394531e..40a3958 100644 --- a/recipes-connectivity/networkd-dhcp-conf/networkd-dhcp-conf.bb +++ b/recipes-connectivity/networkd-dhcp-conf/networkd-dhcp-conf.bb | |||
@@ -15,7 +15,7 @@ SRC_URI = " \ | |||
15 | " | 15 | " |
16 | PR = "r1" | 16 | PR = "r1" |
17 | 17 | ||
18 | RDEPENDS_${PN} = "systemd" | 18 | REQUIRED_DISTRO_FEATURES_${PN} = "systemd" |
19 | RCONFLICTS_${PN} = "connman" | 19 | RCONFLICTS_${PN} = "connman" |
20 | 20 | ||
21 | S = "${WORKDIR}" | 21 | S = "${WORKDIR}" |
diff --git a/recipes-sota/aktualizr/aktualizr_git.bb b/recipes-sota/aktualizr/aktualizr_git.bb index 22cba07..211db89 100644 --- a/recipes-sota/aktualizr/aktualizr_git.bb +++ b/recipes-sota/aktualizr/aktualizr_git.bb | |||
@@ -15,7 +15,7 @@ RDEPENDS_${PN}-ptest += "bash cmake curl net-tools python3-core python3-misc pyt | |||
15 | PV = "1.0+git${SRCPV}" | 15 | PV = "1.0+git${SRCPV}" |
16 | PR = "7" | 16 | PR = "7" |
17 | 17 | ||
18 | GARAGE_SIGN_PV = "0.7.0-49-g5ffd420" | 18 | GARAGE_SIGN_PV = "0.7.0-59-gf6013d6" |
19 | 19 | ||
20 | SRC_URI = " \ | 20 | SRC_URI = " \ |
21 | gitsm://github.com/advancedtelematic/aktualizr;branch=${BRANCH};name=aktualizr \ | 21 | gitsm://github.com/advancedtelematic/aktualizr;branch=${BRANCH};name=aktualizr \ |
@@ -27,10 +27,10 @@ SRC_URI = " \ | |||
27 | ${@ d.expand("https://ats-tuf-cli-releases.s3-eu-central-1.amazonaws.com/cli-${GARAGE_SIGN_PV}.tgz;unpack=0;name=garagesign") if d.getVar('GARAGE_SIGN_AUTOVERSION') != '1' else ''} \ | 27 | ${@ d.expand("https://ats-tuf-cli-releases.s3-eu-central-1.amazonaws.com/cli-${GARAGE_SIGN_PV}.tgz;unpack=0;name=garagesign") if d.getVar('GARAGE_SIGN_AUTOVERSION') != '1' else ''} \ |
28 | " | 28 | " |
29 | 29 | ||
30 | SRC_URI[garagesign.md5sum] = "de0877ecb693fd48ec11052e51b0ff1a" | 30 | SRC_URI[garagesign.md5sum] = "3d38908f9b536a02cc73778b11bbc32e" |
31 | SRC_URI[garagesign.sha256sum] = "cf25759574c9c1206835daeaf6fc345f6db7b5ccdb95fb828c86d7451f78f0aa" | 31 | SRC_URI[garagesign.sha256sum] = "eceeb16a781e0e8d1f554defbcd5bbcea86d448ebd350fc6a2529372bf867dba" |
32 | 32 | ||
33 | SRCREV = "fa59e33208d3b1dc690a30ce8339b3b4162f8022" | 33 | SRCREV = "662aa23f0b9c97a2c93a428438dacae72333c751" |
34 | BRANCH ?= "master" | 34 | BRANCH ?= "master" |
35 | 35 | ||
36 | S = "${WORKDIR}/git" | 36 | S = "${WORKDIR}/git" |
@@ -55,7 +55,6 @@ PACKAGECONFIG[warning-as-error] = "-DWARNING_AS_ERROR=ON,-DWARNING_AS_ERROR=OFF, | |||
55 | PACKAGECONFIG[ostree] = "-DBUILD_OSTREE=ON,-DBUILD_OSTREE=OFF,ostree," | 55 | PACKAGECONFIG[ostree] = "-DBUILD_OSTREE=ON,-DBUILD_OSTREE=OFF,ostree," |
56 | PACKAGECONFIG[hsm] = "-DBUILD_P11=ON,-DBUILD_P11=OFF,libp11," | 56 | PACKAGECONFIG[hsm] = "-DBUILD_P11=ON,-DBUILD_P11=OFF,libp11," |
57 | PACKAGECONFIG[sota-tools] = "-DBUILD_SOTA_TOOLS=ON ${GARAGE_SIGN_OPS},-DBUILD_SOTA_TOOLS=OFF,glib-2.0," | 57 | PACKAGECONFIG[sota-tools] = "-DBUILD_SOTA_TOOLS=ON ${GARAGE_SIGN_OPS},-DBUILD_SOTA_TOOLS=OFF,glib-2.0," |
58 | PACKAGECONFIG[systemd] = "-DBUILD_SYSTEMD=ON,-DBUILD_SYSTEMD=OFF,systemd," | ||
59 | PACKAGECONFIG[load-tests] = "-DBUILD_LOAD_TESTS=ON,-DBUILD_LOAD_TESTS=OFF," | 58 | PACKAGECONFIG[load-tests] = "-DBUILD_LOAD_TESTS=ON,-DBUILD_LOAD_TESTS=OFF," |
60 | PACKAGECONFIG[serialcan] = ",,,slcand-start" | 59 | PACKAGECONFIG[serialcan] = ",,,slcand-start" |
61 | PACKAGECONFIG[ubootenv] = ",,,u-boot-fw-utils aktualizr-uboot-env-rollback" | 60 | PACKAGECONFIG[ubootenv] = ",,,u-boot-fw-utils aktualizr-uboot-env-rollback" |
diff --git a/recipes-sota/ostree/files/touch-ostree b/recipes-sota/ostree/files/touch-ostree new file mode 100755 index 0000000..28cb672 --- /dev/null +++ b/recipes-sota/ostree/files/touch-ostree | |||
@@ -0,0 +1,21 @@ | |||
1 | #!/bin/sh | ||
2 | ### BEGIN INIT INFO | ||
3 | # Provides: touch-ostree | ||
4 | # Required-Start: $network $remote_fs | ||
5 | # Required-Stop: $network $remote_fs | ||
6 | # Default-Start: 2 3 4 5 | ||
7 | # Default-Stop: 0 1 6 | ||
8 | # Short-Description: Indicate OSTree boot | ||
9 | ### END INIT INFO | ||
10 | |||
11 | case "$1" in | ||
12 | start) | ||
13 | touch /run/ostree-booted | ||
14 | ;; | ||
15 | stop) | ||
16 | ;; | ||
17 | *) | ||
18 | echo "Usage: /etc/init.d/touch-ostree {start|stop}" | ||
19 | exit 1 | ||
20 | ;; | ||
21 | esac | ||
diff --git a/recipes-sota/ostree/ostree-booted_1.0.bb b/recipes-sota/ostree/ostree-booted_1.0.bb new file mode 100644 index 0000000..d74cf24 --- /dev/null +++ b/recipes-sota/ostree/ostree-booted_1.0.bb | |||
@@ -0,0 +1,15 @@ | |||
1 | SUMMARY = "Indicate an OSTree boot" | ||
2 | DESCRIPTION = "Indicate an OSTree boot" | ||
3 | LICENSE = "MPL-2.0" | ||
4 | LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MPL-2.0;md5=815ca599c9df247a0c7f619bab123dad" | ||
5 | SRC_URI = "file://touch-ostree" | ||
6 | |||
7 | inherit allarch update-rc.d | ||
8 | |||
9 | INITSCRIPT_NAME = "touch-ostree" | ||
10 | INITSCRIPT_PARAMS = "start 8 2 3 4 5 . stop 20 0 1 6 ." | ||
11 | |||
12 | do_install() { | ||
13 | install -d ${D}${sysconfdir}/init.d | ||
14 | install -m 0755 ${WORKDIR}/touch-ostree ${D}${sysconfdir}/init.d/touch-ostree | ||
15 | } | ||
diff --git a/scripts/envsetup.sh b/scripts/envsetup.sh index 5827bc2..19a5c94 100755 --- a/scripts/envsetup.sh +++ b/scripts/envsetup.sh | |||
@@ -3,9 +3,13 @@ | |||
3 | SCRIPT="envsetup.sh" | 3 | SCRIPT="envsetup.sh" |
4 | MACHINE="$1" | 4 | MACHINE="$1" |
5 | BUILDDIR="build" | 5 | BUILDDIR="build" |
6 | DISTRO="poky-sota-systemd" | ||
7 | BASE_CONF="local.conf.base.append" | ||
8 | declare -A supported_distros=( ["poky-sota-systemd"]="local.conf.systemd.append" ["poky-sota"]="local.conf.base.append" ) | ||
6 | 9 | ||
7 | [[ "$#" -lt 1 ]] && { echo "Usage: ${SCRIPT} <machine> [builddir]"; return 1; } | 10 | [[ "$#" -lt 1 ]] && { echo "Usage: ${SCRIPT} <machine> [builddir] [distro=< poky-sota-systemd | poky-sota >]"; return 1; } |
8 | [[ "$#" -eq 2 ]] && { BUILDDIR="$2"; } | 11 | [[ "$#" -ge 2 ]] && { BUILDDIR="$2"; } |
12 | [[ "$#" -eq 3 ]] && { DISTRO="$3"; } | ||
9 | 13 | ||
10 | # detect if this script is sourced: see http://stackoverflow.com/a/38128348/6255594 | 14 | # detect if this script is sourced: see http://stackoverflow.com/a/38128348/6255594 |
11 | SOURCED=0 | 15 | SOURCED=0 |
@@ -22,6 +26,8 @@ if [[ $SOURCED -ne 1 ]]; then | |||
22 | fi | 26 | fi |
23 | 27 | ||
24 | METADIR=${METADIR:-${SOURCEDIR}/../..} | 28 | METADIR=${METADIR:-${SOURCEDIR}/../..} |
29 | DISTRO_CONF=${supported_distros[$DISTRO]} | ||
30 | [[ -n $DISTRO_CONF ]] && { echo "Using $DISTRO_CONF for the specified distro $DISTRO"; } || { echo "The specified distro $DISTRO is not supported"; return 1; } | ||
25 | 31 | ||
26 | if [[ ! -f "${BUILDDIR}/conf/local.conf" ]]; then | 32 | if [[ ! -f "${BUILDDIR}/conf/local.conf" ]]; then |
27 | source "$METADIR/poky/oe-init-build-env" "$BUILDDIR" | 33 | source "$METADIR/poky/oe-init-build-env" "$BUILDDIR" |
@@ -30,7 +36,13 @@ if [[ ! -f "${BUILDDIR}/conf/local.conf" ]]; then | |||
30 | cat "${METADIR}/meta-updater/conf/include/bblayers/sota.inc" >> conf/bblayers.conf | 36 | cat "${METADIR}/meta-updater/conf/include/bblayers/sota.inc" >> conf/bblayers.conf |
31 | cat "${METADIR}/meta-updater/conf/include/bblayers/sota_${MACHINE}.inc" >> conf/bblayers.conf | 37 | cat "${METADIR}/meta-updater/conf/include/bblayers/sota_${MACHINE}.inc" >> conf/bblayers.conf |
32 | 38 | ||
33 | sed "s/##MACHINE##/$MACHINE/g" "${METADIR}/meta-updater/conf/local.conf.sample.append" >> conf/local.conf | 39 | sed -e "s/##MACHINE##/$MACHINE/g" \ |
40 | -e "s/##DISTRO##/$DISTRO/g" \ | ||
41 | "${METADIR}/meta-updater/conf/$BASE_CONF" >> conf/local.conf | ||
42 | |||
43 | if [ "$BASE_CONF" != "$DISTRO_CONF" ]; then | ||
44 | cat "${METADIR}/meta-updater/conf/$DISTRO_CONF" >> conf/local.conf | ||
45 | fi | ||
34 | else | 46 | else |
35 | source "$METADIR/poky/oe-init-build-env" "$BUILDDIR" | 47 | source "$METADIR/poky/oe-init-build-env" "$BUILDDIR" |
36 | fi | 48 | fi |