3 # Copyright (c) 2003 Intel Corporation
6 # Copyright (c) 2004-2006 The Trustees of Princeton University
8 # expected /proc/partitions format
10 import os, sys, shutil
18 Setup the install environment:
19 - unmount anything in the temp/sysimg path (possible from previous
21 - create temp directories
23 Expect the following variables from the store:
24 TEMP_PATH the path to download and store temp files to
25 SYSIMG_DIR the directory name of the system image
26 contained in TEMP_PATH
27 PLCONF_DIR The directory to store the configuration file in
29 Sets the following variables:
30 SYSIMG_PATH the directory where the system image will be mounted,
31 (= TEMP_PATH/SYSIMG_DIR)
34 log.write( "\n\nStep: Install: Initializing.\n" )
36 # make sure we have the variables we need
38 TEMP_PATH= vars["TEMP_PATH"]
40 raise ValueError("TEMP_PATH")
42 SYSIMG_PATH= vars["SYSIMG_PATH"]
44 raise ValueError("SYSIMG_PATH")
46 PLCONF_DIR= vars["PLCONF_DIR"]
48 raise ValueError, "PLCONF_DIR"
51 raise BootManagerException, "Missing variable in vars: %s\n" % var
52 except ValueError, var:
53 raise BootManagerException, "Variable in vars, shouldn't be: %s\n" % var
55 # if this is a fresh install, then nothing should be
56 # here, but we support restarted installs without rebooting
57 # so who knows what the current state is
59 log.write( "Unmounting any previous mounts\n" )
62 # backwards compat, though, we should never hit this case post PL 3.2
63 os.stat("%s/rcfs/taskclass"%SYSIMG_PATH)
64 utils.sysexec_noerr( "chroot %s umount /rcfs" % SYSIMG_PATH, log )
68 utils.sysexec_noerr( "umount %s/proc" % SYSIMG_PATH )
69 utils.sysexec_noerr( "umount %s/mnt/cdrom" % SYSIMG_PATH )
70 utils.sysexec_noerr( "umount %s/vservers" % SYSIMG_PATH )
71 utils.sysexec_noerr( "umount %s" % SYSIMG_PATH )
72 vars['ROOT_MOUNTED']= 0
74 log.write( "Removing any old files, directories\n" )
75 utils.removedir( TEMP_PATH )
77 log.write( "Cleaning up any existing PlanetLab config files\n" )
78 utils.removedir( PLCONF_DIR )
80 # create the temp path and sysimg path. since sysimg
81 # path is in temp path, both are created here
82 log.write( "Creating system image path\n" )
83 utils.makedirs( SYSIMG_PATH )