mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
From: Michael Olbrich <m.olbrich@pengutronix.de>
To: ptxdist@pengutronix.de
Subject: Re: [ptxdist] [ANNOUNCE] PTXdist 2011.10.0 released
Date: Thu, 24 Nov 2011 15:01:36 +0100	[thread overview]
Message-ID: <20111124140136.GF31544@pengutronix.de> (raw)
In-Reply-To: <b9bfe9f7cce7ce08ef238826454f490b@idefix.lespocky.dyndns.org>

On Thu, Nov 24, 2011 at 01:51:45PM +0100, Alexander Dahl wrote:
> 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

23     ) | sed -e 's/\\/\\\\/g' > /tmp/issue

should work too. I'd also recommend against using '\'. It always broke
something for me (that's why I use '`'). I think via ssh /etc/issue is
shown, but '\' is no special character for security reasons or something
like that.

>  26
>  27     rm -f /etc/issue
>  28     ln -fs /tmp/issue /etc/issue
>  29 }
> 
> Works fine, thanks for the initial hint. :-)

Michael

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

-- 
ptxdist mailing list
ptxdist@pengutronix.de

  reply	other threads:[~2011-11-24 14:01 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
2011-11-24 14:01       ` Michael Olbrich [this message]
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=20111124140136.GF31544@pengutronix.de \
    --to=m.olbrich@pengutronix.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