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, string
13 from Exceptions import *
17 Setup the install environment:
18 - unmount anything in the temp/sysimg path (possible from previous
20 - create temp directories
22 Expect the following variables from the store:
23 TEMP_PATH the path to download and store temp files to
24 SYSIMG_DIR the directory name of the system image
25 contained in TEMP_PATH
26 PLCONF_DIR The directory to store the configuration file in
28 Sets the following variables:
29 SYSIMG_PATH the directory where the system image will be mounted,
30 (= TEMP_PATH/SYSIMG_DIR)
33 log.write( "\n\nStep: Install: Initializing.\n" )
35 # make sure we have the variables we need
37 TEMP_PATH= vars["TEMP_PATH"]
39 raise ValueError("TEMP_PATH")
41 SYSIMG_PATH= vars["SYSIMG_PATH"]
43 raise ValueError("SYSIMG_PATH")
45 PLCONF_DIR= vars["PLCONF_DIR"]
47 raise ValueError, "PLCONF_DIR"
50 raise BootManagerException, "Missing variable in vars: %s\n" % var
51 except ValueError, var:
52 raise BootManagerException, "Variable in vars, shouldn't be: %s\n" % var
54 # if this is a fresh install, then nothing should be
55 # here, but we support restarted installs without rebooting
56 # so who knows what the current state is
58 log.write( "Unmounting any previous mounts\n" )
61 # backwards compat, though, we should never hit this case post PL 3.2
62 os.stat("%s/rcfs/taskclass"%SYSIMG_PATH)
63 utils.sysexec_chroot_noerr( SYSIMG_PATH, "umount /rcfs", log )
67 # NOTE: added /sys and /dev b/c some nodes fail due to this when disk is
69 utils.sysexec_noerr( "umount %s/proc" % SYSIMG_PATH , log )
70 utils.sysexec_noerr( "umount %s/mnt/cdrom" % SYSIMG_PATH , log )
71 utils.sysexec_noerr( "umount %s/vservers" % SYSIMG_PATH , log )
72 utils.sysexec_noerr( "umount %s/sys" % SYSIMG_PATH , log )
73 utils.sysexec_noerr( "umount %s/dev" % SYSIMG_PATH , log )
74 utils.sysexec_noerr( "umount %s" % SYSIMG_PATH , log )
75 vars['ROOT_MOUNTED']= 0
77 # log.write( "Removing any old files, directories\n" )
78 # utils.removedir( TEMP_PATH )
80 log.write( "Cleaning up any existing PlanetLab config files\n" )
82 flist = os.listdir( PLCONF_DIR)
84 utils.removedir( file )
88 # create the temp path and sysimg path. since sysimg
89 # path is in temp path, both are created here
90 log.write( "Creating system image path\n" )
91 utils.makedirs( SYSIMG_PATH )