import string
import os
from rhdialog import *
import rhutil

def uncpiogz(file, test):
    # this should probably do the pipe stuff itself, but shell is *so* much
    # easier

    os.chdir("/mnt")

    if (test):
	print "should run via os.system '/bin/gunzip < " + file + " | /bin/cpio -iumd'"
    else:
	os.system("/bin/gunzip < " + file + " | /bin/cpio -iumd")

# installs a bootstrap system from /image/install to /mnt
def installbootstrap(test = 0):
    win = WaitBox('Installing bootstrap system')
    uncpiogz("/image/RedHat/base/fsstnd.cgz", test)
    uncpiogz("/image/RedHat/base/skeleton.cgz", test)
    win.quit()
