check in all bootmanager sources
[bootmanager.git] / source / steps / ConfirmInstallWithUser.py
1 from Exceptions import *
2
3 welcome_message= \
4 """
5 ********************************************************************************
6 *                                                                              *
7 *                             Welcome to PlanetLab                             *
8 *                             ~~~~~~~~~~~~~~~~~~~~                             *
9 *                                                                              *
10 * The PlanetLab boot CD allows you to automatically install this machine as a  *
11 * node within the PlanetLab overlay network.                                   *
12 *                                                                              *
13 * PlanetLab is a global overlay network for developing and accessing new       *
14 * network services. Our goal is to grow to 1000 geographically distributed     *
15 * nodes, connected by a diverse collection of links. Toward this end, we are   *
16 * putting PlanetLab nodes into edge sites, co-location and routing centers,    *
17 * and homes (i.e., at the end of DSL lines and cable modems). PlanetLab is     *
18 * designed to support both short-term experiments and long-running services.   *
19 * Currently running services include network weather maps, network-embedded    *
20 * storage, peer-to-peer networks, and content distribution networks.           *
21 *                                                                              *
22 * Information on joining PlanetLab available at planet-lab.org/consortium/     *
23 *                                                                              *
24 ********************************************************************************
25
26 WARNING : Installing PlanetLab will remove any existing operating system and 
27           data from this computer.
28 """
29
30
31 def Run( vars, log ):
32     """
33     Ask the user if we really want to wipe this machine.
34
35     Return 1 if the user accept, 0 if the user denied, and
36     a BootManagerException if anything unexpected occurred.
37     """
38
39     log.write( "\n\nStep: Confirming install with user.\n" )
40     
41     try:
42         confirmation= ""
43         install= 0
44         print welcome_message
45         
46         while confirmation not in ("yes","no"):
47             confirmation= \
48                 raw_input("Are you sure you wish to continue (yes/no):")
49         install= confirmation=="yes"
50     except EOFError, e:
51         pass
52     except KeyboardInterrupt, e:
53         pass
54     
55     if install:
56         log.write( "\nUser accepted install.\n" )
57     else:
58         log.write( "\nUser canceled install.\n" )
59         
60     return install