Andrei POPESCU wrote: > Todd Maurice wrote: > > I have been using Hello World script to reduce problems that might > > arise from using a complex script but later I would like to use this > > setup for autologin. > > Uhh, another case of XY problem > http://meta.stackoverflow.com/questions/66377/what-is-the-xy-problem
Ugh, yes, another good case of the XY problem. Sigh. To make this thread easier to find by search engines I will mention that this would be a Linux text console kiosk mode. > > #!/bin/bash > > sed -i '54d' /etc/inittab > > echo "1:2345:respawn:/bin/login -f user tty1 </dev/tty1 >/dev/tty1 2>&1" >> > > /etc/inittab > > To accomplish what you want I would change /etc/inittab with a > late_command, *but* the commands above are not really safe: > > 1. you rely on the specific format of /etc/inittab > 2. your script is not indempotent, just think what happens if you run it > several times > 3. sed can do the change in one go ;) > > This should work (all in one line): > > sed -i -e 's,1:2345:respawn:\/sbin\/getty 38400 > tty1,1:2345:respawn:\/bin/login -f user tty1 <\/dev\/tty1 >\/dev\/tty1 > 2>&>1,' /etc/inittab The above may have had some mailer munging. I see two simple typos. The '&' is special to sed and is lost in the resulting line. It needs to be escaped with \&. Also not a problem but since '/' is avoided as the sed substitute character it means that they don't need to be escaped in the string and one of them had been missed anyway. As a matter of preference I would continue to use getty for this and have it set up the tty state. Then it can call /bin/login. Therefore I would still continue to use getty. This works in Wheezy 7 but not in the old Squeeze 6. (Note that getty -a username is new in Wheezy 7 and doesn't exist in Squeeze 6.) Then the redirections are no longer needed. It is just a small amount simpler then. I tested this and it worked for me on a Wheezy 7 install. sed -i 's,1:2345:respawn:/sbin/getty .*tty1 *$,1:2345:respawn:/sbin/getty -a USERNAME 38400 tty1,' /tmp/inittab Change /tmp/inittab to /etc/inittab which I left intentionally so that it couldn't do harm by a stray paste. I will mention that in Wheezy 7 the getty annoyingly to those of us who care about boot errors automatically clears the boot screen unless the --noclear option is given. You might want it. YMMV. 1:2345:respawn:/sbin/getty --noclear -a USERNAME 38400 tty1 Bob
signature.asc
Description: Digital signature