Re: Pointers on starting X, then run browser and when it quits, automatically shutdown the computer X

2011-11-01 Thread Kenneth R Westerback
On Mon, Oct 31, 2011 at 01:29:58PM +0100, Henning Brauer wrote:
 * Sime Ramov s...@ramov.com [2011-10-29 13:58]:
  * Tito Mari Francis Escaqo titomarifran...@gmail.com 
  [2011-10-29T17:50+0800]:
   My idea is for the whole system to run off a Live CD, but I'm quite
   lost how to start the X windowing system, then the web browser and
   then automatically shutdown the whole system after quitting web
   browser.
  
  As for the browser starting when X is started, this would do:
  
  echo exec firefox  ~/.xinitrc
 
 and with sth like
 
 PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin/:/usr/local/bin \
 sudo -u display -H /usr/X11R6/bin/startx /var/log/Xdisplay 21 
 /dev/null
 
 in rc.local you even get it automagically on bootup.
 
  When you quit Firefox, X will terminate, too. Your other requirements
  are a bit trickier though.
 
 not really - if you start X in rc.local and don't background it just
 poot halt -p as last command in rc.local.
 
 
 -- 
 Henning Brauer, h...@bsws.de, henn...@openbsd.org
 BS Web Services, http://bsws.de, Full-Service ISP
 Secure Hosting, Mail and DNS Services. Dedicated Servers, Root to Fully 
 Managed
 Henning Brauer Consulting, http://henningbrauer.com/
 

Here's the set of files I used for a year or so to create and operate
'public' computers that only ran Firefox. The clic.sh file, when run
from a fresh install, turned the machine into such a dedicated device
by installing the files provided and editing standard installed
config files. i.e. have all the files on a USB stick or something,
and run clic.sh from that directory.

The pf.conf is to ensure no 'internal' machines (which were all on
non-routable addresses) could be accessed. The rc.local magic was
to allow access to the default gateway, obviously an internal
address. :-).

fvwm so the users could close popup windows.

crontab to shut it down everynight at closing time.

Firefox 3.5 because they needed to run Java apps, and the later
plugin did not (and still doesn't I think) work.

The file missing (firefox35.tgz) I created by starting up firefox once
as 'client' and tar'ing up the resulting .mozilla directory. This was to
ensure meant there was a 'clean' firefox everytime it started up.

It was moderately annoying to have to boot to single user and fiddle with
/etc/ttys to do any maintenance, but I never got around to allowing
remote access.

No great innovation, just a lot of trial and error starting with henning's
advice, a lot googling and reading X Power Tools.

And haven't run it in a year or so, so ymmv.

You might also want to investigate xxxterm and its 'kiosk' mode.

 Ken

== Xinit.local ==
#!/bin/ksh
echo startx -- vt05 | su - client


== adduser.conf ==
#
# $OpenBSD: adduser.perl,v 1.53 2007/01/03 15:26:04 simon Exp $
# /etc/adduser.conf - automatic generated by adduser(8)
#
# Note: adduser reads *and* writes this file.
#   You may change values, but don't add new things before the
#   line ``## DO NOT DELETE THIS LINE!''
#

# verbose = [0-2]
verbose = 1

# Get new password for new users
# defaultpasswd =  yes | no
defaultpasswd = yes

# Default encryption method for user passwords
# Methods are all those listed in login.conf(5)
encryptionmethod = auto

# copy dotfiles from this dir (/etc/skel or no)
dotdir = /etc/skel

# send this file to new user (/etc/adduser.message or no)
send_message = no

# config file for adduser (/etc/adduser.conf)
config = /etc/adduser.conf

# logfile (/var/log/adduser or no)
logfile = /var/log/adduser

# default HOME directory (/home)
home = /home

# List of directories where shells located
# path = ('/bin', '/usr/bin', '/usr/local/bin')
path = ('/bin', '/usr/bin', '/usr/local/bin')

# common shell list, first element has higher priority
# shellpref = ('bash', 'tcsh', 'ksh', 'csh', 'sh')
shellpref = ('csh', 'sh', 'bash', 'tcsh', 'ksh', 'nologin')

# defaultshell if not empty (bash)
defaultshell = ksh

# defaultgroup ('USER' for same as username or any other valid group)
defaultgroup = USER

# new users get this uid
uid_start = 1000
uid_end = 2147483647

# default login.conf(5) login class
defaultclass = default

# login classes available from login.conf(5)
# login_classes = ('default', 'daemon', 'staff')
login_classes = ('default', 'daemon', 'staff', 'authpf')

## DO NOT DELETE THIS LINE!
## your own variables, see /etc/adduser.message

## end


== all.js.append ==
//
pref(general.config.filename, firefox.cfg);
pref(general.config.obscure_value, 0);


== clic.sh ==
#!/bin/ksh

# Turn a normal OpenBSD install into a Clic! station.
: ${CLICNHOME:=.}
: ${PKG_PATH:=../4.9/packages/i386}
export CLICNHOME PKG_PATH

# 1) Save original files for reference.
cp /etc/pf.conf /etc/pf.conf.orig
cp /etc/ttys /etc/ttys.orig
cp /etc/adduser.conf /etc/adduser.conf.orig
cp /etc/rc /etc/rc.orig
cp /etc/rc.conf.local /etc/rc.conf.local.orig
cp /etc/rc.local /etc/rc.local.orig
cp /etc/X11/xorg.conf 

Re: Pointers on starting X, then run browser and when it quits, automatically shutdown the computer X

2011-10-31 Thread Henning Brauer
* Sime Ramov s...@ramov.com [2011-10-29 13:58]:
 * Tito Mari Francis Escaqo titomarifran...@gmail.com 
 [2011-10-29T17:50+0800]:
  My idea is for the whole system to run off a Live CD, but I'm quite
  lost how to start the X windowing system, then the web browser and
  then automatically shutdown the whole system after quitting web
  browser.
 
 As for the browser starting when X is started, this would do:
 
 echo exec firefox  ~/.xinitrc

and with sth like

PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin/:/usr/local/bin \
sudo -u display -H /usr/X11R6/bin/startx /var/log/Xdisplay 21 /dev/null

in rc.local you even get it automagically on bootup.

 When you quit Firefox, X will terminate, too. Your other requirements
 are a bit trickier though.

not really - if you start X in rc.local and don't background it just
poot halt -p as last command in rc.local.


-- 
Henning Brauer, h...@bsws.de, henn...@openbsd.org
BS Web Services, http://bsws.de, Full-Service ISP
Secure Hosting, Mail and DNS Services. Dedicated Servers, Root to Fully Managed
Henning Brauer Consulting, http://henningbrauer.com/



Re: Pointers on starting X, then run browser and when it quits, automatically shutdown the computer X

2011-10-29 Thread Sime Ramov
* Tito Mari Francis Escaqo titomarifran...@gmail.com [2011-10-29T17:50+0800]:
 My idea is for the whole system to run off a Live CD, but I'm quite
 lost how to start the X windowing system, then the web browser and
 then automatically shutdown the whole system after quitting web
 browser.

As for the browser starting when X is started, this would do:

echo exec firefox  ~/.xinitrc

When you quit Firefox, X will terminate, too. Your other requirements
are a bit trickier though.



Re: Pointers on starting X, then run browser and when it quits, automatically shutdown the computer X

2011-10-29 Thread MERIGHI Marcus
titomarifran...@gmail.com (Tito Mari Francis Escaqo), 2011.10.29 (Sat) 11:50 
(CEST):
 My task is to design a kiosk that will only display a web browser, Firefox
 for now (I'd also appreciate guide on other graphical web browser) when
 OpenBSD boots up. When the browser quits, the whole system should shutdown
 as well. Can you please point me to guides how to do this? My idea is for
 the whole system to run off a Live CD, but I'm quite lost how to start the X
 windowing system, then the web browser and then automatically shutdown the
 whole system after quitting web browser. I hope you can help me.
 Thank you very much.
 
see also:
http://marc.info/?l=openbsd-miscm=108366855830141
http://marc.info/?l=openbsd-miscm=105658656000695
my task was to connect to a rdp server; tried all of the various
approaches and this is how it finally worked:


$ grep autologin /etc/ttys
ttyC1   /usr/local/sbin/autologin.getty vt220 on  secure

$ cat autologin.getty 
#!/bin/sh -e
TERM=vt220 /usr/local/sbin/autologin  /dev/$1  /dev/$1

$ cat autologin   
#!/bin/sh -e
exec su -l autologin

$ grep autologin /etc/passwd
autologin:bla:1001:1001::0:0:AUTOMATIC Login:/home/autologin:/bin/ksh

$ cat autologin/.profile 
PATH=$HOME/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/X11R6/bin:/usr/local/bin:/usr/local/sbin:/usr/games:.
export PATH HOME TERM
rm ~/.serverauth.*  print -n 
sleep 3 # more important than you think
/usr/X11R6/bin/startx -- -nolisten tcp  shutdown -hp now
exit

$ cat autologin/.xinitrc  
/usr/X11R6/bin/xset -dpms 
/usr/X11R6/bin/xset s off 
/usr/X11R6/bin/xsetroot -solid black 
/usr/X11R6/bin/fvwm || /usr/X11R6/bin/xterm

$ cat autologin/.fvwmrc 
AddToFunc InitFunction
+ I Exec exec run-your-app-and-than-shutdown.sh

$ grep autologin /etc/sudoers 
autologin ALL= NOPASSWD: /sbin/shutdown -hp now
autologin ALL= NOPASSWD: /sbin/reboot

Bye, 

Marcus