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"
backup=('etc/welcomemessage.conf')
source=('welcomemessage.hook'
'welcomemessage.install'
'welcomemessage.install'
'sd-welcomemessage.install'
'welcomemessage.service'
'welcomemessage.conf')
md5sums=('178136ddc22bf41020bb8d002054aea0'
'79d4b4f282151004d6df31ac064e48f8'
md5sums=('1450374618d2bb5fbc5daef3860bc714'
'e4246c99463e1b20bcd75da31f6e0895'
'3cb0d49c9cff46f4cf948c6325614fea'
'9ddc39f0c29cd05949c5fd3eeba3dda7'
'7a08874d14bf2b7945ef638945550b83')
package() {
install -Dm 644 welcomemessage.hook \
"${pkgdir}/usr/lib/initcpio/hooks/welcomemessage"
install -Dm 644 welcomemessage.install \
"${pkgdir}/usr/lib/initcpio/install/welcomemessage"
install -Dm 644 welcomemessage.conf \
"${pkgdir}/etc/welcomemessage.conf"
install -Dm 644 welcomemessage.hook \
"${pkgdir}/usr/lib/initcpio/hooks/welcomemessage"
install -Dm 644 welcomemessage.install \
"${pkgdir}/usr/lib/initcpio/install/welcomemessage"
install -Dm 644 sd-welcomemessage.install \
"${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() {
echo ""
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
}

View file

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