Confirming predefined partition layout using kickstart

Peter Åstrand astrand at cendio.se
Tue Nov 27 08:09:43 UTC 2007


On Mon, 26 Nov 2007, Jeremy Katz wrote:

> > Using F8 and Kickstart, we want to predefine everything about partitions, 
> > but also let the user confirm that the disk is going to be wiped. I 
> > thought this could be done with just

> You could go with the route of popping up a dialog in %pre for
> confirmation if that's all you really want. 

Thanks for your help. I've tried a %pre solution now and it seems to work 
great. Here's what I did:

%pre --interpreter /usr/bin/python
TTY = 3
import os
import sys
import snack
import time
import fcntl
import termios
pid = os.fork()
if pid != 0:
    os.wait()
    os._exit(0)
os.system("chvt %d" % TTY)
fd = os.open("/dev/tty%d" % TTY, os.O_RDWR)
os.dup2(fd, 0)
os.dup2(fd, 1)
os.dup2(fd, 2)
sys.stdin = os.fdopen(0, "r")
sys.stdout = os.fdopen(1, "w")
sys.stderr = os.fdopen(2, "w")
os.setsid()
fcntl.ioctl(fd, termios.TIOCSCTTY, 1)
screen = snack.SnackScreen()
if "reboot" == snack.ButtonChoiceWindow(screen, "WARNING", 
    "WARNING! All data on your hard disk will be DELETED!",
    buttons=["reboot", "continue"]):
    os.system("reboot")
    while 1: time.sleep(10)
screen.finish()
os.system("chvt %d" % 1)
%end


Best regards, 
---
Peter Åstrand		ThinLinc Chief Developer
Cendio AB		http://www.cendio.se
Wallenbergs gata 4
583 30 Linköping	Phone: +46-13-21 46 00


More information about the Kickstart-list mailing list