Make the hook systemd compatible

This commit is contained in:
Marko Korhonen 2020-04-27 09:49:01 +03:00
parent d117f2543e
commit b43185abb4
No known key found for this signature in database
GPG key ID: 911B85FBC6003FE5
6 changed files with 49 additions and 16 deletions

View file

@ -10,17 +10,25 @@ depends=(mkinitcpio)
install="usage.install" install="usage.install"
backup=('etc/welcomemessage.conf') backup=('etc/welcomemessage.conf')
source=('welcomemessage.hook' source=('welcomemessage.hook'
'welcomemessage.install' 'welcomemessage.install'
'sd-welcomemessage.install'
'welcomemessage.service'
'welcomemessage.conf') 'welcomemessage.conf')
md5sums=('178136ddc22bf41020bb8d002054aea0' md5sums=('1450374618d2bb5fbc5daef3860bc714'
'79d4b4f282151004d6df31ac064e48f8' 'e4246c99463e1b20bcd75da31f6e0895'
'3cb0d49c9cff46f4cf948c6325614fea'
'9ddc39f0c29cd05949c5fd3eeba3dda7'
'7a08874d14bf2b7945ef638945550b83') '7a08874d14bf2b7945ef638945550b83')
package() { package() {
install -Dm 644 welcomemessage.hook \ install -Dm 644 welcomemessage.hook \
"${pkgdir}/usr/lib/initcpio/hooks/welcomemessage" "${pkgdir}/usr/lib/initcpio/hooks/welcomemessage"
install -Dm 644 welcomemessage.install \ install -Dm 644 welcomemessage.install \
"${pkgdir}/usr/lib/initcpio/install/welcomemessage" "${pkgdir}/usr/lib/initcpio/install/welcomemessage"
install -Dm 644 welcomemessage.conf \ install -Dm 644 sd-welcomemessage.install \
"${pkgdir}/etc/welcomemessage.conf" "${pkgdir}/usr/lib/initcpio/install/sd-welcomemessage"
install -Dm 644 welcomemessage.conf \
"${pkgdir}/etc/welcomemessage.conf"
install -Dm 644 welcomemessage.service \
"${pkgdir}/usr/lib/systemd/system/welcomemessage.service"
} }

11
sd-welcomemessage.install Normal file
View file

@ -0,0 +1,11 @@
# vim:ft=sh
build() {
cat $(cat /etc/welcomemessage.conf | sed -n '/filename=/p' | sed 's/filename=//') > "$BUILDROOT/welcomemessage"
add_systemd_unit "welcomemessage.service"
}
help() {
cat<<HELPEOF
This hook will print a welcome message before the encryption password is required
HELPEOF
}

View file

@ -1,3 +1,5 @@
# vim:ft=sh
post_install() { post_install() {
echo "" echo ""
echo " This hook will print a welcome message before the encryption password is required." echo " This hook will print a welcome message before the encryption password is required."

View file

@ -1,4 +1,5 @@
run_hook () # vim:ft=sh
{
run_hook() {
cat welcomemessage cat welcomemessage
} }

View file

@ -1,10 +1,10 @@
build () # vim:ft=sh
{
build() {
cat $(cat /etc/welcomemessage.conf | sed -n '/filename=/p' | sed 's/filename=//') > "$BUILDROOT/welcomemessage" cat $(cat /etc/welcomemessage.conf | sed -n '/filename=/p' | sed 's/filename=//') > "$BUILDROOT/welcomemessage"
add_runscript add_runscript
} }
help () help() {
{
cat<<HELPEOF cat<<HELPEOF
This hook will print a welcome message before the encryption password is required This hook will print a welcome message before the encryption password is required
HELPEOF HELPEOF

11
welcomemessage.service Normal file
View file

@ -0,0 +1,11 @@
[Unit]
Description=Print welcome message
DefaultDependencies=no
ConditionPathExists=/welcomemessage
[Service]
Type=oneshot
ExecStart=cat /welcomemessage
[Install]
WantedBy=sysinit.target