Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
OpenRC API to depend on a service if substring matches $CONF
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
jeffk
l33t
l33t


Joined: 13 Sep 2003
Posts: 671

PostPosted: Mon Aug 06, 2018 9:54 pm    Post subject: OpenRC API to depend on a service if substring matches $CONF Reply with quote

I am using net-misc/connman with net-wireless/iwd, works great for me. I have modified /etc/init.d/connman to conditionally need iwd based on a string test of CONNMAN_OPTS, and this is working well.
Code:
depend() {
   need dbus
   if [[ ${CONNMAN_OPTS} = *"iwd_agent"* ]]; then
     need iwd
   fi
   provide net
}

start() {
   ebegin "Starting Connection Manager"
   start-stop-daemon --start --quiet --exec /usr/sbin/connmand -- ${CONNMAN_OPTS}
   eend $?
}

Question: is there a more idiomatic way to do this in OpenRC init scripts?

Also, I would like to stop both iwd and connman-vpnd when connman is stopped (currently connman-vpnd does not), still checking on iwd. What is the normal way to stop exclusively dependent services? Or is doing so a brittle method, and runlevels should be used instead?

Thanks
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum