On Fri, May 13, 2022 at 07:01:30PM -0400, aisha wrote:
> On 22/05/06 08:28AM, Antoine Jacoutot wrote:
> > On Thu, May 05, 2022 at 04:49:10PM -0600, Aaron Bieber wrote:
> > > 
> > > 
> > > On Thu, May 5, 2022, at 4:46 PM, Antoine Jacoutot wrote:
> > > > Can you elaborate?
> > > > Do they need to start from a specific directory or from a directory 
> > > > they have write access to?
> > > > Because we could cd /tmp unconditionally 
> > > >
> > > 
> > > From a specific directory. I can???t think of which ones off the top of 
> > > my head, but for sure I have some personal rc scripts that need it for 
> > > nodejs things.
> > 
> > Ok. Let me think about it.
> > 
> > -- 
> > Antoine
> > 
> 
> 
> ping, reattached patch.

That's not enough.
Please give me some time; there are other things I need to look at first.
No rush.



> diff --git a/etc/rc.d/amd b/etc/rc.d/amd
> index 3bfe9dc555e..5c1b8a897ed 100644
> --- a/etc/rc.d/amd
> +++ b/etc/rc.d/amd
> @@ -3,6 +3,7 @@
>  # $OpenBSD: amd,v 1.9 2018/01/11 21:09:26 rpe Exp $
>  
>  daemon="/usr/sbin/amd"
> +daemon_startdir="/etc/amd"
>  
>  . /etc/rc.d/rc.subr
>  
> @@ -15,8 +16,4 @@ rc_pre() {
>       daemon_flags="${daemon_flags} $(print -rn -- $(< ${amd_master}))"
>  }
>  
> -rc_start() {
> -     ${rcexec} "cd /etc/amd; ${daemon} ${daemon_flags}"
> -}
> -
>  rc_cmd $1
> diff --git a/etc/rc.d/rc.subr b/etc/rc.d/rc.subr
> index ed2adb6515e..035f8d9b172 100644
> --- a/etc/rc.d/rc.subr
> +++ b/etc/rc.d/rc.subr
> @@ -117,6 +117,7 @@ daemon_class=${daemon_class}
>  daemon_flags=${daemon_flags}
>  daemon_logger=${daemon_logger}
>  daemon_rtable=${daemon_rtable}
> +daemon_startdir=${daemon_startdir}
>  daemon_timeout=${daemon_timeout}
>  daemon_user=${daemon_user}
>  pexp=${pexp}
> @@ -160,7 +161,7 @@ _rc_wait_for_start() {
>  }
>  
>  rc_start() {
> -     ${rcexec} "${daemon_logger:+set -o pipefail; }${daemon} 
> ${daemon_flags}${daemon_logger:+ 2>&1 |
> +     ${rcexec} "${daemon_logger:+set -o pipefail; }${daemon_startdir:+cd 
> ${daemon_startdir}; }${daemon} ${daemon_flags}${daemon_logger:+ 2>&1 |
>               logger -ip ${daemon_logger} -t ${_name}}"
>  }
>  
> @@ -312,6 +313,7 @@ rc_stop_signal=${rc_stop_signal:=TERM}
>  eval _rcflags=\${${_name}_flags}
>  eval _rclogger=\${${_name}_logger}
>  eval _rcrtable=\${${_name}_rtable}
> +eval _rcstartdir=\${${_name}_startdir}
>  eval _rctimeout=\${${_name}_timeout}
>  eval _rcuser=\${${_name}_user}
>  
> @@ -329,6 +331,7 @@ getcap -f /etc/login.conf.d/${_name}:/etc/login.conf 
> ${_name} 1>/dev/null 2>&1 &
>  [ -n "${_rcflags}" ] && daemon_flags=${_rcflags}
>  [ -n "${_rclogger}" ] && daemon_logger=${_rclogger}
>  [ -n "${_rcrtable}" ] && daemon_rtable=${_rcrtable}
> +[ -n "${_rcstartdir}" ] && daemon_startdir=${_rcstartdir}
>  [ -n "${_rctimeout}" ] && daemon_timeout=${_rctimeout}
>  [ -n "${_rcuser}" ] && daemon_user=${_rcuser}
>  

-- 
Antoine

Reply via email to