Skip to content

Commit

Permalink
Add the ability to run a /boot/msw_provision.sh script on first boot
Browse files Browse the repository at this point in the history
  • Loading branch information
mattsoftware committed Mar 12, 2018
1 parent bfd5408 commit 8af78a3
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 0 deletions.
10 changes: 10 additions & 0 deletions stage2/03-msw-tweaks/01-run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash -e

install -m 644 files/msw_provision.service ${ROOTFS_DIR}/etc/systemd/system/msw_provision.service
install -m 644 files/msw_provisioned.service ${ROOTFS_DIR}/etc/systemd/system/msw_provisioned.service

on_chroot << EOF
systemctl enable msw_provision
systemctl enable msw_provisioned
EOF

12 changes: 12 additions & 0 deletions stage2/03-msw-tweaks/files/msw_provision.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[Unit]
Description=Provisions the system via a script on the /boot partition
ConditionFileIsExecutable=/boot/msw_provision.sh
ConditionPathExists=!/var/msw_provisioned

[Service]
Type=oneshot
ExecStart=/boot/msw_provision.sh

[Install]
WantedBy=multi-user.target

13 changes: 13 additions & 0 deletions stage2/03-msw-tweaks/files/msw_provisioned.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[Unit]
Description=Tells the system that it has been provisioned
ConditionPathExists=!/var/msw_provisioned
After=msw_provision.service
Requires=msw_provision.service

[Service]
Type=oneshot
ExecStart=/usr/bin/touch /var/msw_provisioned

[Install]
WantedBy=multi-user.target

0 comments on commit 8af78a3

Please sign in to comment.