0

I have the following script named /etc/init.d/asplashscreen:

#! /bin/sh
### BEGIN INIT INFO
# Provides:          asplashscreen
# Required-Start:
# Required-Stop:
# Should-Start:      
# Default-Start:     S
# Default-Stop:
# Short-Description: Show custom splashscreen
# Description:       Show custom splashscreen
### END INIT INFO


do_start () {
    echo "this script is called on boot" >> /cca-debug
    #/usr/bin/fbi -T 1 -noverbose -a /etc/splash.png    
    exit 0
}

case "$1" in
  start|"")
    do_start
    ;;
  restart|reload|force-reload)
    echo "Error: argument '$1' not supported" >&2
    exit 3
    ;;
  stop)
    # No-op
    ;;
  status)
    exit 0
    ;;
  *)
    echo "Usage: asplashscreen [start|stop]" >&2
    exit 3
    ;;
esac

: 

The file is installed correctly:

$ sudo find /etc -iname "*asplashscreen*"
/etc/init.d/asplashscreen
/etc/rcS.d/S01asplashscreen

I can not see /cca-debug file when rebooted.

  • Just keeping this file in init.d is not enough. You will need proper rights to execute and install it using these commands. sudo chmod a+x /etc/init.d/asplashscreen sudo insserv /etc/init.d/asplashscreen. If you already did it, may I know which kernel and os you're using ? Add output of uname -a. – dhruvvyas90 Oct 20 '15 at 8:29
  • As per @dastaan, note that Raspbian Jessie uses systemd, not init, so if that is your OS you will need to register your script differently. – Phil B. Oct 20 '15 at 12:04
  • @PhilB. I think adding the script via insserv should still work as systemd uses an adapter taskr to run rc.d stuff for backward compatibility. As per the manpage though, "It is not recommended to execute insserv directly [...] update-rc.d is the recommended interface for managing init scripts". Looks like ceremcem has done this already anyway. – goldilocks Oct 20 '15 at 13:34
2

/etc/rcS.d/S01asplashscreen

This prioritizes this script to run ahead of pretty much everything else; on default Raspbian, the only things with S01 in rcS.d are fake-hwclock, hostname, and mountkernfs. Hence:

echo "this script is called on boot" >> /cca-debug

Will likely fail, because the root filesystem has not been remounted read-write. If you change the priority:

mv /etc/rcS.d/S01asplashscreen /etc/rcS.d/S20asplashscreen

You should get the message. You could do this more properly by using Required-Start: mountall.sh (see here) and re-adding via update-rc.d, but of course, that's probably not what you want with a splash screen. You want it to happen first.

However, just renaming the symlink temporarily should be enough to write the echo properly and prove whether or not the script is being run.

If so, you might try using checkfs.sh as the Required-Start. I think trying to run a framebuffer app on the same tty as the console output could be a problem, though.

BTW, if you are doing all this yourself, you might as well learn systemd instead of SysV init since the latter is more or less defunct on linux as of Debian/Raspbian 8 (jessie).

  • I changed the Required-Start: line as Required-Start: checkfs.sh and it worked as expected. I removed the checkfs.sh part, it worked anyway... Then I moved on and changed the /boot/cmdline.txt as ... console=tty3 quiet loglevel=3 ... in order to remove the texts at the beginning of the boot process, then rebooted. Nothing showed up. No kernel messages, no boot messages, no splash screen. Then I changed /boot/cmdline.txt back to original, nothing changed. Then I added Require... checkfs.sh, it gave the error "checkfs.sh must be enabled...". Now I removed asplashscreen via insserv – ceremcem Oct 20 '15 at 20:10
  • changing Required-Start: line as Required-Start: checkfs solved the problem. After that I installed script via update-rc.d asplashscreen defaults. Thank you. – ceremcem Oct 20 '15 at 21:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.