modify init script to work with systemd

Hi,

This excerpt below is from an init script that worked fine pre systemd. enabling it with insserv on an openSUSE 13.2 system succeeds, but it appears not to run in correct sequence with respect to other services.

It dynamically mods fstab, so it must run before local filesystems are mounted. Accordingly, the X-Start-Before line was modified in attempt to suit systemd:

tried these…

X-Start-Before: local-fs

X-Start-Before: local-fs.target

also changed this…

Required-Start: boot.rootfsck

to this…

Required-Start:

…but despite fstab being modded correctly, none of the fstab changes take effect - it appears that boot.modfstab is running too late.
Don’t know if it’s because this service was listed incorrectly in both examples above, or if local-fs is the wrong service and boot.modfstab must run prior to an earlier systemd service.

Any help would be appreciated.

Thank you

#!/bin/bash

/etc/init.d/boot.modfstab

BEGIN INIT INFO

Provides: boot.modfstab

Required-Start: boot.rootfsck

Required-Stop:

X-Start-Before: boot.localfs boot.crypto-early

Default-Start: B

Default-Stop:

X-Interactive: true

Short-Description: mod fstab

Description: dynamically mod fstab

END INIT INFO

Then you want to write generator, not initscript. And even then I’m not sure - there is another generator that is using /etc/fstab and they are unordered, so it is hit and miss which one will runs first.

Accordingly, the X-Start-Before line was modified in attempt to suit systemd:

tried these…

X-Start-Before: local-fs

This won’t work. All services are implicitly ordered after basic.target and local-fs.target is ordered before basic.target. systemd has to break loop somewhere - you are lucky if it breaks it by not removing some mandatory early services.

You need to write true systemd unit and set DefaultDepednecies=false for it.

What are you trying to do with /etc/fstab?