[meego-commits] 7234: Changes to Trunk/firstboot

Peter Zhu no_reply at build.meego.com
Wed Sep 1 17:35:02 UTC 2010


Hi,
I have made the following changes to firstboot in project Trunk. Please review and accept ASAP.

Thank You,
Peter Zhu

[This message was auto-generated]

---

Request #7234:

  submit:   Trunk:Testing/firstboot(r17) -> Trunk/firstboot


Message:
    Move to Trunk

State:   new          2010-09-01T10:35:01 peter
Comment: None



changes files:
--------------
--- firstboot.changes
+++ firstboot.changes
@@ -0,0 +1,12 @@
+* Fri Aug 27 2010 Vivian Zhang <vivian.zhang at intel.com> - 1.1
+- Upgrade to 1.1
+   * Merged the fixing for BMC #2028, #1989
+   * Removed cracklib dependency
+   * Fixed BMC #5815, refine the code of setting bluetooth name
+   * Fixed BMC #5814, include localhost in /etc/hosts
+   * Fixed BMC #5613, remove backtrace collection screen
+   * Fixed BMC #5611, remove the script for media copying
+
+* Tue Aug 10 2010 Vivian Zhang <vivian.zhang at intel.com> - 1.0
+- Add the pach from li,yan to fix folder name issue (BMC #1989)
+

old:
----
  firstboot-1.0.tar.bz2
  fix-2028-set-can-default-flags-for-buttons.patch
  remove_cracklib.patch

new:
----
  firstboot-1.1.tar.bz2

spec files:
-----------
--- firstboot.spec
+++ firstboot.spec
@@ -3,11 +3,9 @@
 Summary: Initial system configuration utility
 Name: firstboot
 URL: http://gitorious.org/meego/firstboot
-Version: 1.0
+Version: 1.1
 Release: 1
 Source0: %{name}-%{version}.tar.bz2
-Patch0: remove_cracklib.patch
-Patch1: fix-2028-set-can-default-flags-for-buttons.patch
 License: GPLv2+
 Group: System/Base
 ExclusiveOS: Linux
@@ -28,8 +26,6 @@
 
 %prep
 %setup -q
-%patch0 -p1
-%patch1 -p1
 
 %build
 
@@ -37,6 +33,7 @@
 rm -rf %{buildroot}
 make DESTDIR=%{buildroot} SITELIB=%{python_sitelib} install
 %find_lang firstboot
+echo `uname -m`
 
 %clean
 rm -rf %{buildroot}

other changes:
--------------

++++++ firstboot-1.0.tar.bz2 -> firstboot-1.1.tar.bz2
--- firstboot/interface.py
+++ firstboot/interface.py
@@ -248,6 +248,7 @@
         # start at the first page.
         self.backButton = gtk.Button(use_underline=True, stock="gtk-go-back",
                                      label=_("_Back"))
+        self.backButton.set_flags(gtk.CAN_DEFAULT)
         self._setBackSensitivity()
         self.backButton.connect("clicked", self._backClicked)
         self.buttonBox.pack_start(self.backButton)
@@ -255,6 +256,7 @@
         # Create the Forward button.
         self.nextButton = gtk.Button(use_underline=True, stock="gtk-go-forward",
                                      label=_("_Forward"))
+        self.nextButton.set_flags(gtk.CAN_DEFAULT)
         self.nextButton.connect("clicked", self._nextClicked)
         self.buttonBox.pack_start(self.nextButton)
 
--- modules/btc-setup.py
+++ modules/btc-setup.py
-#
-# Vivian Zhang <vivian.zhang at intel.com>
-# Chris Lumens <clumens at redhat.com>
-#
-# Copyright 2009 Intel Corp.
-# Copyright 2008 Red Hat, Inc.
-#
-# This copyrighted material is made available to anyone wishing to use, modify,
-# copy, or redistribute it subject to the terms and conditions of the GNU
-# General Public License v.2.  This program is distributed in the hope that it
-# will be useful, but WITHOUT ANY WARRANTY expressed or implied, including the
-# implied warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-# See the GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along with
-# this program; if not, write to the Free Software Foundation, Inc., 51
-# Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  Any Red Hat
-# trademarks that are incorporated in the source code or documentation are not
-# subject to the GNU General Public License and may only be used or replicated
-# with the express permission of Red Hat, Inc. 
-#
-import gtk
-import os, string, sys
-
-from firstboot.config import *
-from firstboot.constants import *
-from firstboot.functions import *
-from firstboot.module import *
-
-import logging
-log = logging.getLogger("firstboot")
-
-import gettext
-_ = lambda x: gettext.ldgettext("firstboot", x)
-N_ = lambda x: x
-
-from btcMainWindow import btcMainWindow
-
-class moduleClass(Module):
-    def __init__(self):
-        Module.__init__(self)
-        self.priority = 90
-        self.sidebarTitle = N_("Backtrace Collection")
-        self.title = N_("Backtrace Collection")
-        self.icon = ""
-        self.btc = None
-
-    def apply(self, interface, testing=False):
-        if testing:
-            return RESULT_SUCCESS
-
-        rc = self.btc.apply()
-        if rc == True:
-            return RESULT_SUCCESS
-        else:
-            log.info("Failed to apply backtrace collection setup")
-            return RESULT_FAILURE
-
-    def createScreen(self, interface=None):
-        self.nextbutton = None
-        if interface:
-            self.nextbutton = interface.nextButton
-        log.info("Display backtrace collection setup screen")
-        self.vbox = gtk.VBox(spacing=10)
-        self.btc = btcMainWindow()
-        self.vbox.pack_start(self.btc.firstboot_widget())
-
-    def initializeUI(self):
-        if self.nextbutton:
-            log.info("Disable the next button")
-            self.nextbutton.set_sensitive(False)
-        self.btc.set_nextbutton(self.nextbutton)
-        pass
--- modules/btcMainWindow.py
+++ modules/btcMainWindow.py
-#
-# Vivian Zhang <vivian.zhang at intel.com>
-#
-# Copyright 2009 Intel Corp.
-# Copyright 2008 Red Hat, Inc.
-#
-# This copyrighted material is made available to anyone wishing to use, modify,
-# copy, or redistribute it subject to the terms and conditions of the GNU
-# General Public License v.2.  This program is distributed in the hope that it
-# will be useful, but WITHOUT ANY WARRANTY expressed or implied, including the
-# implied warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-# See the GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along with
-# this program; if not, write to the Free Software Foundation, Inc., 51
-# Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  Any Red Hat
-# trademarks that are incorporated in the source code or documentation are not
-# subject to the GNU General Public License and may only be used or replicated
-# with the express permission of Red Hat, Inc. 
-#
-
-import os, re, string, sys
-import gobject, gtk
-import glob
-import libuser
-import shutil
-import tempfile
-
-import logging
-log = logging.getLogger("firstboot")
-
-import gettext
-_ = lambda x: gettext.ldgettext("firstboot", x)
-
-
-class btcMainWindow:
-    def __init__(self):
-        self.win = gtk.Window()
-        self.win.set_position(gtk.WIN_POS_CENTER)
-        self.win.set_property ("default_width", 700)
-        self.win.set_property ("default_height", 500)
-        self.win.connect('destroy', self.destroy)
-        self.win.set_title('backtrace collection setup')
-        
-        self.nextbutton = None
-        self.vbox = gtk.VBox(spacing=5)
-        #self.vbox.set_border_width(50)
-
-        srLabel1 = gtk.Label(_("Automatically submit application crash reports to MeeGo reporting database?"))
-        srLabel1.set_line_wrap(True)
-        srLabel1.set_alignment(0.0, 0.5)
-        srLabel1.set_size_request(900, -1)
-        self.vbox.pack_start(srLabel1, False)
-
-        self.srYes = gtk.RadioButton(label=_("Yes"))
-        self.srYes.connect("toggled", self.callback)
-        self.srNo = gtk.RadioButton(group=self.srYes, label=_("No"))
-        self.srNo.connect("toggled", self.callback)
-        self.srDefault = gtk.RadioButton(group=self.srYes)
-        self.srDefault.set_active(True)
-        self.vbox.pack_start(self.srYes, False)
-        self.vbox.pack_start(self.srNo, False)
-    
-     
-        srLabel2 = gtk.Label(_("  PRIVACY NOTE:\n  Enabling this option causes your system to submit certain application output to the crashdb.meego.com website, which then allows the information to be viewed by developers and end users. \n  The information submitted includes a \"backtrace\", which is an application's crash signature. However, due to the nature of backtraces, it may happen that a few instances of user input will be sent with the backtrace."))
-        srLabel2.set_line_wrap(True)
-        srLabel2.set_alignment(0.0, 0.5)
-        srLabel2.set_size_request(900, -1)
-        self.vbox.pack_start(srLabel2, False)
-
-
-
-        dpLabel1 = gtk.Label(_("\n\nAutomatically download debuginfo packages?"))
-        dpLabel1.set_line_wrap(True)
-        dpLabel1.set_alignment(0.0, 0.5)
-        dpLabel1.set_size_request(900, -1)
-        #self.vbox.pack_start(dpLabel1, False)
-        
-        self.dpYes = gtk.RadioButton(label=_("Yes"))
-        self.dpYes.connect("toggled", self.callback)
-        self.dpNo = gtk.RadioButton(group=self.dpYes, label=_("No"))
-        self.dpNo.connect("toggled", self.callback)
-        self.dpDefault = gtk.RadioButton(group=self.dpYes)
-        self.dpYes.set_active(True)
-        #self.dpDefault.set_active(True)
-        #self.vbox.pack_start(self.dpYes, False)
-        #self.vbox.pack_start(self.dpNo, False)
-
-        dpLabel2 = gtk.Label(_("  This will enable your system to automatically download debugging information about an application that has crashed on your system. The debug information will consume a minor amount of your overall disk space. However, this information will improve the quality of the backtraces sent, thus making an application crash easier for developers to troubleshoot."))
-        dpLabel2.set_line_wrap(True)
-        dpLabel2.set_alignment(0.0, 0.5)
-        dpLabel2.set_size_request(900, -1)
-        #self.vbox.pack_start(dpLabel2, False)
-
-        # Create a button box to handle navigation.
-        self.buttonBox = gtk.HButtonBox()
-        self.buttonBox.set_layout(gtk.BUTTONBOX_END)
-        self.buttonBox.set_spacing(10)
-        self.buttonBox.set_border_width(10)
-        # Create the Ok button.
-        self.okButton = gtk.Button(use_underline=True, stock="gtk-ok",
-                                     label=("_Ok"))
-        self.okButton.connect("clicked", self.ok_clicked)
-        self.buttonBox.pack_start(self.okButton)
-        self.vbox.pack_end(self.buttonBox, expand=False)
-
-    def ok_clicked(self, *args):
-        self.apply()
-        self.destroy()
-
-    def set_nextbutton(self, nextbutton):
-        self.nextbutton = nextbutton
-
-    def callback(self, widget):
-        if not self.srDefault.get_active() and not self.dpDefault.get_active():
-            if self.nextbutton:
-                self.nextbutton.set_sensitive(True)
-
-    def apply(self):
-        if self.srYes.get_active():
-            allowRep = "Allow-Report=true"
-        else:
-            allowRep = "Allow-Report=false"
-
-        if self.dpYes.get_active():
-            allowDeb = "Allow-Debuginfo=true"
-        else:
-            allowDeb = "Allow-Debuginfo=false"
-
-        log.info("Write /etc/abrt/reporting-settings.conf")
-        if not os.path.exists("/etc/abrt"):
-            log.info("abrt is not installed in this image, go to next page directly")
-            return True
-        
-        abrt_config = "/etc/abrt/reporting-settings.conf"
-        try:
-            if os.path.exists(abrt_config):
-                f = open(abrt_config, "r+")
-                if re.search("Allow-Report *=", f.read()):
-                    f.seek(0)
-                    str = re.sub("Allow-Report *=.*", allowRep, f.read())
-                    f.close()
-                    f = open(abrt_config, "w")
-                    f.write(str)
-                else:
-                    f.write("%s\n" % allowRep)
-                f.close()
-            
-                #f = open(abrt_config, "r+")
-                #if re.search("Allow-Debuginfo *=", f.read()):
-                #    f.seek(0)
-                #    str = re.sub("Allow-Debuginfo *=.*", allowDeb, f.read())
-                #    f.close()
-                #    f = open(abrt_config, "w")
-                #    f.write(str)
-                #else:
-                #   f.write("%s\n" % allowDeb)
-                #f.close()
-            else:
-                f = open(abrt_config, "w")
-                f.write("[Global]\n")
-                f.write("%s\n" % allowRep)
-                #f.write("%s\n" % allowDeb)
-                f.close()
-        except Exception, e:
-            log.error("Error while writing config file: %s" % str(e))
-        return True
-
-    def destroy(self, args=None):
-        self.win.destroy()
-        if gtk.__dict__.has_key("main_quit"):
-            gtk.main_quit()
-        else:
-            gtk.mainquit()
-
-    def stand_alone(self):
-        self.vbox.set_border_width(50)
-        self.win.add(self.vbox)
-        self.win.show_all()
-        if gtk.__dict__.has_key("main"):
-            gtk.main()
-        else:
-            gtk.mainloop()
-
-    def firstboot_widget(self):
-        self.vbox.remove(self.buttonBox)
-        return self.vbox
--- modules/create_user.py
+++ modules/create_user.py
@@ -22,7 +22,6 @@
 import os, string, sys, time
 import os.path
 import users
-import cracklib
 import subprocess
 import logging
 import re
@@ -227,22 +226,6 @@
                                          "not allowed."))
                 return False
 
-        try:
-            cracklib.FascistCheck(password)
-        except ValueError, e:
-            msg = gettext.ldgettext("cracklib", e)
-            dlg = gtk.MessageDialog(None, 0, gtk.MESSAGE_WARNING, gtk.BUTTONS_YES_NO,
-                                   _("Weak password provided: %s"
-                                     "\n\n"
-                                     "Would you like to continue with "
-                                     "this password?") % (msg, ))
-            dlg.set_position(gtk.WIN_POS_CENTER)
-            dlg.set_modal(True)
-            addFrame(dlg, showtitle = 0)
-            rc = dlg.run()
-            dlg.destroy()
-            if rc == gtk.RESPONSE_NO:
-                return False
         return True
 
     def apply(self, interface, testing=False):
@@ -416,23 +399,22 @@
 
             # write /etc/hosts
             f = open("/etc/hosts", "w")           
-            f.write("127.0.1.1\t\t" + self.hostname + ".localdomain " + self.hostname + "\n")
-            f.write("::1\t\tlocalhost6.localdomain6 localhost6\n")
+            f.write("127.0.1.1\t\tlocalhost " + self.hostname + ".localdomain " + self.hostname + "\n")
+            f.write("::1\t\tlocalhost localhost6.localdomain6 localhost6\n")
             f.close()
 
             # set env
             os.environ["HOME"] = self.userAccount["homedir"]
             os.environ["USER"] = self.userAccount["username"]
-            if not config.video_show:
-                dlg = self._waitWindow(_("We're setting up your computer. Everything will be ready in a jiffy."))
-                dlg.show_all()
-                while gtk.events_pending():
-                    gtk.main_iteration(False)
-                self.runscripts(self.userAccount["username"])
-                time.sleep(4)
-                dlg.destroy()
-            else:
-                # launch pulseaudio
+            if config.video_show:
+                #dlg = self._waitWindow(_("We're setting up your computer. Everything will be ready in a jiffy."))
+                #dlg.show_all()
+                #while gtk.events_pending():
+                #    gtk.main_iteration(False)
+                #self.runscripts(self.userAccount["username"])
+                #time.sleep(4)
+                #dlg.destroy()
+                # launch pulseaudio for video_show page
                 if os.path.exists("/usr/bin/start-pulseaudio-x11"):
                     try:
                         launch_pa = "su -l %s -c \"/usr/bin/start-pulseaudio-x11\">/dev/tty3 2>&1" % self.userAccount["username"]
@@ -446,27 +428,13 @@
                         log.error("Error running launch PA: %s", msg)
 
             # set btname
-            if os.path.exists("/usr/sbin/hciconfig") and btname:
-                try:
-                    set_btname = "/usr/sbin/hciconfig hciX name \"%s\"" % btname
-                    log.info("Set btname: %s", set_btname)
-                    rc = os.system(set_btname)
-                    if rc != 0:
-                        log.error("Failed to run btname setting")
-                except RuntimeError, msg:
-                    log.error("Error running btname setting: %s", msg)
-
-                try:
-                    os.system("killall bluetoothd")
-                    time.sleep(0.2)
- 
-                    start_bt_daemon="/usr/sbin/bluetoothd"
-                    log.info ("Restart bluetoothd: %s", start_bt_daemon)
-                    rc = os.system(start_bt_daemon)
-                    if rc != 0:
-                        log.error("Failed to restart bluetoothd")
-                except RuntimeError, msg:
-                    log.error("Error : failed to restart bluetoothd %s", msg)
+            if btname:
+                import dbus
+                bus = dbus.SystemBus()
+                manager = dbus.Interface(bus.get_object("org.bluez", "/"), "org.bluez.Manager")
+                adapter = dbus.Interface(bus.get_object("org.bluez", manager.DefaultAdapter()),
+                                                    "org.bluez.Adapter")
+                adapter.SetProperty("Name", btname)  
 
             # set hostname
             if os.path.exists("/bin/hostname") and self.hostname:
--- modules/create_user.py.orig
+++ modules/create_user.py.orig
-#
-# Chris Lumens <clumens at redhat.com>
-#
-# Copyright 2008 Red Hat, Inc.
-#
-# This copyrighted material is made available to anyone wishing to use, modify,
-# copy, or redistribute it subject to the terms and conditions of the GNU
-# General Public License v.2.  This program is distributed in the hope that it
-# will be useful, but WITHOUT ANY WARRANTY expressed or implied, including the
-# implied warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-# See the GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along with
-# this program; if not, write to the Free Software Foundation, Inc., 51
-# Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  Any Red Hat
-# trademarks that are incorporated in the source code or documentation are not
-# subject to the GNU General Public License and may only be used or replicated
-# with the express permission of Red Hat, Inc. 
-#
-import gtk
-import libuser
-import os, string, sys, time
-import os.path
-import users
-import cracklib
-import subprocess
-import logging
-import re
-log = logging.getLogger("firstboot")
-
-from firstboot.config import *
-from firstboot.constants import *
-from firstboot.functions import *
-from firstboot.module import *
-
-import gettext
-_ = lambda x: gettext.ldgettext("firstboot", x)
-N_ = lambda x: x
-
-
-def addFrame(dialog, title=None, showtitle = 1):
-    # We don't add a Frame in rootpath mode, as we almost certainly
-    # have a window manager
-    contents = dialog.get_children()[0]
-    dialog.remove(contents)
-    frame = gtk.Frame()
-    frame.set_shadow_type(gtk.SHADOW_OUT)
-    box = gtk.VBox()
-    try:
-        if title is None:
-            title = dialog.get_title()
-
-        if title :
-            data = {}
-            data["state"] = 0
-            data["button"] = 0
-            data["deltax"] = 0
-            data["deltay"] = 0
-            data["window"] = dialog
-            eventBox = gtk.EventBox()
-            eventBox.connect("button-press-event", titleBarMousePressCB, data)
-            eventBox.connect("button-release-event", titleBarMouseReleaseCB, data)
-            eventBox.connect("motion-notify-event", titleBarMotionEventCB,data)
-            titleBox = gtk.HBox(False, 5)
-            eventBox.add(titleBox)
-            eventBox.modify_bg(gtk.STATE_NORMAL, eventBox.rc_get_style().bg[gtk.STATE_SELECTED])
-
-            if showtitle:
-                titlelbl = gtk.Label("")
-                titlelbl.set_markup("<b>"+_(title)+"</b>")
-                titlelbl.modify_fg(gtk.STATE_NORMAL, gtk.gdk.color_parse ("white"))
-                titlelbl.set_property("ypad", 4)
-                titleBox.pack_start(titlelbl)
-            else:
-                s = gtk.Label("")
-                titleBox.pack_start(s)
-            eventBox.show_all()
-            box.pack_start(eventBox, False, False)
-        else:
-            dialog.set_title (title)
-    except:
-        pass
-    frame2=gtk.Frame()
-    frame2.set_shadow_type(gtk.SHADOW_NONE)
-    frame2.set_border_width(4)
-    frame2.add(contents)
-    contents.show()
-    frame2.show()
-    box.pack_start(frame2, True, True, padding=5)
-    box.show()
-    frame.add(box)
-    frame.show()
-    dialog.add(frame)
-
- # make screen shots work
- #   dialog.connect ("key-release-event", handleShiftPrintScrnRelease)
-
-class moduleClass(Module):
-    def __init__(self):
-        Module.__init__(self)
-        self.priority = 100
-        self.sidebarTitle = N_("Create User")
-        self.title = N_("Create User")
-        #self.icon = "moblin-user.png"
-
-        self.admin = libuser.admin()
-        self.nisFlag = None
-
-        self._problemFiles = []
-
-        self._count = 0
-        self.users = None
-        self.rootPassword = { "isCrypted": False, "password": "", "lock": False }
-        self.userAccount = { "username": "",
-                             "fullname": "",
-                             "password": "",
-                             "isCrypted": False,
-                             "isSudoer": False,
-                             "groups": [],
-                             "homedir": "",
-                             "shell": None,
-                             "uid": None,
-                             "algo": None,
-                             "lock": None}
-        self.auth = "--enableshadow --passalgo=sha512"
-
-    # Reads the auth string and returns a string indicating our desired
-    # password encoding algorithm.
-    def getPassAlgo(self):
-        if self.auth.find("--enablemd5") != -1 or \
-           self.auth.find("--passalgo=md5") != -1:
-            return 'md5'
-        elif self.auth.find("--passalgo=sha256") != -1:
-            return 'sha256'
-        elif self.auth.find("--passalgo=sha512") != -1:
-            return 'sha512'
-        else:
-            return None
-
-    def _chown(self, arg, dirname, names):
-        for n in names:
-            try:
-                os.lchown("%s/%s" % (dirname, n), arg[0], arg[1])
-
-                # Update the UI from time to time, but not so often as to
-                # really slow down the chown.
-                self._count += 1
-                if self._count % 100 == 0:
-                    while gtk.events_pending():
-                        gtk.main_iteration(False)
-            except:
-                self._problemFiles.append("%s/%s" % (dirname, n))
-    
-    def _checkUsername(self, username):
-        maxnamelength = libuser.UT_NAMESIZE - 1
-        if len(username) > maxnamelength:
-            self._showErrorMessage(_("The user name must not exceed %d characters.") % maxnamelength)
-            return False
-
-        alldigits = True
-        for i, j in map(lambda x: (username[x], x), range(len(username))):
-            if i == "_" or (i == "-" and j != 0) or (i == "$" and j != 0 and j == len(username)-1):
-                #specifically allow "-" (except at the beginning), "$" at the end and "_"
-                alldigits = False
-                continue
-
-            if i == "$":
-                self._showErrorMessage(_("The user name '%s' contains a dollar sign which is not at the end. "
-                                         "Please use dollar signs only at the end of user names to indicate "
-                                         "Samba machine accounts.") % username)
-                return False
-
-            if i not in string.ascii_letters and i not in string.digits and i != '.': 
-                self._showErrorMessage(_("The user name '%(name)s' contains an invalid character at "
-                                          "position %(position)d.") % {'name': username, 'position': j+1})
-                return False
-
-            if i not in string.digits:
-                alldigits = False
-
-        if alldigits:
-            dlg = gtk.MessageDialog(None, 0, gtk.MESSAGE_WARNING, gtk.BUTTONS_YES_NO,
-                                    _("Using all numbers as the user name can cause confusion about whether "
-                                      "the user name or numerical user id is meant. Do you really want to "
-                                      "use a numerical-only user name?"))
-            dlg.set_position(gtk.WIN_POS_CENTER)
-            dlg.set_modal(True)
-            addFrame(dlg, showtitle = 0)
-            rc = dlg.run()
-            dlg.destroy()
-            if rc == gtk.RESPONSE_NO:
-                return False
-        return True
-
-    def _checkFullname(self, fullname):
-        try:
-            dummy = fullname.decode ('utf-8')
-        except UnicodeDecodeError:
-            #have to check for whitespace for gecos, since whitespace is ok
-            self._showErrorMessage(_("The name '%s' contains invalid characters.  "
-                                      "Please use only UTF-8 characters.") % fullname)
-            return False
-
-        if string.find(fullname, ":") >= 0:
-            #have to check for colons since /etc/passwd is a colon delimited file
-            self._showErrorMessage(_("The name '%s' contains a colon.  "
-                                      "Please do not use colons in the name.") % fullname)
-            return False
-        return True
-
-    def _checkPassword(self, password, confirm):
-        if not password or not confirm:
-            self._showErrorMessage(_("The password should not be empty.  Please enter "
-                                     "the password."))
-            return False
-
-        if password != confirm:
-            self._showErrorMessage( _("The passwords do not match.  Please enter "
-                                     "the password again."))
-            return False
-
-        legal = string.digits + string.ascii_letters + string.punctuation + " "
-        for letter in password:
-            if letter not in legal:
-                self._showErrorMessage(_("Requested password contains "
-                                         "non-ASCII characters, which are "
-                                         "not allowed."))
-                return False
-
-        try:
-            cracklib.FascistCheck(password)
-        except ValueError, e:
-            msg = gettext.ldgettext("cracklib", e)
-            dlg = gtk.MessageDialog(None, 0, gtk.MESSAGE_WARNING, gtk.BUTTONS_YES_NO,
-                                   _("Weak password provided: %s"
-                                     "\n\n"
-                                     "Would you like to continue with "
-                                     "this password?") % (msg, ))
-            dlg.set_position(gtk.WIN_POS_CENTER)
-            dlg.set_modal(True)
-            addFrame(dlg, showtitle = 0)
-            rc = dlg.run()
-            dlg.destroy()
-            if rc == gtk.RESPONSE_NO:
-                return False
-        return True
-
-    def apply(self, interface, testing=False):
-        if testing:
-            return RESULT_SUCCESS
-
-        username = self.usernameEntry.get_text()
-        username = string.strip(username)
-
-        if username == "" and self.nisFlag:
-            # If they've run authconfig, don't pop up messageDialog
-            return RESULT_SUCCESS
-
-        if username == "":
-            # Only allow not creating a user if there is at least
-            # one non-system account already on the system
-            if self.admin.getFirstUnusedUid() > 500:
-                return RESULT_SUCCESS
-            else:
-                self._showErrorMessage(_("You must create a user account for this system."))
-                self.usernameEntry.grab_focus()
-                return RESULT_FAILURE
-
-        if username == "" and self.admin.getFirstUnusedUid() > 500:
-            # Only allow not creating a user if there is at least
-            # one non-system account already on the system
-            return RESULT_SUCCESS
-            
-        if not self._checkUsername(username):
-            self.usernameEntry.set_text("")
-            self.usernameEntry.grab_focus()
-            return RESULT_FAILURE
-
-        password = self.passwordEntry.get_text()
-        confirm = self.confirmEntry.get_text()
-        if not self._checkPassword(password,confirm):
-            self.passwordEntry.set_text("")
-            self.confirmEntry.set_text("")
-            self.passwordEntry.grab_focus()
-            return RESULT_FAILURE
-
-        encrypthome = self.encryptHomeToggle.get_active()
-
-        user = self.admin.lookupUserByName(username)
-
-        if user != None and user.get(libuser.UIDNUMBER)[0] < 500:
-            self._showErrorMessage(_("The username '%s' is a reserved system "
-                                     "account.  Please specify another username."
-                                     % username))
-            self.usernameEntry.set_text("")
-            self.usernameEntry.grab_focus()
-            return RESULT_FAILURE
-
-
-        fullname = self.fullnameEntry.get_text()
-        # Check for valid strings
-        if not self._checkFullname(fullname):
-            self.fullnameEntry.set_text("")
-            self.fullnameEntry.grab_focus()
-            return RESULT_FAILURE
-
-
-        # If a home directory for the user already exists, offer to reuse it
-        # for the new user.
-        try:
-            os.stat("/home/%s" % username)
-
-            dlg = gtk.MessageDialog(None, 0, gtk.MESSAGE_WARNING, gtk.BUTTONS_YES_NO,
-                                    _("A home directory for user %s already exists. "
-                                      "Would you like to continue, making the new "
-                                      "user the owner of this directory and all its "
-                                      "contents?  Doing so may take a while to reset "
-                                      "permissions and any SELinux labels.  Would "
-                                      "you like to reuse this home directory?  If "
-                                      "not, please choose a different username.") % username)
-            dlg.set_position(gtk.WIN_POS_CENTER)
-            dlg.set_modal(True)
-            addFrame(dlg, showtitle = 0)
-            rc = dlg.run()
-            dlg.destroy()
-
-            if rc == gtk.RESPONSE_NO:
-                self.usernameEntry.set_text("")
-                self.usernameEntry.grab_focus()
-                return RESULT_FAILURE
-
-            mkhomedir = False
-        except:
-            mkhomedir = True
-
-        # Record the user account info
-        self.userAccount["username"] = username
-        self.userAccount["fullname"] = fullname
-        self.userAccount["password"] = password
-        self.userAccount["isCrypted"] = False 
-        self.userAccount["isSudoer"] = True
-        self.userAccount["groups"] = ["video", "audio"]
-        self.userAccount["homedir"] = "/home/%s" % username
-        self.userAccount["shell"] = None
-        self.userAccount["uid"] = None
-        self.userAccount["lock"] = False
-        
-        self.users = users.Users()
-        # make sure crypt_style in libuser.conf matches the salt we're using
-        users.createLuserConf(algoname=self.getPassAlgo())
-        # add new user account
-        log.info("createuser")
-        if not self.users.createUser(username=self.userAccount["username"],
-                                     fullname=self.userAccount["fullname"],
-                                     password=self.userAccount["password"],
-                                     isCrypted=self.userAccount["isCrypted"],
-                                     isSudoer=self.userAccount["isSudoer"],
-                                     groups=self.userAccount["groups"],
-                                     homedir=self.userAccount["homedir"],
-                                     #Shell=self.userAccount["shell"],
-                                     uid=self.userAccount["uid"],
-                                     algo=self.getPassAlgo(),
-                                     lock=self.userAccount["lock"],
-                                     encryptHome=encrypthome):
-            log.error("Error while creating user %s" % self.userAccount["username"])
-        else:
-            # set the root password
-            # by default it is the same to the password of the new user account
-            log.info("setrootpass")
-            self.users.setRootPassword(self.userAccount["password"],
-                                       self.userAccount["isCrypted"],
-                                       self.userAccount["lock"],
-                                       algo=self.getPassAlgo())
-            log.info("configautologin")
-            # configure automatic login for the new user account
-            if not self.users.configAutoLogin(self.userAccount["username"]):
-                log.error("Error while configuring automatic login for the new user %s" % self.userAccount["username"])
-      
-            # setup bluetooth name to fulluser's netbook
-            btconf="/etc/bluetooth/main.conf"
-            if os.path.exists(btconf):
-                f = open(btconf, "r")
-                if self.userAccount["fullname"]:
-                    btname=_("%s's Netbook") % self.userAccount["fullname"]
-                else:
-                    log.info("Use does not provide fullname, use username instead")
-                    btname=_("%s's Netbook") % self.userAccount["username"]
-                log.info("set bt apater name to %s" % btname)
-                str = re.sub(".*Name *=.*", "Name = %s" % btname, f.read())
-                f.close()
-                # f.seek(0) & f.write(str) will bring errors
-                f = open(btconf, "w")
-                f.write(str)
-                f.close()
-            
-            # write hostname
-            if self.userAccount["username"]:
-                self.hostname = "%s-desktop" % (self.userAccount["username"],)
-            else:
-                self.hostname = "meego-desktop"
-            log.info("Set hostname = %s", self.hostname)
-
-            networkconfig="/etc/sysconfig/network"
-            if os.path.exists(networkconfig):
-                f = open(networkconfig, "r")
-                str = re.sub(".*HOSTNAME *=.*", "HOSTNAME=%s" % self.hostname, f.read())
-                f.close()
-                f = open(networkconfig, "w")
-                f.write(str)
-                f.close()
-            else:
-                f = open(networkconfig, "w")
-                f.write("NETWORKING=yes\n")
-                f.write("HOSTNAME="+ self.hostname)
-                f.close()        
-
-            # write /etc/hosts
-            f = open("/etc/hosts", "w")           
-            f.write("127.0.1.1\t\t" + self.hostname + ".localdomain " + self.hostname + "\n")
-            f.write("::1\t\tlocalhost6.localdomain6 localhost6\n")
-            f.close()
-
-            # set env
-            os.environ["HOME"] = self.userAccount["homedir"]
-            os.environ["USER"] = self.userAccount["username"]
-            if not config.video_show:
-                dlg = self._waitWindow(_("We're setting up your computer. Everything will be ready in a jiffy."))
-                dlg.show_all()
-                while gtk.events_pending():
-                    gtk.main_iteration(False)
-                self.runscripts(self.userAccount["username"])
-                time.sleep(4)
-                dlg.destroy()
-            else:
-                # launch pulseaudio
-                if os.path.exists("/usr/bin/start-pulseaudio-x11"):
-                    try:
-                        launch_pa = "su -l %s -c \"/usr/bin/start-pulseaudio-x11\">/dev/tty3 2>&1" % self.userAccount["username"]
-                        log.info("Launch pulseaudio with user %s", self.userAccount["username"])
-                        rc = os.system(launch_pa)
-                        if rc != 0:
-                            log.error("Failed to run PA launch script")
-                        else:
-                            time.sleep(0.5)
-                    except RuntimeError, msg:
-                        log.error("Error running launch PA: %s", msg)
-
-            # set btname
-            if os.path.exists("/usr/sbin/hciconfig") and btname:
-                try:
-                    set_btname = "/usr/sbin/hciconfig hciX name \"%s\"" % btname
-                    log.info("Set btname: %s", set_btname)
-                    rc = os.system(set_btname)
-                    if rc != 0:
-                        log.error("Failed to run btname setting")
-                except RuntimeError, msg:
-                    log.error("Error running btname setting: %s", msg)
-
-                try:
-                    os.system("killall bluetoothd")
-                    time.sleep(0.2)
- 
-                    start_bt_daemon="/usr/sbin/bluetoothd"
-                    log.info ("Restart bluetoothd: %s", start_bt_daemon)
-                    rc = os.system(start_bt_daemon)
-                    if rc != 0:
-                        log.error("Failed to restart bluetoothd")
-                except RuntimeError, msg:
-                    log.error("Error : failed to restart bluetoothd %s", msg)
-
-            # set hostname
-            if os.path.exists("/bin/hostname") and self.hostname:
-                try:
-                    set_hostname = "/bin/hostname \"%s\"" % self.hostname
-                    log.info("Set hostname: %s", set_hostname )
-                    rc = os.system(set_hostname)
-                    if rc != 0:
-                        log.error("Failed to run hostname setting")
-                except RuntimeError, msg:
-                    log.error("Error running hostname: %s", msg)
-
-
-
-        log.info("User Configuration finished, exit")
-        return RESULT_SUCCESS
-
-    def runscripts(self, username):
-        # rename the URIs stored in the Bickley database to the new username
-        bkl_rename_user_script = "/usr/share/firstboot/scripts/bkl_rename.sh"
-        if os.path.exists(bkl_rename_user_script):
-            try:
-                log.info("Rename the URIS in bickley database to the new username %s", username)
-                users.execWithCapture(bkl_rename_user_script, "", stdin=0, stderr=2)
-            except RuntimeError, msg:
-                log.error("Error running bkl-rename-user: %s", msg)
-
-        # extract media
-        extract_media_script = "/usr/share/firstboot/scripts/extract_media_backend.sh"
-        if os.path.exists(extract_media_script):
-            log.info("Extract media to home dir: %s", extract_media_script)
-            try:
-                users.execWithCapture(extract_media_script, "", stdin=0, stderr=2)
-            except RuntimeError, msg:
-                log.error("Failed to execute script %s: %s", extract_media_script, msg)
-
-    def createScreen(self, interface=None):
-        log.info("Display create user screen")
-        self.vbox = gtk.VBox(spacing=5)
-
-        #label = gtk.Label(_("You must create a 'username' for regular (non-administrative) "
-        #                    "use of your system.  To create a system 'username', please "
-        #                    "provide the information requested below.\n"))
-        label = gtk.Label(_("You are required to create an user account for regular "
-                            "(non-administrative) use of your system. Please provide "
-                            "the information requested below.\n "
-                            "Notice: the root password will be set the same as the "
-                            "password input below.\n"))
-
-        label.set_line_wrap(True)
-        label.set_alignment(0.0, 0.5)
-        label.set_size_request(900, -1)
-
-        self.usernameEntry = gtk.Entry()
-        self.fullnameEntry = gtk.Entry()
-        self.passwordEntry = gtk.Entry()
-        self.passwordEntry.set_visibility(False)
-        self.confirmEntry = gtk.Entry()
-        self.confirmEntry.set_visibility(False)
-
-        self.vbox.pack_start(label, False, True)
-
-        table = gtk.Table(2, 4)
-        label = gtk.Label(_("_Username:"))
-        label.set_use_underline(True)
-        label.set_mnemonic_widget(self.usernameEntry)
-        label.set_alignment(0.0, 0.5)
-        table.attach(label, 0, 1, 0, 1, gtk.FILL)
-        table.attach(self.usernameEntry, 1, 2, 0, 1, gtk.SHRINK, gtk.FILL, 5)
-
-        label = gtk.Label(_("Full Nam_e:"))
-        label.set_use_underline(True)
-        label.set_mnemonic_widget(self.fullnameEntry)
-        label.set_alignment(0.0, 0.5)
-        table.attach(label, 0, 1, 1, 2, gtk.FILL)
-        table.attach(self.fullnameEntry, 1, 2, 1, 2, gtk.SHRINK, gtk.FILL, 5)
-
-        label = gtk.Label(_("_Password:"))
-        label.set_use_underline(True)
-        label.set_mnemonic_widget(self.passwordEntry)
-        label.set_alignment(0.0, 0.5)
-        table.attach(label, 0, 1, 2, 3, gtk.FILL)
-        table.attach(self.passwordEntry, 1, 2, 2, 3, gtk.SHRINK, gtk.FILL, 5)
-
-        label = gtk.Label(_("Confir_m Password:"))
-        label.set_use_underline(True)
-        label.set_mnemonic_widget(self.confirmEntry)
-        label.set_alignment(0.0, 0.5)
-        table.attach(label, 0, 1, 3, 4, gtk.FILL)
-        table.attach(self.confirmEntry, 1, 2, 3, 4, gtk.SHRINK, gtk.FILL, 5)
-        self.vbox.pack_start(table, False)
-
-        self.encryptHomeToggle = gtk.CheckButton(_("Encrypt _data"))
-        self.vbox.pack_start(self.encryptHomeToggle, False)
-
-    def focus(self):
-        self.usernameEntry.grab_focus()
-
-    def initializeUI(self):
-        pass
-
-    def _runAuthconfig(self, *args):
-        self.nisFlag = 1
-
-        # Create a gtkInvisible to block until authconfig is done.
-        i = gtk.Invisible()
-        i.grab_add()
-
-        pid = start_process("/usr/bin/authconfig-gtk", "--firstboot")
-
-        while True:
-            while gtk.events_pending():
-                gtk.main_iteration_do()
-
-            child_pid, status = os.waitpid(pid, os.WNOHANG)
-            if child_pid == pid:
-                break
-            else:
-                time.sleep(0.1)
-
-        i.grab_remove()
-
-    def _waitWindow(self, text):
-        # Shamelessly copied from gui.py in anaconda.
-        win = gtk.Window()
-        win.set_title(_("Please wait"))
-        win.set_position(gtk.WIN_POS_CENTER)
-
-        label = gtk.Label(text)
-
-        box = gtk.Frame()
-        box.set_border_width(10)
-        box.add(label)
-        box.set_shadow_type(gtk.SHADOW_NONE)
-
-        win.add(box)
-        win.set_default_size(-1, -1)
-        addFrame(win, showtitle = 0)
-        return win
-
-    def _showErrorMessage(self, text):
-        dlg = gtk.MessageDialog(None, 0, gtk.MESSAGE_ERROR, gtk.BUTTONS_OK, text)
-        dlg.set_position(gtk.WIN_POS_CENTER)
-        dlg.set_modal(True)
-        addFrame(dlg, showtitle = 0)
-        rc = dlg.run()
-        dlg.destroy()
-        return None
--- scripts/extract_media.sh
+++ scripts/extract_media.sh
@@ -31,6 +31,11 @@
             mv -T $HOME/Music $XDG_MUSIC_DIR
             mv -T $HOME/Videos $XDG_VIDEOS_DIR
             mv -T $HOME/Pictures $XDG_PICTURES_DIR
+            mv -T $XDG_PICTURES_DIR/Animals $XDG_PICANIMALS_DIR
+            mv -T $XDG_PICTURES_DIR/Buildings $XDG_PICBUILDINGS_DIR
+            mv -T $XDG_PICTURES_DIR/Nature $XDG_PICNATURE_DIR
+            mv -T $XDG_PICTURES_DIR/Party $XDG_PICPARTY_DIR
+            mv -T $XDG_PICTURES_DIR/Views $XDG_PICVIEWS_DIR
         fi
     fi
 fi

++++++ deleted files:
--- fix-2028-set-can-default-flags-for-buttons.patch
--- remove_cracklib.patch




More information about the MeeGo-commits mailing list