Hello.

I'm trying to make a minimal set of boot services for alpine, and for the
sake of completeness and learning, I'm trying to translate the openrc
services from sh to execline. Currently, I'm on the basic
/etc/init.d/hostname:

start() {
    if [ -s /etc/hostname ] ; then
        opts="-F /etc/hostname"
    else
        opts="${hostname:-localhost}"
    fi
    ebegin "Setting hostname"
    hostname $opts
    eend $?
}

and my current attempt looks like this. Is it an acceptable result?

  if { @YELL_INFO@ hostname setting hostname }

  if -nt {
    backtick opts {
      ifelse { test -s /etc/hostname }
      { echo "-F /etc/hostname" }
      importas -uD localhost hostname hostname
      echo $hostname
    }

    importas -ui opts opts
    hostname $opts
  }

  @YELL_ERROR@ hostname crashed!

Reply via email to