Created
March 4, 2018 19:53
-
-
Save RichardBronosky/cf1bda1825ba7d431c6fa07a344d5a53 to your computer and use it in GitHub Desktop.
Use standard Linux run-parts utility to run *.sh in /boot/per-boot.d/ and /boot/per-once.d/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
Description=Run user provided scripts on boot | |
ConditionPathExists=/usr/lib/raspi-ini/run-parts.sh | |
Before=dhcpcd.service # Need to put more thought into when | |
[Service] | |
Type=oneshot | |
RemainAfterExit=yes | |
ExecStart=/usr/lib/raspi-ini/run-parts.sh | |
[Install] | |
WantedBy=multi-user.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Prevent *.sh from returning itself if there are no matches | |
shopt -s nullglob | |
# Run every per-once script | |
run-parts --regex '.*\.sh$' /boot/per-once | |
# Rename every per-once script | |
for f in /boot/per-once/*.sh; do | |
mv $f $(dirname $f)/$(basename $f .sh).$(date +%F@%H.%M.%S) | |
done | |
# Run every per-boot script | |
run-parts --regex '.*\.sh$' /boot/per-boot |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Might want to tweak the description to remove the per-once.d and per-boot.d, since it doesn't use the '.d' on those directories. Thanks for the useful script!