Re: Help translating a bash function to execline

From: Angelo Verlain <geoangercola_at_gmail.com>
Date: Mon, 23 Sep 2024 02:35:33 +0200

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 { _at_YELL_INFO_at_ 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
  }

  _at_YELL_ERROR_at_ hostname crashed!
Received on Mon Sep 23 2024 - 02:35:33 CEST

This archive was generated by hypermail 2.4.0 : Mon Sep 23 2024 - 02:36:16 CEST