Skip to content

Instantly share code, notes, and snippets.

@ipoddubny
Created February 5, 2013 13:55
Show Gist options
  • Save ipoddubny/4714593 to your computer and use it in GitHub Desktop.
Save ipoddubny/4714593 to your computer and use it in GitHub Desktop.
Asking user for confirmation from RedHat kickstart pre-installation script
%pre --interpreter /usr/bin/python
# -*- coding: utf-8 -*-
import os, sys
from snack import *
def set_tty(n):
f = open('/dev/tty%d' % n, 'a')
os.dup2(f.fileno(), sys.stdin.fileno())
os.dup2(f.fileno(), sys.stdout.fileno())
os.dup2(f.fileno(), sys.stderr.fileno())
set_tty(1)
screen = SnackScreen()
def CheckCancel(ret):
if ret == 'cancel':
screen.finish();
os.execlp("reboot","");
sys.exit(0);
x = ButtonChoiceWindow(screen, "Installer", "Press Ok to proceed...")
CheckCancel(x)
screen.finish()
set_tty(3)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment