[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: add a prompt screen to let user confirm disk partition operation



> 
> does anyone know how can I add a custom screen to prompt user to confirm the
> disk operations(they  will lose their disk data) when perform a kickstart
> auto-installation. It's just need add some magic in %pre scripts, Eg. use

This is what we are doing in TLCOS (ThinLinc Client OS):

In ks.cfg:

%pre
/mnt/runtime/confirm-erase
%end

confirm-erase looks like:

#!/usr/bin/python
# -*-mode: python; coding: UTF-8 -*-
#
# Copyright 2002-2008 Cendio AB.
# For more information, see http://www.cendio.com

# FIXME: Determine current VT to switch back to

VT = 8
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" % VT)
fd = os.open("/dev/tty%d" % VT, 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)


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

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]