/[gli]/branches/overhaul/src/GLIArchitectureTemplate.py
Gentoo

Diff of /branches/overhaul/src/GLIArchitectureTemplate.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 209 Revision 213
1""" 1"""
2Gentoo Linux Installer 2Gentoo Linux Installer
3 3
4$Id: GLIArchitectureTemplate.py,v 1.21 2005/01/05 05:02:00 codeman Exp $ 4$Id: GLIArchitectureTemplate.py,v 1.22 2005/01/05 07:52:28 codeman Exp $
5Copyright 2004 Gentoo Technologies Inc. 5Copyright 2004 Gentoo Technologies Inc.
6 6
7 7
8The ArchitectureTemplate is largely meant to be an abstract class and an 8The ArchitectureTemplate is largely meant to be an abstract class and an
9interface (yes, it is both at the same time!). The purpose of this is to create 9interface (yes, it is both at the same time!). The purpose of this is to create
16from GLIException import * 16from GLIException import *
17# Until I switch my partition code to GLIUtility.spawn() 17# Until I switch my partition code to GLIUtility.spawn()
18import commands 18import commands
19 19
20class ArchitectureTemplate: 20class ArchitectureTemplate:
21
22 def __init__(self,configuration=None, install_profile=None, client_controller=None): 21 def __init__(self,configuration=None, install_profile=None, client_controller=None):
23 self._client_configuration = configuration 22 self._client_configuration = configuration
24 self._install_profile = install_profile 23 self._install_profile = install_profile
25 self._cc = client_controller 24 self._cc = client_controller
26 25
165# ************************************************************************************** 164# **************************************************************************************
166 165
167 166
168 def mount_local_partitions(self): 167 def mount_local_partitions(self):
169 "Mounts all partitions that are on the local machine" 168 "Mounts all partitions that are on the local machine"
170 pass 169 #{ 1: { 'end': 1999871, 'format': False, 'mb': 0,
171 170 #'mountopts': '', 'mountpoint': '', 'start': 63, 'type': 'linux-swap'},
171 #2: { 'end': 240121727, 'format': False, 'mb': 0, 'mountopts': '',
172 #'mountpoint': '', 'start': 1999872, 'type': 'ext3'}}
173 #{'/dev/hdz': {1: {'end': 4, 'mb': 0, 'format': False, 'start': 0, 'mountopts': '', 'mountpoint': '', 'type': 'ext2', 'minor': 1}, 2: {'end': 129, 'mb': 0, 'format': False, 'start': 5, 'mountopts': '', 'mountpoint': '', 'type': 'linux-swap', 'minor': 2}, 3: {'end': 12579, 'mb': 0, 'format': False, 'start': 130, 'mountopts': '', 'mountpoint': '', 'type': 'reiserfs', 'minor': 3}, 4: {'end': 24320, 'mb': 0, 'format': False, 'start': 12580, 'mountopts': '', 'mountpoint': '', 'type': 'reiserfs', 'minor': 4}}}
174
175 parts = self._install_profile.get_partition_tables()
176 for device in parts:
177 #in parts['/dev/hda']
178 for partition in parts[device]:
179 print parts[device][partition]
180 mountpoint = parts[device][partition]['mountpoint']
181 mountopts = parts[device][partition]['mountopts']
182 minor = str(parts[device][partition]['minor'])
183 partition_type = parts[device][partition]['type']
184 if mountpoint:
185 if mountopts:
186 mountopts = "-o "+mountopts+" "
187 if partition_type:
188 partition_type = "-t "+partition_type+" "
189 ret = GLIUtility.spawn("mount "+partition_type+mountopts+device+minor+" "+self._chroot_dir+mountpoint)
190 if not GLIUtility.exitsuccess(ret):
191 raise GLIException("MountError", 'fatal','mount_local_partitions','Could not mount a partition')
192 if partition_type == "linux-swap":
193 ret = GLIUtility.spawn("swapon "+device+minor)
194 if not GLIUtility.exitsuccess(ret):
195 raise GLIException("MountError", 'warning','mount_local_partitions','Could not activate swap')
172 def mount_network_shares(self): 196 def mount_network_shares(self):
173 "Mounts all network shares to the local machine" 197 "Mounts all network shares to the local machine"
174 pass 198 pass
175 199
176 def fetch_sources_from_cd(self): 200 def fetch_sources_from_cd(self):
621 # Add the user 645 # Add the user
622 exitstatus = GLIUtility.spawn('useradd ' + string.join(options) + ' ' + username, chroot=self._chroot_dir) 646 exitstatus = GLIUtility.spawn('useradd ' + string.join(options) + ' ' + username, chroot=self._chroot_dir)
623 if not GLIUtility.exit_success(exitstatus): 647 if not GLIUtility.exit_success(exitstatus):
624 raise GLIException("AddUserError", 'warning', 'set_users', "Failure to add user " + username) 648 raise GLIException("AddUserError", 'warning', 'set_users', "Failure to add user " + username)
625 649
650 def install_bootloader(self):
651 "THIS FUNCTION MUST BE DONE BY THE INDIVIDUAL ARCH"
652 pass
653
626 def _cylinders_to_sectors(self, minor, start, end, sectors_in_cylinder): 654 def _cylinders_to_sectors(self, minor, start, end, sectors_in_cylinder):
627 cylinders = int(end) - int(start) + 1 655 cylinders = int(end) - int(start) + 1
628 total_sectors = cylinders * int(sectors_in_cylinder) 656 total_sectors = cylinders * int(sectors_in_cylinder)
629 start_sector = int(start) * sectors_in_cylinder 657 start_sector = int(start) * sectors_in_cylinder
630 end_sector = start_sector + total_sectors - 1 658 end_sector = start_sector + total_sectors - 1

Legend:
Removed from v.209  
changed lines
  Added in v.213

  ViewVC Help
Powered by ViewVC 1.1.20