Re: [systemd-devel] controlling serial console using a token

2015-04-20 Thread Andrei Borzenkov
On Mon, Apr 20, 2015 at 7:15 AM, Praveen kumar R
praveenrgo...@gmail.com wrote:
 You mean in the getty-generator.c ?



I actually mean your own customer generator.

 On Mon, Apr 20, 2015 at 9:14 AM, Andrei Borzenkov arvidj...@gmail.com
 wrote:

 В Mon, 20 Apr 2015 09:09:09 +0530
 Praveen kumar R praveenrgo...@gmail.com пишет:

  This is the snippet of the code in the systemV init system that controls
  the serial console login
  depending on the token
 
   TOKENEXIST=`grep TOKEN= /proc/cmdline`
  TOKEN=0
  if [ X$TOKENEXIST != X ]; then
 #If token is pass as a command line arg, use it.
 TOKEN=`sed 's/.*TOKEN=//; s/ .*//' /proc/cmdline`
  fi
 
  TOKENOVERRIDE=`grep TOKENOVERRIDE= /proc/cmdline`
  if [ X$TOKENOVERRIDE != X ]; then
 #If token is pass as a command line arg, use it.
 OVERRIDE=`sed 's/.*TOKENOVERRIDE=//; s/ .*//' /proc/cmdline`
 let TOKEN = $TOKEN  $OVERRIDE
  fi
 
  echo TOKEN = $TOKEN
 
  let CONSOLE_LOGIN = $TOKEN  512
  if [ $CONSOLE_LOGIN -ne 0 ];  then
  echo [`eval $uptime`]: Begin Console Access
  /etc/console_login 
  echo eCM console is enabled
  export ENABLE_ECM_CONSOLE=y
  else
  echo [`eval $uptime`]: Token doesn't allow console access
  export ENABLE_ECM_CONSOLE=n
  fi
 
 
 
  I am trying to implement the same in the sytemd init system.
 

 The straightforward approach is to put this code in generator that
 parses command line. It can mask standard console service and create
 unit for your console.

 
  On Sun, Apr 19, 2015 at 11:48 AM, Andrei Borzenkov arvidj...@gmail.com
  wrote:
 
   В Sat, 18 Apr 2015 19:54:50 +0530
   Praveen kumar R praveenrgo...@gmail.com пишет:
  
Yes it's a kernel command line arg, it is board specific token
introduced
to control the serial console.
if defined serial console should not be enabled.
   
  
   Sorry I do not understand this sentence. define what? Please give
   exact example of kernel command line and explain what behavior you
   expect in this case.
  
we have this in place for other system initializing system - sytemV
,
   where
depending
   
On Fri, Apr 17, 2015 at 4:24 PM, Lennart Poettering 
   lenn...@poettering.net
javascript:_e(%7B%7D,'cvml','lenn...@poettering.net'); wrote:
   
 On Fri, 17.04.15 15:54, Praveen kumar R (praveenrgo...@gmail.com
 javascript:_e(%7B%7D,'cvml','praveenrgo...@gmail.com');) wrote:

  I have a token passed on by command line argument on which I
  need to
 decide
  to start the serial

 On which command line? Kernel command line? What kind of token?

  console or not. I plan to tweak the getty*ttyS0.service and add
  the
  script which validates the token and starts the console.
 
  Is this the right approach or is there any better way of
  handling it
   ??

 To get a login getty on the serial port its sufficient to add
 console=ttyS0... to the kernel cmdline. systemd automatically
 starts a
 serial getty automatically on the first terminal the kernel
 console is
 pointing to.

 Lennart

 --
 Lennart Poettering, Red Hat

  
  


___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] controlling serial console using a token

2015-04-20 Thread Lennart Poettering
On Mon, 20.04.15 13:06, Andrei Borzenkov (arvidj...@gmail.com) wrote:

 On Mon, Apr 20, 2015 at 7:15 AM, Praveen kumar R
 praveenrgo...@gmail.com wrote:
  You mean in the getty-generator.c ?
 
 I actually mean your own customer generator.

For details see:

https://wiki.freedesktop.org/www/Software/systemd/Generators/

Lennart

-- 
Lennart Poettering, Red Hat
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] controlling serial console using a token

2015-04-19 Thread Andrei Borzenkov
В Sat, 18 Apr 2015 19:54:50 +0530
Praveen kumar R praveenrgo...@gmail.com пишет:

 Yes it's a kernel command line arg, it is board specific token introduced
 to control the serial console.
 if defined serial console should not be enabled.
 

Sorry I do not understand this sentence. define what? Please give
exact example of kernel command line and explain what behavior you
expect in this case.

 we have this in place for other system initializing system - sytemV , where
 depending
 
 On Fri, Apr 17, 2015 at 4:24 PM, Lennart Poettering lenn...@poettering.net
 javascript:_e(%7B%7D,'cvml','lenn...@poettering.net'); wrote:
 
  On Fri, 17.04.15 15:54, Praveen kumar R (praveenrgo...@gmail.com
  javascript:_e(%7B%7D,'cvml','praveenrgo...@gmail.com');) wrote:
 
   I have a token passed on by command line argument on which I need to
  decide
   to start the serial
 
  On which command line? Kernel command line? What kind of token?
 
   console or not. I plan to tweak the getty*ttyS0.service and add the
   script which validates the token and starts the console.
  
   Is this the right approach or is there any better way of handling it ??
 
  To get a login getty on the serial port its sufficient to add
  console=ttyS0... to the kernel cmdline. systemd automatically starts a
  serial getty automatically on the first terminal the kernel console is
  pointing to.
 
  Lennart
 
  --
  Lennart Poettering, Red Hat
 

___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] controlling serial console using a token

2015-04-19 Thread Praveen kumar R
This is the snippet of the code in the systemV init system that controls
the serial console login
depending on the token

 TOKENEXIST=`grep TOKEN= /proc/cmdline`
TOKEN=0
if [ X$TOKENEXIST != X ]; then
   #If token is pass as a command line arg, use it.
   TOKEN=`sed 's/.*TOKEN=//; s/ .*//' /proc/cmdline`
fi

TOKENOVERRIDE=`grep TOKENOVERRIDE= /proc/cmdline`
if [ X$TOKENOVERRIDE != X ]; then
   #If token is pass as a command line arg, use it.
   OVERRIDE=`sed 's/.*TOKENOVERRIDE=//; s/ .*//' /proc/cmdline`
   let TOKEN = $TOKEN  $OVERRIDE
fi

echo TOKEN = $TOKEN

let CONSOLE_LOGIN = $TOKEN  512
if [ $CONSOLE_LOGIN -ne 0 ];  then
echo [`eval $uptime`]: Begin Console Access
/etc/console_login 
echo eCM console is enabled
export ENABLE_ECM_CONSOLE=y
else
echo [`eval $uptime`]: Token doesn't allow console access
export ENABLE_ECM_CONSOLE=n
fi



I am trying to implement the same in the sytemd init system.


On Sun, Apr 19, 2015 at 11:48 AM, Andrei Borzenkov arvidj...@gmail.com
wrote:

 В Sat, 18 Apr 2015 19:54:50 +0530
 Praveen kumar R praveenrgo...@gmail.com пишет:

  Yes it's a kernel command line arg, it is board specific token introduced
  to control the serial console.
  if defined serial console should not be enabled.
 

 Sorry I do not understand this sentence. define what? Please give
 exact example of kernel command line and explain what behavior you
 expect in this case.

  we have this in place for other system initializing system - sytemV ,
 where
  depending
 
  On Fri, Apr 17, 2015 at 4:24 PM, Lennart Poettering 
 lenn...@poettering.net
  javascript:_e(%7B%7D,'cvml','lenn...@poettering.net'); wrote:
 
   On Fri, 17.04.15 15:54, Praveen kumar R (praveenrgo...@gmail.com
   javascript:_e(%7B%7D,'cvml','praveenrgo...@gmail.com');) wrote:
  
I have a token passed on by command line argument on which I need to
   decide
to start the serial
  
   On which command line? Kernel command line? What kind of token?
  
console or not. I plan to tweak the getty*ttyS0.service and add the
script which validates the token and starts the console.
   
Is this the right approach or is there any better way of handling it
 ??
  
   To get a login getty on the serial port its sufficient to add
   console=ttyS0... to the kernel cmdline. systemd automatically starts a
   serial getty automatically on the first terminal the kernel console is
   pointing to.
  
   Lennart
  
   --
   Lennart Poettering, Red Hat
  


___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] controlling serial console using a token

2015-04-19 Thread Andrei Borzenkov
В Mon, 20 Apr 2015 09:09:09 +0530
Praveen kumar R praveenrgo...@gmail.com пишет:

 This is the snippet of the code in the systemV init system that controls
 the serial console login
 depending on the token
 
  TOKENEXIST=`grep TOKEN= /proc/cmdline`
 TOKEN=0
 if [ X$TOKENEXIST != X ]; then
#If token is pass as a command line arg, use it.
TOKEN=`sed 's/.*TOKEN=//; s/ .*//' /proc/cmdline`
 fi
 
 TOKENOVERRIDE=`grep TOKENOVERRIDE= /proc/cmdline`
 if [ X$TOKENOVERRIDE != X ]; then
#If token is pass as a command line arg, use it.
OVERRIDE=`sed 's/.*TOKENOVERRIDE=//; s/ .*//' /proc/cmdline`
let TOKEN = $TOKEN  $OVERRIDE
 fi
 
 echo TOKEN = $TOKEN
 
 let CONSOLE_LOGIN = $TOKEN  512
 if [ $CONSOLE_LOGIN -ne 0 ];  then
 echo [`eval $uptime`]: Begin Console Access
 /etc/console_login 
 echo eCM console is enabled
 export ENABLE_ECM_CONSOLE=y
 else
 echo [`eval $uptime`]: Token doesn't allow console access
 export ENABLE_ECM_CONSOLE=n
 fi
 
 
 
 I am trying to implement the same in the sytemd init system.
 

The straightforward approach is to put this code in generator that
parses command line. It can mask standard console service and create
unit for your console.

 
 On Sun, Apr 19, 2015 at 11:48 AM, Andrei Borzenkov arvidj...@gmail.com
 wrote:
 
  В Sat, 18 Apr 2015 19:54:50 +0530
  Praveen kumar R praveenrgo...@gmail.com пишет:
 
   Yes it's a kernel command line arg, it is board specific token introduced
   to control the serial console.
   if defined serial console should not be enabled.
  
 
  Sorry I do not understand this sentence. define what? Please give
  exact example of kernel command line and explain what behavior you
  expect in this case.
 
   we have this in place for other system initializing system - sytemV ,
  where
   depending
  
   On Fri, Apr 17, 2015 at 4:24 PM, Lennart Poettering 
  lenn...@poettering.net
   javascript:_e(%7B%7D,'cvml','lenn...@poettering.net'); wrote:
  
On Fri, 17.04.15 15:54, Praveen kumar R (praveenrgo...@gmail.com
javascript:_e(%7B%7D,'cvml','praveenrgo...@gmail.com');) wrote:
   
 I have a token passed on by command line argument on which I need to
decide
 to start the serial
   
On which command line? Kernel command line? What kind of token?
   
 console or not. I plan to tweak the getty*ttyS0.service and add the
 script which validates the token and starts the console.

 Is this the right approach or is there any better way of handling it
  ??
   
To get a login getty on the serial port its sufficient to add
console=ttyS0... to the kernel cmdline. systemd automatically starts a
serial getty automatically on the first terminal the kernel console is
pointing to.
   
Lennart
   
--
Lennart Poettering, Red Hat
   
 
 

___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] controlling serial console using a token

2015-04-19 Thread Praveen kumar R
You mean in the *getty-generator.c ?*


On Mon, Apr 20, 2015 at 9:14 AM, Andrei Borzenkov arvidj...@gmail.com
wrote:

 В Mon, 20 Apr 2015 09:09:09 +0530
 Praveen kumar R praveenrgo...@gmail.com пишет:

  This is the snippet of the code in the systemV init system that controls
  the serial console login
  depending on the token
 
   TOKENEXIST=`grep TOKEN= /proc/cmdline`
  TOKEN=0
  if [ X$TOKENEXIST != X ]; then
 #If token is pass as a command line arg, use it.
 TOKEN=`sed 's/.*TOKEN=//; s/ .*//' /proc/cmdline`
  fi
 
  TOKENOVERRIDE=`grep TOKENOVERRIDE= /proc/cmdline`
  if [ X$TOKENOVERRIDE != X ]; then
 #If token is pass as a command line arg, use it.
 OVERRIDE=`sed 's/.*TOKENOVERRIDE=//; s/ .*//' /proc/cmdline`
 let TOKEN = $TOKEN  $OVERRIDE
  fi
 
  echo TOKEN = $TOKEN
 
  let CONSOLE_LOGIN = $TOKEN  512
  if [ $CONSOLE_LOGIN -ne 0 ];  then
  echo [`eval $uptime`]: Begin Console Access
  /etc/console_login 
  echo eCM console is enabled
  export ENABLE_ECM_CONSOLE=y
  else
  echo [`eval $uptime`]: Token doesn't allow console access
  export ENABLE_ECM_CONSOLE=n
  fi
 
 
 
  I am trying to implement the same in the sytemd init system.
 

 The straightforward approach is to put this code in generator that
 parses command line. It can mask standard console service and create
 unit for your console.

 
  On Sun, Apr 19, 2015 at 11:48 AM, Andrei Borzenkov arvidj...@gmail.com
  wrote:
 
   В Sat, 18 Apr 2015 19:54:50 +0530
   Praveen kumar R praveenrgo...@gmail.com пишет:
  
Yes it's a kernel command line arg, it is board specific token
 introduced
to control the serial console.
if defined serial console should not be enabled.
   
  
   Sorry I do not understand this sentence. define what? Please give
   exact example of kernel command line and explain what behavior you
   expect in this case.
  
we have this in place for other system initializing system - sytemV ,
   where
depending
   
On Fri, Apr 17, 2015 at 4:24 PM, Lennart Poettering 
   lenn...@poettering.net
javascript:_e(%7B%7D,'cvml','lenn...@poettering.net'); wrote:
   
 On Fri, 17.04.15 15:54, Praveen kumar R (praveenrgo...@gmail.com
 javascript:_e(%7B%7D,'cvml','praveenrgo...@gmail.com');) wrote:

  I have a token passed on by command line argument on which I
 need to
 decide
  to start the serial

 On which command line? Kernel command line? What kind of token?

  console or not. I plan to tweak the getty*ttyS0.service and add
 the
  script which validates the token and starts the console.
 
  Is this the right approach or is there any better way of
 handling it
   ??

 To get a login getty on the serial port its sufficient to add
 console=ttyS0... to the kernel cmdline. systemd automatically
 starts a
 serial getty automatically on the first terminal the kernel
 console is
 pointing to.

 Lennart

 --
 Lennart Poettering, Red Hat

  
  


___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] controlling serial console using a token

2015-04-18 Thread Praveen kumar R
Yes it's a kernel command line arg, it is board specific token introduced
to control the serial console.
if defined serial console should not be enabled.

we have this in place for other system initializing system - sytemV , where
depending

On Fri, Apr 17, 2015 at 4:24 PM, Lennart Poettering lenn...@poettering.net
javascript:_e(%7B%7D,'cvml','lenn...@poettering.net'); wrote:

 On Fri, 17.04.15 15:54, Praveen kumar R (praveenrgo...@gmail.com
 javascript:_e(%7B%7D,'cvml','praveenrgo...@gmail.com');) wrote:

  I have a token passed on by command line argument on which I need to
 decide
  to start the serial

 On which command line? Kernel command line? What kind of token?

  console or not. I plan to tweak the getty*ttyS0.service and add the
  script which validates the token and starts the console.
 
  Is this the right approach or is there any better way of handling it ??

 To get a login getty on the serial port its sufficient to add
 console=ttyS0... to the kernel cmdline. systemd automatically starts a
 serial getty automatically on the first terminal the kernel console is
 pointing to.

 Lennart

 --
 Lennart Poettering, Red Hat

___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] controlling serial console using a token

2015-04-17 Thread Lennart Poettering
On Fri, 17.04.15 15:54, Praveen kumar R (praveenrgo...@gmail.com) wrote:

 I have a token passed on by command line argument on which I need to decide
 to start the serial

On which command line? Kernel command line? What kind of token?

 console or not. I plan to tweak the getty*ttyS0.service and add the
 script which validates the token and starts the console.
 
 Is this the right approach or is there any better way of handling it ??

To get a login getty on the serial port its sufficient to add
console=ttyS0... to the kernel cmdline. systemd automatically starts a
serial getty automatically on the first terminal the kernel console is
pointing to.

Lennart

-- 
Lennart Poettering, Red Hat
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] controlling serial console using a token

2015-04-17 Thread Praveen kumar R
I have a token passed on by command line argument on which I need to decide
to start the serial

console or not. I plan to tweak the getty*ttyS0.service and add the script
which validates the token

and starts the console.

Is this the right approach or is there any better way of handling it ??


Thanks,

Praveen R
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel