Skip to main content
Topic solved
This topic has been marked as solved and requires no further attention.
Topic: [FIXED] Scripts in /etc/local.d not executed anymore (Read 1165 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

[FIXED] Scripts in /etc/local.d not executed anymore

I'm running Artix-dinit.
Suddendly a script i created in /etc/local.d to configure my networks stopped working.
I tried creating a new one with a test command (one file creation in /tmp) and also this one didn't work.
Also the "touch /tmp/testfile" comman added to /etc/local.d/branding.start is not executed.

Please can someone suggests how to debug this strange problem?

Re: Scripts in /etc/local.d not executed anymore

Reply #1
https://github.com/davmac314/dinit/discussions/349#discussioncomment-9977248
Quote
That's nothing to do with dinit itself. Any functionality for executing things from /etc/local.d is provided by the distribution (possibly they implement it as a dinit service, but I don't have anything to do with it).

You can make a service if you want run something at boot.

Re: Scripts in /etc/local.d not executed anymore

Reply #2
You can make a service if you want run something at boot.

I know this, but i would also know why  for years the scripts in /etc/local.d was executed at boot and now they stopped working....

Re: Scripts in /etc/local.d not executed anymore

Reply #3
Ok, i found the cause of the problem.
Until dinit-rc 0.3.7-1 in the package there was a /etc/dinit.d/config/rc.local file containing these rows:
Code: [Select]
if [ -d /etc/local.d ]; then
    for file in /etc/local.d/*.start; do
        sh "$file"
    done
fi

In the most recent versions of the package this file is missing.

I don't know if this is feature  ;)  or a bug.

I hope the developers could reintroduce automatic execution of scripts, using the previous way or providing some other new method.

Re: Scripts in /etc/local.d not executed anymore

Reply #4
Will this be supported or scripts in /etc/local.d won't be executed by default?

Re: Scripts in /etc/local.d not executed anymore

Reply #5
Ok, i found the cause of the problem.
Until dinit-rc 0.3.7-1 in the package there was a /etc/dinit.d/config/rc.local file containing these rows:

You can ask the devs (or post an issue) on the project's Github, btw.

Anyway, I see a file rclocal in /usr/lib/dinit/ with references to /etc/rc.local

Re: Scripts in /etc/local.d not executed anymore

Reply #6
Pls check
Code: [Select]
/etc/local.d/README                                        
This directory should contain programs or scripts which are to be run
when the local service is started or stopped.

If a file in this directory is executable and it has a .start extension,
it will be run when the local service is started. If a file is
executable and it has a .stop extension, it will be run when the local
service is stopped.

artist

Re: Scripts in /etc/local.d not executed anymore

Reply #7
I do not have that file nor /etc/locale.d.
Code: [Select]
dinitctl list | grep local
[{+}     ] local.target
[{+}     ] pre-local.target
[{+}     ] early-fs-local.target
[{+}     ] locale

I see in /usr/lib/dinit.d/local.target:
Code: [Select]
type         = scripted
command      = /usr/lib/dinit/rclocal startup
stop-command = /usr/lib/dinit/rclocal shutdown

Therefore I can use these files I think:
Code: [Select]
#!/bin/sh

[ ! -f /etc/rc.local ] && {
cat <<EOF > /etc/rc.local
#!/bin/sh
# rc.local for Artix -- enter your commands here
# it should be run when starting local.target service
EOF
chmod 755 /etc/rc.local
}

[ ! -f /etc/rc.shutdown ] && {
...[CODE]

Is there a service for scripts also?

Re: Scripts in /etc/local.d not executed anymore

Reply #8
Is there a service for scripts also?

To execute scripts i put the previous code:

Code: [Select]
if [ -d /etc/local.d ]; then
    for file in /etc/local.d/*.start; do
        sh "$file"
    done
fi

in rc.local

Re: Scripts in /etc/local.d not executed anymore

Reply #9
I discovered that artix-branding-base package installs a lot of scripts in /etc/local.d, so i think the removal from dinit of the local.d scripts execution is a bug that should be fixed.

Re: Scripts in /etc/local.d not executed anymore

Reply #10
I think that it would be nice to have it anyway so you do not need to manually add it in case you have scripts.

Re: Scripts in /etc/local.d not executed anymore

Reply #11
I agree, furthermore if you use my suggestion, it conflicts with artix-branding-base, and the system does not boot anymore due to a loop, so artix-branding-base must be removed.

Re: Scripts in /etc/local.d not executed anymore

Reply #12
Anyone can suggest how to contact devs to submit this bug?

Re: Scripts in /etc/local.d not executed anymore

Reply #13
You could try to contact konimex, dinit dev.