From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.sysutils.supervision.general/2369 Path: news.gmane.org!.POSTED!not-for-mail From: "Casper Ti. Vector" Newsgroups: gmane.comp.sysutils.supervision.general Subject: Converter from single-file init/rc input formats Date: Mon, 26 Mar 2018 11:09:36 +0800 Message-ID: <20180326030936.GA28169@CasperVector> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="BOKacYhQ+x31HxR3" X-Trace: blaine.gmane.org 1522033662 19267 195.159.176.226 (26 Mar 2018 03:07:42 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 26 Mar 2018 03:07:42 +0000 (UTC) User-Agent: Mutt/1.9.4 (2018-02-28) To: supervision@list.skarnet.org Original-X-From: supervision-return-1960-gcsg-supervision=m.gmane.org@list.skarnet.org Mon Mar 26 05:07:38 2018 Return-path: Envelope-to: gcsg-supervision@m.gmane.org Original-Received: from alyss.skarnet.org ([95.142.172.232]) by blaine.gmane.org with smtp (Exim 4.84_2) (envelope-from ) id 1f0ITy-0004vX-CX for gcsg-supervision@m.gmane.org; Mon, 26 Mar 2018 05:07:38 +0200 Original-Received: (qmail 6808 invoked by uid 89); 26 Mar 2018 03:10:11 -0000 Mailing-List: contact supervision-help@list.skarnet.org; run by ezmlm Original-Sender: Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 6801 invoked from network); 26 Mar 2018 03:10:10 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:date:to:subject:message-id:mail-followup-to:mime-version :content-disposition:user-agent; bh=eRKoZuJNOfIGZPZHSHceOIn2nBTIAkX9Res6HY5Gm9E=; b=Hz4uDEibt6csG9OIfvkRWxW/PeUO1f5ysQEij7yGii3K8rmAxku2d8Qmzba/sK4u+G 25iLPZsZVMipkEsOsXyiyQJ4GSL3u+qa5QeVOZhmIY4ioITYxDg4kV/AXpCZ1n7HOQ6C UHI9YsXfWRZi4lYyQRp/IYZVm2sBiq7HtjReMmvrtAfs20zaKfP8kGynoIk13Z3gCWR9 SeDN3EYX2BWgJnqmJWOY5nsxSFQwRZh/vlLSBFSh43c62+j53Xs1rpgLIvvMQPXPz4/r f2laFr1PkPX01nRzb5DQKWQtNkVF4Iay8qHrKdyLYs/LcJ+86ncLEVtFi7VMJCpTg6Aq hShg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:date:to:subject:message-id:mail-followup-to :mime-version:content-disposition:user-agent; bh=eRKoZuJNOfIGZPZHSHceOIn2nBTIAkX9Res6HY5Gm9E=; b=lHA2UsL+pX8Cqt9Oxppoq9zG0GbJ1Lqht2S6macbzUX+ql9XIwYE+Xw+CFnDZERKRn 5+rOVNnE+jW2VCtbLzAfG9ABy16YDDBKg9K/vujxh96Yi4E3GKH0DhDcAGvm7toz5Aeh 7s9R0Lp40eSe/xtKDZDnLieCtlxIlehSC7jv9tiQ/c33SPXi0Pji/SP0EyB6zVqX65ff cKc1kzjjXPAbwy3hHl78mFD6oe9RX/dADUmSciguTsDEhDe6CFngWXtPt7HxWHB5vHQt 7FJGVopxN2q9Gl9l10aSrpDRej0jPaPb/10+8R9RoIwOh6czQHn840eOfMl3nFrNp8dx 4mCQ== X-Gm-Message-State: AElRT7FlO8GcQ+9z0FetOhgg3Soi66IZliR2qPJPqd983znzhOCl0wWn JIEOdbpgR036VTEIaRgsILpdP7fp X-Google-Smtp-Source: AIpwx49HWRf3ONidv8JQktQQaRIvmk6PUi9n/mvulhw4fw1VOEvHInGHvx0U9B+5bn1VjH6RheTzIQ== X-Received: by 10.101.102.3 with SMTP id w3mr3889925pgv.200.1522033782198; Sun, 25 Mar 2018 20:09:42 -0700 (PDT) X-Google-Original-From: "Casper Ti. Vector" Mail-Followup-To: supervision@list.skarnet.org Content-Disposition: inline Xref: news.gmane.org gmane.comp.sysutils.supervision.general:2369 Archived-At: --BOKacYhQ+x31HxR3 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline For your amusement, I just made a silly converter from a format remotely like that of OpenRC. Note that unlike slew.rc which is largely independent of any particular rc(1) feature, this converter depends on rc(1)'s ability to handle variables with unconventional names (eg. `timeout-kill' and `data/test') and to easily use dynamically named variables (eg. `$$_name'). And seriously, if you really find a single-file format necessary (for marketing reasons :(), I think a shell-based format would be better than alternatives like systemd units or immortal `run.yml' files. -- My current OpenPGP key: RSA4096/0x227E8CAAB7AA186C (expires: 2020.10.19) 7077 7781 B859 5166 AE07 0286 227E 8CAA B7AA 186C --BOKacYhQ+x31HxR3 Content-Type: text/plain; charset=utf-8 Content-Disposition: attachment; filename="conv.rc" #!/bin/rc -e _wrap=/etc/slew/lib/wrap.rc _base=/etc/slew/conv if (~ $#* 0) exit 1 . $1 if (! ~ $#self 1 || ~ $self */*) exit 1 mkdir $self cp $1 conv for (_name in \ type contents dependencies notification-fd nosetsid \ timeout-up timeout-down timeout-kill timeout-finish \ producer-for consumer-for pipeline-name \ ) { if (! ~ $#$_name 0) { echo $$_name | tr -s ' ' '\n' > $self/$_name } } for (_name in $extra) { if (~ $_name */*) mkdir -p `{dirname $self/$_name} printf '%s' $$_name > $self/$_name } for (_name in up down run finish) { if (whatis $_name > /dev/null >[2=1]) printf '#!/bin/execlineb -P\n%s %s %s\n' \ $_wrap $_base/$self.rc $_name > $self/$_name } --BOKacYhQ+x31HxR3 Content-Type: text/plain; charset=utf-8 Content-Disposition: attachment; filename="wrap.rc" #!/bin/rc -e . $1 $2 --BOKacYhQ+x31HxR3 Content-Type: text/plain; charset=utf-8 Content-Disposition: attachment; filename="hello.rc" #!/bin/rc self=hello type=longrun dependencies=(origin) extra=(data/test) data/test='' fn run { echo Hello world exec cat >[2=1] } --BOKacYhQ+x31HxR3--