def execute(self): ctx.screens.disableNext() self.info.show() self.info.setAlignment(QLabel.AlignCenter) try: ctx.debugger.log("Trying to umount %s" % (ctx.consts.target_dir + "/home")) yali.sysutils.umount(ctx.consts.target_dir + "/home") ctx.debugger.log("Trying to umount %s" % (ctx.consts.target_dir)) yali.sysutils.umount(ctx.consts.target_dir) except: ctx.debugger.log("Umount Failed.") pass w = RebootWidget(self) ctx.debugger.log("Show reboot dialog.") self.dialog = WarningDialog(w, self) self.dialog.exec_loop() ctx.debugger.log("Trying to eject the CD.") # remove cd... yali.sysutils.eject_cdrom() ctx.debugger.log("Yali, fastreboot calling..") # store log content if ctx.debugEnabled: open(ctx.consts.log_file,"w").write(str(ctx.debugger.traceback.plainLogs)) time.sleep(4) yali.sysutils.fastreboot()
def execute(self): def autopartDevice(): dev = self.device # fist delete partitions on device dev.deleteAllPartitions() dev.commit() p = dev.addPartition(parttype.root.parted_type, parttype.root.filesystem, dev.getFreeMB(), parttype.root.parted_flags) p = dev.getPartition(p.num) # get partition.Partition dev.commit() ctx.partrequests.append( request.MountRequest(p, parttype.root)) ctx.partrequests.append( request.FormatRequest(p, parttype.root)) ctx.partrequests.append( request.SwapFileRequest(p, parttype.root)) if self.accept_auto.isChecked(): # show confirmation dialog w = WarningWidget(self) self.dialog = WarningDialog(w, self) if not self.dialog.exec_loop(): # disabled by weaver ctx.screens.enablePrev() self.updateUI() return False # show information window... info_window = InformationWindow(self, _("Please wait while formatting!")) # inform user self.info.setText(_('<font color="#FF6D19">Preparing your disk for installation!</font>')) ctx.screens.processEvents() # remove all other requests (if there are any). ctx.partrequests.remove_all() ctx.use_autopart = True autopartDevice() # need to wait for devices to be created time.sleep(1) ctx.partrequests.applyAll() # skip next screen() num = ctx.screens.getCurrentIndex() + 1 ctx.screens.goToScreen(num) # close window info_window.close(True) return True
def execute(self): def autopartDevice(): dev = self.device # fist delete partitions on device dev.deleteAllPartitions() dev.commit() p = dev.addPartition(parttype.root.parted_type, parttype.root.filesystem, dev.getFreeMB(), parttype.root.parted_flags) p = dev.getPartition(p.num) # get partition.Partition dev.commit() ctx.partrequests.append( request.MountRequest(p, parttype.root)) ctx.partrequests.append( request.FormatRequest(p, parttype.root)) ctx.partrequests.append( request.SwapFileRequest(p, parttype.root)) if self.accept_auto.isChecked(): # show confirmation dialog w = WarningWidget(self) self.dialog = WarningDialog(w, self) if not self.dialog.exec_loop(): return False # inform user self.info.setText(_('<font color="#FF6D19">Preparing your disk for installation!</font>')) ctx.screens.processEvents() ctx.use_autopart = True autopartDevice() # need to wait for devices to be created time.sleep(1) ctx.partrequests.applyAll() # skip next screen() num = ctx.screens.getCurrentIndex() + 1 ctx.screens.goToScreen(num) return True
def execute(self): isAdminSet = False for i in range(self.userList.count()): u = self.userList.item(i).getUser() if "wheel" in u.groups: isAdminSet = True if not isAdminSet: # show confirmation dialog w = WarningWidget(self) w.warning.setText(_('''<b> <p>You have not defined an administrator!</p> <p>A user without administrative rights cannot complete system maintenance tasks. You are strongly encouraged to define an administrator user.</p> <p>Click "Cancel" to define an administrator user (recommended) or "OK" to go to next screen.</p> </b> ''')) self.dialog = WarningDialog(w, self) if not self.dialog.exec_loop(): ctx.screens.enablePrev() ctx.screens.enableNext() return False # reset and fill pending_users yali.users.reset_pending_users() ctx.installData.autoLoginUser = str(self.autoLogin.currentText()) for i in range(self.userList.count()): u = self.userList.item(i).getUser() ctx.installData.users.append(u) yali.users.pending_users.append(u) ctx.debugger.log("USER::%s"%u.username) return True
def execute(self): ctx.screens.disableNext() self.info.show() self.info.setAlignment(QLabel.AlignCenter) # FIXME: this is a dirty and temporary workaround.. will be removed. # os.chmod(ctx.consts.target_dir + "/var/tmp", 01777) # remove cd... w = RebootWidget(self) self.dialog = WarningDialog(w, self) self.dialog.exec_loop() try: mount.umount(ctx.consts.target_dir + "/home") except: pass mount.umount(ctx.consts.target_dir) reboot.fastreboot()
def execute(self): ctx.screens.disableNext() self.info.show() self.info.setAlignment(QLabel.AlignCenter) if yali.sysutils.checkYaliDebug(): open(ctx.consts.log_file,"w").write(ctx.debugger.traceback.plainLogs) # remove cd... w = RebootWidget(self) self.dialog = WarningDialog(w, self) self.dialog.exec_loop() try: yali.sysutils.umount(ctx.consts.target_dir + "/home") except: pass yali.sysutils.umount(ctx.consts.target_dir) yali.sysutils.fastreboot()
class Widget(SetupUsersWidget, ScreenWidget): help = _(''' <font size="+2">User setup</font> <font size="+1"> <p> Other than the system administrator user, you can create a user account for your daily needs, i.e reading your e-mail, surfing on the web and searching for daily recipe offerings. Usual password assignment rules also apply here: This password should be unique and private. Choose a password difficult to guess, but easy to remember. </p> <p> Click Next button to proceed. </p> </font> ''') def __init__(self, *args): apply(SetupUsersWidget.__init__, (self,) + args) self.pix.setPixmap(ctx.iconfactory.newPixmap("users")) self.pass_error.setText("") self.edititemindex = None # User Icons self.normalUserIcon = ctx.iconfactory.newPixmap("user_normal") self.superUserIcon = ctx.iconfactory.newPixmap("user_root") # KDE AutoLogin self.autoLoginUser = "" # Give Admin Privileges default self.admin.setChecked(True) self.createButton.setEnabled(False) self.connect(self.pass1, SIGNAL("textChanged(const QString &)"), self.slotTextChanged) self.connect(self.pass2, SIGNAL("textChanged(const QString &)"), self.slotTextChanged) self.connect(self.username, SIGNAL("textChanged(const QString &)"), self.slotTextChanged) self.connect(self.createButton, SIGNAL("clicked()"), self.slotCreateUser) self.connect(self.deleteButton, SIGNAL("clicked()"), self.slotDeleteUser) self.connect(self.userList, SIGNAL("doubleClicked(QListBoxItem*)"), self.slotEditUser) self.connect(self.pass2, SIGNAL("returnPressed()"), self.slotReturnPressed) self.checkUsers() def shown(self): from os.path import basename ctx.debugger.log("%s loaded" % basename(__file__)) ctx.installData.users = [] ctx.installData.autoLoginUser = None self.checkUsers() self.checkCapsLock() self.username.setFocus() def execute(self): isAdminSet = False for i in range(self.userList.count()): u = self.userList.item(i).getUser() if "wheel" in u.groups: isAdminSet = True if not isAdminSet: # show confirmation dialog w = WarningWidget(self) w.warning.setText(_('''<b> <p>You have not defined an administrator!</p> <p>A user without administrative rights cannot complete system maintenance tasks. You are strongly encouraged to define an administrator user.</p> <p>Click "Cancel" to define an administrator user (recommended) or "OK" to go to next screen.</p> </b> ''')) self.dialog = WarningDialog(w, self) if not self.dialog.exec_loop(): ctx.screens.enablePrev() ctx.screens.enableNext() return False # reset and fill pending_users yali.users.reset_pending_users() ctx.installData.autoLoginUser = str(self.autoLogin.currentText()) for i in range(self.userList.count()): u = self.userList.item(i).getUser() ctx.installData.users.append(u) yali.users.pending_users.append(u) ctx.debugger.log("USER::%s"%u.username) return True def checkCapsLock(self): if pardus.xorg.capslock.isOn(): self.caps_error.setText( _('<font color="#FF6D19">Caps Lock is on!</font>')) else: self.caps_error.setText("") def keyReleaseEvent(self, e): self.checkCapsLock() def slotTextChanged(self): p1 = self.pass1.text() p2 = self.pass2.text() if not p1 == '' and p1 == self.username.text(): self.pass_error.setText( _('<font color="#FF6D19">Don\'t use your user name as a password.</font>')) self.pass_error.setAlignment(QLabel.AlignCenter) return self.createButton.setEnabled(False) elif p2 != p1 and p2: self.pass_error.setText( _('<font color="#FF6D19">Passwords do not match!</font>')) self.pass_error.setAlignment(QLabel.AlignCenter) return self.createButton.setEnabled(False) elif len(p1) == len(p2) and len(p2) < 4 and not p1=='': self.pass_error.setText( _('<font color="#FF6D19">Password is too short!</font>')) self.pass_error.setAlignment(QLabel.AlignCenter) return self.createButton.setEnabled(False) else: self.pass_error.setText("") if self.username.text() and p1 and p2: self.createButton.setEnabled(True) else: self.createButton.setEnabled(False) def slotCreateUser(self): u = yali.users.User() u.username = self.username.text().ascii() # ignore last character. see bug #887 u.realname = unicode(self.realname.text().utf8().data())[:-1] u.passwd = self.pass1.text().ascii() u.groups = ["users", "pnp", "pnpadmin", "removable", "disk", "audio", "video", "power", "dialout"] pix = self.normalUserIcon if self.admin.isOn(): u.groups.append("wheel") pix = self.superUserIcon self.createButton.setText(_("Create User")) existsInList = [i for i in range(self.userList.count()) if self.userList.item(i).getUser().username == u.username] # check user validity if u.exists() or (existsInList and self.edititemindex == None): self.pass_error.setText( _('<font color="#FF6D19">Username exists, choose another one!</font>')) return elif not u.usernameIsValid(): self.pass_error.setText( _('<font color="#FF6D19">Username contains invalid characters!</font>')) return elif not u.realnameIsValid(): self.pass_error.setText( _('<font color="#FF6D19">Realname contains invalid characters!</font>')) return updateItem = None try: self.userList.removeItem(self.edititemindex) self.autoLogin.removeItem(self.edititemindex + 1) except: updateItem = self.edititemindex # nothing wrong. just adding a new user... pass self.edititemindex = None i = UserItem(self.userList, pix, user = u) # add user to auto-login list. self.autoLogin.insertItem(u.username) if updateItem: self.autoLogin.setCurrentItem(self.autoLogin.count()) # clear form self.resetWidgets() ctx.debugger.log("slotCreateUser :: user '%s (%s)' added/updated" % (u.realname,u.username)) ctx.debugger.log("slotCreateUser :: user groups are %s" % str(','.join(u.groups))) # give focus to username widget for a new user. #3280 self.username.setFocus() self.checkUsers() def slotDeleteUser(self): if self.userList.currentItem()==self.edititemindex: self.resetWidgets() self.autoLogin.setCurrentItem(0) self.autoLogin.removeItem(self.userList.currentItem() + 1) self.userList.removeItem(self.userList.currentItem()) self.checkUsers() def slotEditUser(self, item): u = item.getUser() self.username.setText(u.username) self.realname.setText(u.realname) self.pass1.setText(u.passwd) self.pass2.setText(u.passwd) if "wheel" in u.groups: self.admin.setChecked(True) else: self.admin.setChecked(False) self.edititemindex = self.userList.currentItem() self.createButton.setText(_("Update User")) def checkUsers(self): if self.userList.count(): self.deleteButton.setEnabled(True) self.autoLogin.setEnabled(True) ctx.screens.enableNext() else: # there is no user in list, there is nobody to delete self.deleteButton.setEnabled(False) self.autoLogin.setEnabled(False) ctx.screens.disableNext() def resetWidgets(self): # clear all self.username.clear() self.realname.clear() self.pass1.clear() self.pass2.clear() self.admin.setChecked(False) self.createButton.setEnabled(False) def slotReturnPressed(self): self.slotCreateUser()
class Widget(QWidget, ScreenWidget): help = _(''' <font size="+2">Congratulations</font> <font size="+1"> <p> You have successfully installed Pardus, a very easy to use desktop system on your machine. Now you can start playing with your system and stay productive all the time. </p> <P> Click on the Next button to proceed. One note: You remember your password, don't you? </p> </font> ''') def __init__(self, *args): apply(QWidget.__init__, (self,) + args) img = QLabel(self) img.setPixmap(ctx.iconfactory.newPixmap("goodbye")) self.steps = YaliSteps(self) self.info = QLabel(self) self.info.setText( _('<b><font size="+2" color="#FF6D19">Rebooting system. Please wait!</font></b>')) self.info.hide() self.info.setAlignment(QLabel.AlignCenter|QLabel.AlignTop) self.info.setMinimumSize(QSize(0,50)) vbox = QVBoxLayout(self) vbox.addStretch(1) hbox = QHBoxLayout(vbox) hbox.addStretch(1) #FIXME Where is the steps layout ?? hbox.addWidget(img) hbox.addStretch(1) vbox.addStretch(1) vbox.addWidget(self.info) def shown(self): from os.path import basename ctx.debugger.log("%s loaded" % basename(__file__)) ctx.screens.disablePrev() self.processPendingActions() self.steps.slotRunOperations() def execute(self): ctx.screens.disableNext() self.info.show() self.info.setAlignment(QLabel.AlignCenter) try: ctx.debugger.log("Trying to umount %s" % (ctx.consts.target_dir + "/home")) yali.sysutils.umount(ctx.consts.target_dir + "/home") ctx.debugger.log("Trying to umount %s" % (ctx.consts.target_dir)) yali.sysutils.umount(ctx.consts.target_dir) except: ctx.debugger.log("Umount Failed.") pass w = RebootWidget(self) ctx.debugger.log("Show reboot dialog.") self.dialog = WarningDialog(w, self) self.dialog.exec_loop() ctx.debugger.log("Trying to eject the CD.") # remove cd... yali.sysutils.eject_cdrom() ctx.debugger.log("Yali, fastreboot calling..") # store log content if ctx.debugEnabled: open(ctx.consts.log_file,"w").write(str(ctx.debugger.traceback.plainLogs)) time.sleep(4) yali.sysutils.fastreboot() # process pending actions defined in other screens. def processPendingActions(self): comarLink = None def connectToComar(): global comarLink for i in range(20): try: ctx.debugger.log("trying to start comar..") comarLink = comar.Link(sockname=consts.comar_socket_file) break except comar.CannotConnect: time.sleep(1) ctx.debugger.log("wait comar for 1 second...") if comarLink: return True return False def setHostName(): global comarLink comarLink.Net.Stack.setHostNames(hostnames=ctx.installData.hostName) reply = comarLink.read_cmd() ctx.debugger.log("Hostname set as %s" % ctx.installData.hostName) return True def addUsers(): global comarLink for u in yali.users.pending_users: ctx.debugger.log("User %s adding to system" % u.username) comarLink.User.Manager.addUser(name=u.username, password=u.passwd, realname=u.realname, groups=','.join(u.groups)) ctx.debugger.log("RESULT :: %s" % str(comarLink.read_cmd())) # Enable auto-login if u.username == ctx.installData.autoLoginUser: u.setAutoLogin() return True def setRootPassword(): if not ctx.installData.useYaliFirstBoot: global comarLink comarLink.User.Manager.setUser(uid=0,password=ctx.installData.rootPassword) ctx.debugger.log("RESULT :: %s" % str(comarLink.read_cmd())) return True def writeConsoleData(): yali.localeutils.write_keymap(ctx.installData.keyData.console) ctx.debugger.log("Keymap stored.") return True def migrateXorgConf(): yali.postinstall.migrate_xorg_conf(ctx.installData.keyData.X) ctx.debugger.log("xorg.conf merged.") return True def setPackages(): global comarLink if yali.sysutils.checkYaliParams(param=ctx.consts.firstBootParam): ctx.debugger.log("OemInstall selected.") comarLink.System.Service["kdebase"].setState(state="off") ctx.debugger.log("RESULT :: %s" % str(comarLink.read_cmd())) comarLink.System.Service["yali-firstBoot"].setState(state="on") ctx.debugger.log("RESULT :: %s" % str(comarLink.read_cmd())) return True steps = [{"text":_("Trying to connect COMAR Daemon..."),"operation":connectToComar}, {"text":_("Setting Hostname..."),"operation":setHostName}, {"text":_("Setting Root Password..."),"operation":setRootPassword}, {"text":_("Adding Users..."),"operation":addUsers}, {"text":_("Writing Console Data..."),"operation":writeConsoleData}, {"text":_("Migrating X.org Configuration..."),"operation":migrateXorgConf}, {"text":_("Setting misc. package configurations..."),"operation":setPackages}, {"text":_("Installing BootLoader..."),"operation":self.installBootloader}] self.steps.setOperations(steps) def installBootloader(self): ctx.debugger.log("Bootloader is installing...") loader = yali.bootloader.BootLoader() root_part_req = ctx.partrequests.searchPartTypeAndReqType(parttype.root, partrequest.mountRequestType) _ins_part = root_part_req.partition().getPath() loader.write_grub_conf(_ins_part,ctx.installData.bootLoaderDev) # Check for windows partitions. for d in yali.storage.devices: for p in d.getPartitions(): fs = p.getFSName() if fs in ("ntfs", "fat32"): if is_windows_boot(p.getPath(), fs): win_fs = fs win_dev = basename(p.getDevicePath()) win_root = basename(p.getPath()) loader.grub_conf_append_win(ctx.installData.bootLoaderDev, win_dev, win_root, win_fs) continue # finally install it loader.install_grub(ctx.installData.bootLoaderDev) ctx.debugger.log("Bootloader installed.")
class Widget(AutoPartWidget, ScreenWidget): help = _(''' <font size="+2">Automatic Partitioning</font> <font size="+1"> <p> Pardus can be installed on a variety of hardware. You can install Pardus on an empty disk or hard disk partition. <b>An installation will automatically destroy the previously saved information on selected partitions. </b> </p> <p> Automatic partitioning use your entire disk for Pardus installation. From this screen you can select to automatically partition one of you disks, or you can skip this screen and try manual partitioning. </p> <p> Please refer to Pardus Installing and Using Guide for more information about disk partitioning. </p> </font> ''') def __init__(self, *args): apply(AutoPartWidget.__init__, (self,) + args) self.device = None self.enable_next = False self.device_list.setPaletteBackgroundColor(ctx.consts.bg_color) self.device_list.setPaletteForegroundColor(ctx.consts.fg_color) # initialize all storage devices if not yali.storage.init_devices(): raise GUIException, _("Can't find a storage device!") # fill device list for dev in yali.storage.devices: if dev.getTotalMB() >= ctx.consts.min_root_size: DeviceItem(self.device_list, dev) # select the first disk by default self.device_list.setSelected(0, True) self.connect(self.accept_auto, SIGNAL("clicked()"), self.slotSelectAuto) self.connect(self.manual, SIGNAL("clicked()"), self.slotSelectManual) self.connect(self.device_list, SIGNAL("selectionChanged(QListBoxItem*)"), self.slotDeviceChanged) def shown(self): ctx.screens.enablePrev() self.updateUI() def execute(self): def autopartDevice(): dev = self.device # fist delete partitions on device dev.deleteAllPartitions() dev.commit() p = dev.addPartition(parttype.root.parted_type, parttype.root.filesystem, dev.getFreeMB(), parttype.root.parted_flags) p = dev.getPartition(p.num) # get partition.Partition dev.commit() ctx.partrequests.append( request.MountRequest(p, parttype.root)) ctx.partrequests.append( request.FormatRequest(p, parttype.root)) ctx.partrequests.append( request.SwapFileRequest(p, parttype.root)) if self.accept_auto.isChecked(): # show confirmation dialog w = WarningWidget(self) self.dialog = WarningDialog(w, self) if not self.dialog.exec_loop(): return False # inform user self.info.setText(_('<font color="#FF6D19">Preparing your disk for installation!</font>')) ctx.screens.processEvents() ctx.use_autopart = True autopartDevice() # need to wait for devices to be created time.sleep(1) ctx.partrequests.applyAll() # skip next screen() num = ctx.screens.getCurrentIndex() + 1 ctx.screens.goToScreen(num) return True def slotDeviceChanged(self, i): self.device = i.getDevice() def slotSelectAuto(self): self.enable_next = True self.device = self.device_list.selectedItem().getDevice() self.updateUI() def slotSelectManual(self): self.enable_next = True self.updateUI() def updateUI(self): if self.enable_next: ctx.screens.enableNext() else: ctx.screens.disableNext()
class Widget(QWidget, ScreenWidget): help = _(''' <font size="+2">Congratulations</font> <font size="+1"> <p><b>Voila! You made it!</b></p> <p> You have successfully installed Pardus, a very easy to use desktop system on your machine. Now you can start playing with your system and stay productive all the time. </p> <P> Click on the Next button to proceed. One note: You remember your password, don't you? </p> </font> ''') def __init__(self, *args): apply(QWidget.__init__, (self,) + args) img = QLabel(self) img.setPixmap(ctx.iconfactory.newPixmap("goodbye")) self.info = QLabel(self) self.info.setText( _('<b><font size="+2" color="#FF6D19">Rebooting system. Please wait!</font></b>')) self.info.hide() self.info.setAlignment(QLabel.AlignCenter|QLabel.AlignTop) self.info.setMinimumSize(QSize(0,50)) vbox = QVBoxLayout(self) vbox.addStretch(1) hbox = QHBoxLayout(vbox) hbox.addStretch(1) hbox.addWidget(img) hbox.addStretch(1) vbox.addStretch(1) vbox.addWidget(self.info) def shown(self): ctx.screens.disablePrev() # print yali.users.pending_users # for i in yali.users.pending_users: # print i self.processPendingActions() def execute(self): ctx.screens.disableNext() self.info.show() self.info.setAlignment(QLabel.AlignCenter) #FIXME: this is a dirty and temporary workaround.. will be removed. # os.chmod(ctx.consts.target_dir + "/var/tmp", 01777) # remove cd... w = RebootWidget(self) self.dialog = WarningDialog(w, self) self.dialog.exec_loop() try: mount.umount(ctx.consts.target_dir + "/home") except: pass mount.umount(ctx.consts.target_dir) reboot.fastreboot() # process pending actions defined in other screens. def processPendingActions(self): for u in yali.users.pending_users: u.addUser()
class Widget(BootLoaderWidget, ScreenWidget): help = _(''' <font size="+2">Boot loader setup</font> <font size="+1"> <p> Linux makes use of GRUB boot loader, which can boot the operating system of your taste during the start up. </p> <p> If you have more than one operating system, you can choose which operating system to boot also. </p> <p> Please refer to Pardus Installing and Using Guide for more information about GRUB boot loader. </p> </font> ''') def __init__(self, *args): apply(BootLoaderWidget.__init__, (self,) + args) self.device_list.setPaletteBackgroundColor(ctx.consts.bg_color) self.device_list.setPaletteForegroundColor(ctx.consts.fg_color) self.installFirstMBR.setChecked(True) # initialize all storage devices if not yali.storage.init_devices(): raise GUIException, _("Can't find a storage device!") if len(yali.storage.devices) > 1: self.device_list_state = True # fill device list for dev in yali.storage.devices: DeviceItem(self.device_list, dev) # select the first disk by default self.device_list.setSelected(0, True) # be sure first is selected device self.device = self.device_list.item(0).getDevice() else: # don't show device list if we have just one disk self.installMBR.hide() self.device_list_state = False self.device_list.hide() self.select_disk_label.hide() self.device = yali.storage.devices[0] self.connect(self.buttonGroup, SIGNAL("clicked(int)"), self.slotInstallLoader) self.connect(self.device_list, SIGNAL("selectionChanged(QListBoxItem*)"), self.slotDeviceChanged) self.connect(self.device_list, SIGNAL("clicked()"), self.slotSelect) def shown(self): from os.path import basename ctx.debugger.log("%s loaded" % basename(__file__)) if ctx.autoInstall: ctx.screens.next() def backCheck(self): # we need to go partition auto screen, not manual ;) num = ctx.screens.getCurrentIndex() - 2 ctx.screens.goToScreen(num) return False def slotSelect(self): self.installMBR.setChecked(True) def slotInstallLoader(self, b): if self.installMBR.isChecked(): self.device_list.setEnabled(True) self.device_list.setSelected(0,True) else: self.device_list.setEnabled(False) self.device_list.setSelected(self.device_list.selectedItem(),False) def slotDeviceChanged(self, i): self.device = i.getDevice() def autopartDevice(self): dev = ctx.installData.autoPartDev # first delete partitions on device dev.deleteAllPartitions() dev.commit() p = dev.addPartition(parttype.root.parted_type, parttype.root.filesystem, dev.getFreeMB(), parttype.root.parted_flags) p = dev.getPartition(p.num) # get partition.Partition # create the partition dev.commit() # make partition requests ctx.partrequests.append(request.MountRequest(p, parttype.root)) ctx.partrequests.append(request.FormatRequest(p, parttype.root)) ctx.partrequests.append(request.LabelRequest(p, parttype.root)) ctx.partrequests.append(request.SwapFileRequest(p, parttype.root)) def checkSwap(self): # check swap partition, if not present use swap file rt = request.mountRequestType pt = parttype.swap swap_part_req = ctx.partrequests.searchPartTypeAndReqType(pt, rt) if not swap_part_req: # No swap partition defined using swap as file in root # partition rt = request.mountRequestType pt = parttype.root root_part_req = ctx.partrequests.searchPartTypeAndReqType(pt, rt) ctx.partrequests.append(request.SwapFileRequest(root_part_req.partition(), root_part_req.partitionType())) def execute(self): w = WarningWidget(self) # We need different warning messages for Auto and Manual Partitioning if ctx.installData.autoPartDev: # show confirmation dialog w.warning.setText(_('''<b> <p>This action will use your entire disk for Pardus installation and all your present data on the selected disk will be lost.</p> <p>After being sure you had your backup this is generally a safe and easy way to install Pardus.</p> </b> ''')) if not ctx.autoInstall: self.dialog = WarningDialog(w, self) if not self.dialog.exec_loop(): # disabled by weaver ctx.screens.enablePrev() return False info_window = InformationWindow(self, _("Please wait while formatting!")) ctx.screens.processEvents() # We should do partitioning operations in here. # Auto Partitioning if ctx.installData.autoPartDev: ctx.partrequests.remove_all() ctx.use_autopart = True self.autopartDevice() time.sleep(1) ctx.partrequests.applyAll() # Manual Partitioning else: for dev in yali.storage.devices: dev.commit() # wait for udev to create device nodes time.sleep(2) self.checkSwap() ctx.partrequests.applyAll() info_window.close() root_part_req = ctx.partrequests.searchPartTypeAndReqType(parttype.root, request.mountRequestType) # install_dev if self.noInstall.isChecked(): ctx.installData.bootLoaderDev = None elif self.installPart.isChecked(): ctx.installData.bootLoaderDev = basename(root_part_req.partition().getPath()) elif self.installMBR.isChecked(): ctx.installData.bootLoaderDev = basename(self.device.getPath()) else: if len(yali.storage.devices) > 1: self.orderedDiskList = yali.storage.getOrderedDiskList() ctx.installData.bootLoaderDev = basename(self.orderedDiskList[0]) else: ctx.installData.bootLoaderDev = str(basename(root_part_req.partition().getPath())) _ins_part = root_part_req.partition().getPath() ctx.debugger.log("Pardus installed to : %s" % _ins_part) ctx.debugger.log("GRUB will be installed to : %s" % ctx.installData.bootLoaderDev) return True
def execute(self): w = WarningWidget(self) # We need different warning messages for Auto and Manual Partitioning if ctx.installData.autoPartDev: # show confirmation dialog w.warning.setText(_('''<b> <p>This action will use your entire disk for Pardus installation and all your present data on the selected disk will be lost.</p> <p>After being sure you had your backup this is generally a safe and easy way to install Pardus.</p> </b> ''')) if not ctx.autoInstall: self.dialog = WarningDialog(w, self) if not self.dialog.exec_loop(): # disabled by weaver ctx.screens.enablePrev() return False info_window = InformationWindow(self, _("Please wait while formatting!")) ctx.screens.processEvents() # We should do partitioning operations in here. # Auto Partitioning if ctx.installData.autoPartDev: ctx.partrequests.remove_all() ctx.use_autopart = True self.autopartDevice() time.sleep(1) ctx.partrequests.applyAll() # Manual Partitioning else: for dev in yali.storage.devices: dev.commit() # wait for udev to create device nodes time.sleep(2) self.checkSwap() ctx.partrequests.applyAll() info_window.close() root_part_req = ctx.partrequests.searchPartTypeAndReqType(parttype.root, request.mountRequestType) # install_dev if self.noInstall.isChecked(): ctx.installData.bootLoaderDev = None elif self.installPart.isChecked(): ctx.installData.bootLoaderDev = basename(root_part_req.partition().getPath()) elif self.installMBR.isChecked(): ctx.installData.bootLoaderDev = basename(self.device.getPath()) else: if len(yali.storage.devices) > 1: self.orderedDiskList = yali.storage.getOrderedDiskList() ctx.installData.bootLoaderDev = basename(self.orderedDiskList[0]) else: ctx.installData.bootLoaderDev = str(basename(root_part_req.partition().getPath())) _ins_part = root_part_req.partition().getPath() ctx.debugger.log("Pardus installed to : %s" % _ins_part) ctx.debugger.log("GRUB will be installed to : %s" % ctx.installData.bootLoaderDev) return True
class Widget(QWidget, ScreenWidget): help = _(''' <font size="+2">Congratulations</font> <font size="+1"> <p> You have successfully installed Pardus, a very easy to use desktop system on your machine. Now you can start playing with your system and stay productive all the time. </p> <P> Click on the Next button to proceed. One note: You remember your password, don't you? </p> </font> ''') def __init__(self, *args): apply(QWidget.__init__, (self,) + args) img = QLabel(self) img.setPixmap(ctx.iconfactory.newPixmap("goodbye")) self.info = QLabel(self) self.info.setText( _('<b><font size="+2" color="#FF6D19">Rebooting system. Please wait!</font></b>')) self.info.hide() self.info.setAlignment(QLabel.AlignCenter|QLabel.AlignTop) self.info.setMinimumSize(QSize(0,50)) vbox = QVBoxLayout(self) vbox.addStretch(1) hbox = QHBoxLayout(vbox) hbox.addStretch(1) hbox.addWidget(img) hbox.addStretch(1) vbox.addStretch(1) vbox.addWidget(self.info) def shown(self): from os.path import basename ctx.debugger.log("%s loaded" % basename(__file__)) ctx.screens.disablePrev() self.processPendingActions() def execute(self): ctx.screens.disableNext() self.info.show() self.info.setAlignment(QLabel.AlignCenter) #open(ctx.consts.log_file,"w").write(ctx.debugger.traceback.plainLogs) try: ctx.debugger.log("Trying to umount %s" % (ctx.consts.target_dir + "/home")) yali.sysutils.umount(ctx.consts.target_dir + "/home") ctx.debugger.log("Trying to umount %s" % (ctx.consts.target_dir)) yali.sysutils.umount(ctx.consts.target_dir) except: ctx.debugger.log("Umount Failed.") pass ctx.debugger.log("Trying to eject the CD.") # remove cd... w = RebootWidget(self) ctx.debugger.log("Show reboot dialog.") self.dialog = WarningDialog(w, self) self.dialog.exec_loop() ctx.debugger.log("Yali, fastreboot calling..") yali.sysutils.fastreboot() # process pending actions defined in other screens. def processPendingActions(self): # add users for u in yali.users.pending_users: ctx.debugger.log("User %s adding to system" % u.username) u.addUser() ctx.debugger.log("User %s added to system" % u.username) # write console keyboard data yali.localeutils.write_keymap(ctx.keydata.console) ctx.debugger.log("Keymap stored.") # migrate xorg.conf yali.postinstall.migrate_xorg_conf(ctx.keydata.X) ctx.debugger.log("xorg.conf merged.")
def execute(self): w = WarningWidget(self) # We need different warning messages for Auto and Manual Partitioning if ctx.installData.autoPartDev: # show confirmation dialog w.warning.setText(_('''<b> <p>This action will use your entire disk for Pardus installation and all your present data on the selected disk will be lost.</p> <p>After being sure you had your backup this is generally a safe and easy way to install Pardus.</p> </b> ''')) self.dialog = WarningDialog(w, self) if not self.dialog.exec_loop(): # disabled by weaver ctx.screens.enablePrev() return False info_window = InformationWindow(self, _("Please wait while formatting!")) ctx.screens.processEvents() # We should do partitioning operations in here. # Auto Partitioning if ctx.installData.autoPartDev: ctx.partrequests.remove_all() ctx.use_autopart = True self.autopartDevice() time.sleep(1) ctx.partrequests.applyAll() # Manual Partitioning else: for dev in yali.storage.devices: dev.commit() # wait for udev to create device nodes time.sleep(2) self.checkSwap() ctx.partrequests.applyAll() info_window.close() if self.noInstall.isChecked(): ctx.installData.bootLoaderDev = None # show information window... # info_window = InformationWindow(self, _("Please wait while installing bootloader!")) # loader = yali.bootloader.BootLoader() root_part_req = ctx.partrequests.searchPartTypeAndReqType(parttype.root, request.mountRequestType) # install_dev if self.installPart.isChecked(): ctx.installData.bootLoaderDev = basename(root_part_req.partition().getPath()) elif self.installMBR.isChecked(): ctx.installData.bootLoaderDev = basename(self.device.getPath()) else: ctx.installData.bootLoaderDev = str(filter(lambda u: u.isalpha(), basename(root_part_req.partition().getPath()))) _ins_part = root_part_req.partition().getPath() ctx.debugger.log("Pardus installed to : %s" % _ins_part) ctx.debugger.log("GRUB will be installed to : %s" % ctx.installData.bootLoaderDev) # loader.write_grub_conf(_ins_part,ctx.installData.bootLoaderDev) # Windows partitions... #for d in yali.storage.devices: # for p in d.getPartitions(): # fs = p.getFSName() # if fs in ("ntfs", "fat32"): # if is_windows_boot(p.getPath(), fs): # win_fs = fs # win_dev = basename(p.getDevicePath()) # win_root = basename(p.getPath()) # loader.grub_conf_append_win(install_dev, # win_dev, # win_root, # win_fs) # continue # finally install it # loader.install_grub(install_dev) # close window # info_window.close(True) return True