Skip to content

Instantly share code, notes, and snippets.

@jagipson
Forked from ipoddubny/ks-pre-dialog.py
Created March 27, 2014 19:43
Show Gist options
  • Save jagipson/9816446 to your computer and use it in GitHub Desktop.
Save jagipson/9816446 to your computer and use it in GitHub Desktop.
%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