mirror of
https://github.com/OpenVoiceOS/OpenVoiceOS
synced 2025-06-05 22:19:21 +02:00
MycroftOS: Firstboot systemd system
- System to run sccripts at the very first boot. Now currently used only for resizing the partion using the full SD size. - Can be expanded to run other scripts to prepare stuff at the very first boot.
This commit is contained in:
@ -1,4 +1,5 @@
|
||||
menu "Mycroft A.I. Personal Assistant"
|
||||
source "$BR2_EXTERNAL_MYCROFTOS_PATH/package/firstboot-service/Config.in"
|
||||
source "$BR2_EXTERNAL_MYCROFTOS_PATH/package/python-mycroft/Config.in"
|
||||
source "$BR2_EXTERNAL_MYCROFTOS_PATH/package/mycroft-service/Config.in"
|
||||
source "$BR2_EXTERNAL_MYCROFTOS_PATH/package/mycroft-splash/Config.in"
|
||||
|
@ -187,6 +187,7 @@ BR2_PACKAGE_HOST_PYTHON_CYTHON=y
|
||||
BR2_PACKAGE_HOST_PYTHON_LXML=y
|
||||
BR2_PACKAGE_HOST_PYTHON_SIX=y
|
||||
BR2_PACKAGE_HOST_PYTHON_XLRD=y
|
||||
BR2_PACKAGE_FIRSTBOOT_SERVICE=y
|
||||
BR2_PACKAGE_PYTHON_MYCROFT=y
|
||||
BR2_PACKAGE_MYCROFT_SERVICE=y
|
||||
BR2_PACKAGE_MYCROFT_SPLASH=y
|
||||
|
8
buildroot-external/package/firstboot-service/Config.in
Normal file
8
buildroot-external/package/firstboot-service/Config.in
Normal file
@ -0,0 +1,8 @@
|
||||
config BR2_PACKAGE_FIRSTBOOT_SERVICE
|
||||
bool "firstboot-service"
|
||||
help
|
||||
A systemd service that only runs on first boot
|
||||
which can be used to run certain scripts that
|
||||
prepare the rootfs. For now being used to auto
|
||||
expand the filesystem over the full size of the
|
||||
SD card.
|
4
buildroot-external/package/firstboot-service/firstboot
Executable file
4
buildroot-external/package/firstboot-service/firstboot
Executable file
@ -0,0 +1,4 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
/usr/sbin/resizeSD &&
|
||||
rm /etc/firstboot
|
@ -0,0 +1,24 @@
|
||||
################################################################################
|
||||
#
|
||||
# firstboot-service
|
||||
#
|
||||
################################################################################
|
||||
|
||||
FIRSTBOOT_SERVICE_VERSION = 0.1.0
|
||||
FIRSTBOOT_SERVICE_SITE = $(BR2_EXTERNAL_MYCROFTOS_PATH)/package/firstboot-service
|
||||
FIRSTBOOT_SERVICE_SITE_METHOD = local
|
||||
FIRSTBOOT_SERVICE_LICENSE = Apache License 2.0
|
||||
FIRSTBOOT_SERVICE_LICENSE_FILES = LICENSE
|
||||
|
||||
define FIRSTBOOT_SERVICE_INSTALL_TARGET_CMDS
|
||||
$(INSTALL) -m 0755 $(@D)/resizeSD $(TARGET_DIR)/usr/sbin/
|
||||
$(INSTALL) -m 0755 $(@D)/firstboot $(TARGET_DIR)/usr/sbin/
|
||||
$(INSTALL) -D -m 644 $(@D)/firstboot.service \
|
||||
$(TARGET_DIR)/usr/lib/systemd/system/firstboot.service
|
||||
mkdir -p $(TARGET_DIR)/etc/systemd/system/sysinit.target.wants
|
||||
ln -fs ../../../../usr/lib/systemd/system/firstboot.service \
|
||||
$(TARGET_DIR)/etc/systemd/system/sysinit.target.wants/firstboot.service
|
||||
touch $(TARGET_DIR)/etc/firstboot
|
||||
endef
|
||||
|
||||
$(eval $(generic-package))
|
@ -0,0 +1,16 @@
|
||||
[Unit]
|
||||
Description=First Boot run script
|
||||
DefaultDependencies=no
|
||||
Conflicts=shutdown.target
|
||||
After=systemd-remount-fs.service
|
||||
Before=sysinit.target shutdown.target
|
||||
ConditionPathIsReadWrite=/etc
|
||||
ConditionFirstBoot=yes
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
RemainAfterExit=yes
|
||||
ExecStart=/usr/sbin/resizeSD
|
||||
|
||||
[Install]
|
||||
WantedBy=sysinit.target
|
9
buildroot-external/package/firstboot-service/resizeSD
Executable file
9
buildroot-external/package/firstboot-service/resizeSD
Executable file
@ -0,0 +1,9 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
printf "Resize data partition ..."
|
||||
parted /dev/mmcblk0 unit % resizepart 2 100% &&
|
||||
partprobe /dev/mmcblk0 &&
|
||||
sync &&
|
||||
resize2fs /dev/mmcblk0p2 &&
|
||||
echo "[OK]"
|
||||
|
Reference in New Issue
Block a user