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