6 # Copyright (c) 2003 Intel Corporation
9 # Copyright (c) 2004-2006 The Trustees of Princeton University
10 # All rights reserved.
11 # expected /proc/partitions format
13 import os, sys, string
16 from Exceptions import *
20 Setup the install environment:
21 - unmount anything in the temp/sysimg path (possible from previous
23 - create temp directories
25 Expect the following variables from the store:
26 TEMP_PATH the path to download and store temp files to
27 SYSIMG_DIR the directory name of the system image
28 contained in TEMP_PATH
29 PLCONF_DIR The directory to store the configuration file in
31 Sets the following variables:
32 SYSIMG_PATH the directory where the system image will be mounted,
33 (= TEMP_PATH/SYSIMG_DIR)
36 log.write( "\n\nStep: Install: Initializing.\n" )
38 # make sure we have the variables we need
40 TEMP_PATH= vars["TEMP_PATH"]
42 raise ValueError("TEMP_PATH")
44 SYSIMG_PATH= vars["SYSIMG_PATH"]
46 raise ValueError("SYSIMG_PATH")
48 PLCONF_DIR= vars["PLCONF_DIR"]
50 raise ValueError, "PLCONF_DIR"
53 raise BootManagerException, "Missing variable in vars: %s\n" % var
54 except ValueError, var:
55 raise BootManagerException, "Variable in vars, shouldn't be: %s\n" % var
57 # if this is a fresh install, then nothing should be
58 # here, but we support restarted installs without rebooting
59 # so who knows what the current state is
61 log.write( "Unmounting any previous mounts\n" )
64 # backwards compat, though, we should never hit this case post PL 3.2
65 os.stat("%s/rcfs/taskclass"%SYSIMG_PATH)
66 utils.sysexec_chroot_noerr( SYSIMG_PATH, "umount /rcfs", log )
70 utils.sysexec_noerr( "umount %s/proc" % SYSIMG_PATH )
71 utils.sysexec_noerr( "umount %s/mnt/cdrom" % SYSIMG_PATH )
72 utils.sysexec_noerr( "umount %s/vservers" % SYSIMG_PATH )
73 utils.sysexec_noerr( "umount %s" % SYSIMG_PATH )
74 vars['ROOT_MOUNTED']= 0
76 # log.write( "Removing any old files, directories\n" )
77 # utils.removedir( TEMP_PATH )
79 log.write( "Cleaning up any existing PlanetLab config files\n" )
81 flist = os.listdir( PLCONF_DIR)
83 utils.removedir( file )
87 # create the temp path and sysimg path. since sysimg
88 # path is in temp path, both are created here
89 log.write( "Creating system image path\n" )
90 utils.makedirs( SYSIMG_PATH )