mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
From: Alexander Dahl <post@lespocky.de>
To: ptxdist@pengutronix.de
Subject: Re: [ptxdist] [ANNOUNCE] PTXdist 2011.10.0 released
Date: Thu, 24 Nov 2011 13:51:45 +0100	[thread overview]
Message-ID: <b9bfe9f7cce7ce08ef238826454f490b@idefix.lespocky.dyndns.org> (raw)
In-Reply-To: <20111122142559.GK10058@pengutronix.de>

Hei hei, 

Am 22.11.2011 15:25, schrieb Michael Olbrich:
> It was also broken on many systems. Sometimes when the getty started, the
> last few lines of the init output (= the last lines of the banner) got
> lost.

Yes, I know, noticed this myself.

>> but let's say I wanted the old behaviour back, I would have to implement
>> it by myself now, wouldn't I?
> 
> Yes, but thats rather easy. Just copy the old init script to your bsp and
> install it. You could also create a new init script that creates
> /etc/issue, or better create it on a tmpfs and install /etc/issue as a link
> to this.

Did this, but that's not enough. We use bbinit (busybox) and have the
following lines in /etc/inittab:

console::sysinit:/etc/init.d/rcS
console::respawn:/sbin/getty -L 115200 /dev/ttyS0 vt100

So after executing all init scripts getty is started and getty does the
output of /etc/issue – the getty used here also comes from busybox. Help
for it is a little hard to find, I ended up reading the busybox source
and found this in libbb/login.c:

 48             switch (c) {
 49             case 's':
 50                 outbuf = uts.sysname;
 51                 break;
 52             case 'n':
 53             case 'h':
 54                 outbuf = uts.nodename;
 55                 break;
 56             case 'r':
 57                 outbuf = uts.release;
 58                 break;
 59             case 'v':
 60                 outbuf = uts.version;
 61                 break;
 62             case 'm':
 63                 outbuf = uts.machine;
 64                 break;
 65 /* The field domainname of struct utsname is Linux specific. */
 66 #if defined(__linux__)
 67             case 'D':
 68             case 'o':
 69                 outbuf = uts.domainname;
 70                 break;
 71 #endif
 72             case 'd':
 73                 strftime(buf, sizeof(buf), fmtstr_d,
localtime(&t));
 74                 break;
 75             case 't':
 76                 strftime(buf, sizeof(buf), fmtstr_t,
localtime(&t));
 77                 break;
 78             case 'l':
 79                 outbuf = tty;
 80                 break;
 81             default:
 82                 buf[0] = c;
 83             }

This means getty does replace certain things when displaying
/etc/issue. This is why you replace backslashes (\) with backticks (`)
when creating the static /etc/issue in ptxd_install_replace_figlet()
from scripts/lib/ptxd_make_xpkg_pkg.sh ;-)

To make a long story short: In my script on the target I couldn't just
pipe the output of figlet to my new /etc/issue but had to escape the
backslashes afterwords, so this is how my /etc/init.d/banner looks now
(and I do some additional replacements in my build environment):

 11 start_proc() {
 12     host=`/bin/hostname`
 13
 14     (
 15         echo
 16         echo "OSELAS(R)-@PROJECT@@PRJVERSION@
(@PTXDIST@-@VERSION@.@PATCHLEVEL@.@SUBLEVEL@@EXTRAVERSION@/@DATE@)"
 17         echo "for: @IS_VENDOR_NAME@ (revision: @REVISION@)"
 18         ${FIGLET} -w 0 -f "${FIGLET_FONTS}/standard" "$host"
 19         echo "%s %n %r %v %m"
 20         echo "Today is %d %t. The weather is nice."
 21         echo
 22         echo
 23     ) > /tmp/issue
 24
 25     sed -i -e 's/\\/\\\\/g' /tmp/issue
 26
 27     rm -f /etc/issue
 28     ln -fs /tmp/issue /etc/issue
 29 }

Works fine, thanks for the initial hint. :-)

Alex

-- 
»With the first link, the chain is forged. The first speech censured,
the first thought forbidden, the first freedom denied, chains us all
irrevocably.« (Jean-Luc Picard, quoting Judge Aaron Satie)
*** GnuPG-FP: 02C8 A590 7FE5 CA5F 3601  D1D5 8FBA 7744 CC87 10D0 ***

-- 
ptxdist mailing list
ptxdist@pengutronix.de

  parent reply	other threads:[~2011-11-24 12:51 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-05  8:55 Michael Olbrich
2011-11-22 13:28 ` Alexander Dahl
2011-11-22 14:25   ` Michael Olbrich
2011-11-22 14:41     ` Jon Ringle
2011-11-24 12:51     ` Alexander Dahl [this message]
2011-11-24 14:01       ` Michael Olbrich
2011-11-24 15:23         ` [ptxdist] /etc/issue (Was: [ANNOUNCE] PTXdist 2011.10.0 released) Alexander Dahl

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b9bfe9f7cce7ce08ef238826454f490b@idefix.lespocky.dyndns.org \
    --to=post@lespocky.de \
    --cc=ptxdist@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox