Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -63,55 +63,26 @@ rootfs_user_fstab () {
# Allow user to use sudo
echo "user ALL=(ALL) NOPASSWD: ALL" >> ${IMAGE_ROOTFS}/etc/sudoers


# enable serial console auto login for root
sed -i '/^\s*ExecStart\b/ s/getty /&--autologin root /' \
"${IMAGE_ROOTFS}${systemd_system_unitdir}/serial-getty@.service"

# reload services after data partition is mounted
cat > ${IMAGE_ROOTFS}/lib/systemd/system/reload-systemd-data.service << 'EOF'
[Unit]
Description=Reload systemd services from data partition
After=data.mount

[Service]
Type=oneshot
ExecStart=/bin/systemctl daemon-reload
ExecStart=/bin/systemctl start --all
RemainAfterExit=yes
EOF

ln -sf /lib/systemd/system/reload-systemd-data.service ${IMAGE_ROOTFS}/lib/systemd/system/reload-systemd-data.service

# not necessary for this image
rm ${IMAGE_ROOTFS}//usr/lib/systemd/system/systemd-vconsole-setup.service

# move all exising systemd services to the lib system directory and the remaining dir will be the bind mount point
cp -a ${IMAGE_ROOTFS}/etc/systemd/system/* ${IMAGE_ROOTFS}/lib/systemd/system/
rm -rf ${IMAGE_ROOTFS}/etc/systemd/system/*

# cloud-intit service needs to be started after data partition is mounted
mkdir -p ${IMAGE_ROOTFS}/lib/systemd/system/cloud-init.service.d/
cat << EOF > ${IMAGE_ROOTFS}/lib/systemd/system/cloud-init.service.d/overrides.conf
# cloud-init-local service also needs to wait for data partition mounts
mkdir -p ${IMAGE_ROOTFS}/lib/systemd/system/cloud-init-local.service.d/
cat << EOF > ${IMAGE_ROOTFS}/lib/systemd/system/cloud-init-local.service.d/overrides.conf
[Unit]
After=local-fs.target
After=rauc-grow-data-partition.service
RequiresMountsFor=/etc/ssh/
RequiresMountsFor=/home
RequiresMountsFor=/root
RequiresMountsFor=/etc/ssh/

[Service]
Restart=on-failure
RestartSec=30
StartLimitInterval=90
StartLimitBurst=3
ExecStopPost=/usr/bin/cloud-init clean

[Install]
WantedBy=multi-user.target
EOF


# overwrite the default fstab, adding customization for this image
cat << EOF > ${IMAGE_ROOTFS}/${sysconfdir}/fstab
/dev/root / auto rw 1 1
Expand Down Expand Up @@ -167,7 +138,6 @@ fi
install -d ${IMAGE_ROOTFS}/data/etc/ssh/
mv -f ${IMAGE_ROOTFS}/etc/ssh/* ${IMAGE_ROOTFS}/data/etc/ssh/


}

####
Expand Down

This file was deleted.

9 changes: 7 additions & 2 deletions meta-aws-demos/recipes-core/rauc/rauc_%.bbappend
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
FILESEXTRAPATHS:prepend := "${THISDIR}/files:"

SRC_URI += "file://rauc.service.d/override.conf"
SRC_URI:append = " file://rauc.service.d/override.conf"

do_install:append() {
install -d ${D}${systemd_system_unitdir}/rauc.service.d
install -m 0644 ${WORKDIR}/rauc.service.d/override.conf ${D}${systemd_system_unitdir}/rauc.service.d/
}

do_install:append:rpi() {
# Remove ExecStart line for mmcblk0
sed -i '/ExecStart=.*mmcblk0.*resizepart 6/d' ${D}${systemd_system_unitdir}/rauc-grow-data-partition.service
}

# enable debug logs for rauc to see stats of adaptive updates
FILES:${PN} += "${systemd_system_unitdir}/rauc.service.d/override.conf"
FILES:${PN}:append = " ${systemd_system_unitdir}/rauc.service.d/override.conf"
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FILESEXTRAPATHS:prepend := "${THISDIR}/files:"

SRC_URI:append = " file://cloud-init.service"

do_install:append() {
install -m 0644 ${WORKDIR}/cloud-init.service ${D}${systemd_system_unitdir}/cloud-init.service
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
[Unit]
Description=Initial cloud-init job (metadata service crawler)
DefaultDependencies=no
Wants=cloud-init-local.service
Wants=sshd-keygen.service
Wants=sshd.service
After=cloud-init-local.service
After=systemd-networkd-wait-online.service
After=networking.service
After=rauc-grow-data-partition.service
Before=network-online.target
Before=sshd-keygen.service
Before=sshd.service
Before=shutdown.target
Conflicts=shutdown.target
ConditionPathExists=!/etc/cloud/cloud-init.disabled
ConditionKernelCommandLine=!cloud-init=disabled
ConditionEnvironment=!KERNEL_CMDLINE=cloud-init=disabled

[Service]
Type=oneshot
ExecStart=/usr/bin/cloud-init init
RemainAfterExit=yes
TimeoutSec=0
Restart=on-failure
RestartSec=30
StartLimitInterval=90
StartLimitBurst=3
ExecStopPost=/usr/bin/cloud-init clean

# Output needs to appear in instance console output
StandardOutput=journal+console

[Install]
WantedBy=cloud-init.target
WantedBy=multi-user.target