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