View Single Post
Old 08-29-2016, 09:17 AM   #1
Feathers_McGraw
Member
Feathers_McGraw began at the beginning.
 
Posts: 19
Karma: 10
Join Date: Aug 2016
Device: Kindle 3
Kindle 3 sysvinit scripts

I have installed optware on my kindle 3, which works fine when I manually mount the filesystem, but I'd like to automount it at startup.

The wiki page (https://wiki.mobileread.com/wiki/Optware) has an init script (/etc/init.d/optmount), which I've copied here for reference:

Code:
#!/bin/sh
 
 _FUNCTIONS=/etc/rc.d/functions
 [ -f ${_FUNCTIONS} ] && . ${_FUNCTIONS}
 
 mount_us()
 {
         /bin/mount /mnt/us/optware.ext3
 }
 
 umount_us()
 {
         /bin/umount -d /mnt/us/optware.ext3
 }
 
 case "$1" in
         start)
                 mount_us
                 ;;
         stop)
                 umount_us
                 ;;
 
         restart|force-reload)
                 :
                 ;;
         *)
         msg "usage: /etc/init.d/$NAME {start|stop}" W >&2
                 exit 1
                 ;;
 
 esac
 
 exit 0
The script works fine when I run it manually, but I'd like to run it at startup. The wiki says:

Quote:
Once done, create the appropriate sysvinit symlinks under /etc/RcS.d (Startup), /etc/Rc6.d (Restart) and /etc/Rc0.d (Shutdown)
I've created these symlinks:

Code:
ln -s /etc/init.d/optmount  /etc/rc.d/optmount
ln -s /etc/init.d/optmount  /etc/rc6.d/optmount
ln -s /etc/init.d/optmount  /etc/rcS.d/optmount
But the filesystem doesn't get auto-mounted when I reboot. My first thought was to change options in /etc/fstab to ...,auto,nofail, but I don't think that will work because the "filesystem" is a file on /mnt/us, so it has to be mounted after the internal storage...

Do I have to name the symlinks in /etc/rc*.d/ differently so that the names match the option I want to use (start, stop, restart) like how the symlinks reboot, shutdown, poweroff all point to systemctl in distros with systemd as init system, and the name the program was called as is used as the argument? Or do all of the scripts in those folders get called with additional options anyway?

Can anyone give me a pointer in the right direction? Any more information about the init process on Kindle would be great too, I'd love to learn it in detail. I've been running linux on the server for >3 years but never looked into sysvinit, despite the switch to systemd you still find it everywhere in embedded devices.
Feathers_McGraw is offline   Reply With Quote