summaryrefslogtreecommitdiffstats
path: root/source4/scripting/python/samba/samba3
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2012-05-28 18:42:54 +0200
committerKai Blin <kai@samba.org>2012-05-30 00:37:58 +0200
commitd4998ccce73e1ca782b8bd40430be1a625a4c8fb (patch)
treefbb22d35891433d4e72db22e8bdef966a0f6e2f3 /source4/scripting/python/samba/samba3
parent230f933babe72536a1bbb930b6c9d71df8b2b903 (diff)
downloadsamba-d4998ccce73e1ca782b8bd40430be1a625a4c8fb.tar.gz
samba-d4998ccce73e1ca782b8bd40430be1a625a4c8fb.tar.xz
samba-d4998ccce73e1ca782b8bd40430be1a625a4c8fb.zip
s4-dns: Make the TCP dns server async
Signed-off-by: Kai Blin <kai@samba.org>
Diffstat (limited to 'source4/scripting/python/samba/samba3')
0 files changed, 0 insertions, 0 deletions
> 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061
from snack import *
import sys
import isys
import os
import stat
import iutil
import rpm
import time
import gettext_rh
import glob
import signal
import installclass
from translate import _, cat, N_
from log import log

from constants_text import *
from lilo_text import LiloWindow
from lilo_text import LiloAppendWindow
from lilo_text import LiloImagesWindow
from silo_text import SiloWindow
from silo_text import SiloAppendWindow
from silo_text import SiloImagesWindow
from network_text import NetworkWindow
from network_text import HostnameWindow
from userauth_text import RootPasswordWindow
from userauth_text import UsersWindow
from userauth_text import AuthConfigWindow
from partitioning_text import PartitionMethod
from partitioning_text import LoopSizeWindow
from partitioning_text import ManualPartitionWindow
from partitioning_text import AutoPartitionWindow
from partitioning_text import PartitionWindow
from partitioning_text import TurnOnSwapWindow
from partitioning_text import FormatWindow
from packages_text import PackageGroupWindow
from packages_text import IndividualPackageWindow
from packages_text import PackageDepWindow
from timezone_text import TimezoneWindow
from bootdisk_text import BootDiskWindow
from bootdisk_text import MakeBootDiskWindow

import installclass

class LanguageWindow:
    def __call__(self, screen, todo, textInterface):
        languages = todo.language.available ()
        descriptions = languages.keys ()
        descriptions.sort ()
        current = todo.language.get ()
        for lang in descriptions:
            if languages[lang] == current:
                default = descriptions.index (lang)
            
        height = min((screen.height - 16, len(descriptions)))
        if todo.reconfigOnly:
            buttons = [_("Ok"), _("Back")]
        else:
            buttons = [_("Ok")]

        (button, choice) = \
            ListboxChoiceWindow(screen, _("Language Selection"),
			_("What language would you like to use during the "
			  "installation process?"), descriptions, 
			buttons, width = 30, default = default, scroll = 1,
                                height = height, help = "lang")

	if (button == string.lower(_("Back"))): return INSTALL_BACK

        choice = descriptions[choice]
        lang = languages [choice]
        newlangs = [lang]
	if len(lang) > 2:
            newlangs.append(lang[:2])
        cat.setlangs (newlangs)
        todo.language.set (choice)
	if not todo.serial:
	    map = todo.language.getFontMap(choice)
	    font = todo.language.getFontFile(choice)
	    if map != "None":
		if os.access("/bin/consolechars", os.X_OK):
		    iutil.execWithRedirect ("/bin/consolechars",
					["/bin/consolechars", "-f", font, "-m", map])
		else:
		    try:
			isys.loadFont(map)
		    except SystemError, (errno, msg):
			log("Could not load font %s: %s" % (font, msg))
	    elif os.access("/bin/consolechars", os.X_OK):
		# test and reconfig
		iutil.execWithRedirect ("/bin/consolechars", 
			["/bin/consolechars", "-d", "-m", "iso01"])

	textInterface.drawFrame()
	    
        return INSTALL_OK

class MouseDeviceWindow:
    def __call__(self, screen, todo):
	choices = { _("/dev/ttyS0 (COM1 under DOS)") : "ttyS0",
		    _("/dev/ttyS1 (COM2 under DOS)") : "ttyS1",
		    _("/dev/ttyS2 (COM3 under DOS)") : "ttyS2",
		    _("/dev/ttyS3 (COM4 under DOS)") : "ttyS3" }

	i = 0
	default = 0
	mouse = todo.mouse.getDevice()
	if (mouse[0:4] != "ttyS"): return INSTALL_NOOP

	l = choices.keys()
	l.sort()
	for choice in l:
	    if choices[choice] == mouse:
		default = i
		break
	    i = i + 1

	(button, result) = ListboxChoiceWindow(screen, _("Device"),
		    _("What device is your mouse located on? %s %i") % (mouse, default), l,
		    [ _("Ok"), _("Back") ], help = "mousedevice", default = default )
	if (button == string.lower(_("Back"))): return INSTALL_BACK

	todo.mouse.setDevice(choices[l[result]])

	#import sys; sys.exit(0)

	return INSTALL_OK

class MouseWindow:
    def __call__(self, screen, todo):
	if todo.serial:
	    return INSTALL_NOOP
        mice = todo.mouse.available ().keys ()
        mice.sort ()
	(default, emulate) = todo.mouse.get ()
	if default == "Sun - Mouse":
	    return INSTALL_NOOP
        default = mice.index (default)

	bb = ButtonBar(screen, [_("OK"), _("Back")])
	t = TextboxReflowed(40, 
		_("Which model mouse is attached to this computer?"))
	l = Listbox(8, scroll = 1, returnExit = 0)

        key = 0
        for mouse in mice:
	    l.append(mouse, key)
	    key = key + 1
	l.setCurrent(default)

	c = Checkbox(_("Emulate 3 Buttons?"), isOn = emulate)

	g = GridFormHelp(screen, _("Mouse Selection"), "mousetype", 1, 4)
	g.add(t, 0, 0)
	g.add(l, 0, 1, padding = (0, 1, 0, 1))
	g.add(c, 0, 2, padding = (0, 0, 0, 1))
	g.add(bb, 0, 3, growx = 1)

	rc = g.runOnce()

        button = bb.buttonPressed(rc)
        
        if button == string.lower (_("Back")):
            return INSTALL_BACK

	choice = l.current()
	emulate = c.selected()

        todo.mouse.set(mice[choice], emulate)

	oldDev = todo.mouse.getDevice()
	if (oldDev):
	    newDev = todo.mouse.available()[mice[choice]][2]
	    if ((oldDev[0:4] == "ttyS" and newDev[0:4] == "ttyS") or
		(oldDev == newDev)):
		pass
	    else:
		todo.mouse.setDevice(newDev)

	return INSTALL_OK

class KeyboardWindow:
    def __call__(self, screen, todo):
	if todo.serial:
	    return INSTALL_NOOP
        keyboards = todo.keyboard.available ()
        keyboards.sort ()
        default = keyboards.index (todo.keyboard.get ())

        (button, choice) = \
            ListboxChoiceWindow(screen, _("Keyboard Selection"),
                                _("Which model keyboard is attached to this computer?"), keyboards, 
                                buttons = [_("OK"), _("Back")], width = 30, scroll = 1, height = 8,
                                default = default, help = "kybd")
        
        if button == string.lower (_("Back")):
            return INSTALL_BACK
        todo.keyboard.set (keyboards[choice])
	if not todo.serial:
            if todo.reconfigOnly:
                iutil.execWithRedirect ("/bin/loadkeys",
                                        ["/bin/loadkeys", keyboards[choice]],
					stderr = "/dev/null")
            else:
                try:
                    isys.loadKeymap(keyboards[choice])
                except SystemError, (errno, msg):
		    log("Could not install keymap %s: %s" % (keyboards[choice], msg))
        return INSTALL_OK
    
class InstallPathWindow:
    def __call__ (self, screen, todo, intf):
	from fstab import NewtFstab

        # see if kickstart specified install type
	showScreen = 1
	if (todo.instClass.installType == "install"):
            intf.steps = intf.commonSteps + intf.installSteps
            todo.upgrade = 0
	    showScreen = 0
	elif (todo.instClass.installType == "upgrade"):
            intf.steps = intf.commonSteps + intf.upgradeSteps
            todo.upgrade = 1
	    showScreen = 0

        # this is (probably) the first place todo.fstab gets created
        if not showScreen:
	    todo.fstab = NewtFstab(todo.setupFilesystems, 
				       todo.serial, 0, 0,
				       todo.intf.waitWindow,
				       todo.intf.messageWindow)
	    return INSTALL_NOOP

	classes = installclass.availableClasses()

	choices = []
	for (name, object, icon) in classes:
	    choices.append(_(name))
	upgradeChoice = len(choices)
	choices.append(_("Upgrade Existing Installation"))

	if (todo.upgrade):
	    default = upgradeChoice
	    orig = None
	else:
	    instClass = todo.getClass()
	    orig = None
	    i = 0
	    for (name, object, icon) in classes:
		if isinstance(instClass, object):
		    orig = i
		    break
		i = i + 1

	    if (orig):
		default = orig
	    else:
		default = 0

	(button, choice) = ListboxChoiceWindow(screen, _("Installation Type"),
			_("What type of system would you like to install?"),
			    choices, [(_("OK"), "ok"), (_("Back"), "back")],
			    width = 40, default = default, help = "installpath")

        if button == "back":
            return INSTALL_BACK

	needNewDruid = 0

	if (choice == upgradeChoice):
            intf.steps = intf.commonSteps + intf.upgradeSteps
            todo.upgrade = 1
        else:
            intf.steps = intf.commonSteps + intf.installSteps
            todo.upgrade = 0
	    if (choice != orig):
		(name, objectClass, logo) = classes[choice]
		todo.setClass(objectClass(todo.expert))
		needNewDruid = 1

	if needNewDruid or not todo.fstab:
	    todo.fstab = NewtFstab(todo.setupFilesystems, 
				       todo.serial, 0, 0,
				       todo.intf.waitWindow,
				       todo.intf.messageWindow)

        return INSTALL_OK

class UpgradeExamineWindow:
    def __call__ (self, dir, screen, todo):
	if dir == -1:
	    # Hack to let backing out of upgrades work properly
	    from fstab import NewtFstab
	    if todo.fstab:
		todo.fstab.turnOffSwap()
	    todo.fstab = NewtFstab(todo.setupFilesystems, 
				       todo.serial, 0, 0,
				       todo.intf.waitWindow,
				       todo.intf.messageWindow)
	    return INSTALL_NOOP

        parts = todo.upgradeFindRoot ()

        if not parts:
            ButtonChoiceWindow(screen, _("Error"),
                               _("You don't have any Linux partitions. You "
                                 "can't upgrade this system!"),
                               [ _("Back") ], width = 50)
            return INSTALL_BACK
        
        if len (parts) > 1:
            height = min (len (parts), 12)
            if height == 12:
                scroll = 1
            else:
                scroll = 0

            (button, choice) = \
                ListboxChoiceWindow(screen, _("System to Upgrade"),
                                    _("What partition holds the root partition "
                                      "of your installation?"), parts, 
                                    [ _("OK"), _("Back") ], width = 30,
                                    scroll = scroll, height = height,
				    root = "multipleroot")
            if button == string.lower (_("Back")):
                return INSTALL_BACK
            else:
                root = parts[choice]
        else:
            root = parts[0]

        todo.upgradeFindPackages (root)

class CustomizeUpgradeWindow:
    def __call__ (self, screen, todo, indiv):
        rc = ButtonChoiceWindow (screen, _("Customize Packages to Upgrade"),
                                 _("The packages you have installed, "
                                   "and any other packages which are "
                                   "needed to satisfy their "
                                   "dependencies, have been selected "
                                   "for installation. Would you like "
                                   "to customize the set of packages "
                                   "that will be upgraded?"),
                                 buttons = [ _("Yes"), _("No"), _("Back") ],
				help = "custupgrade")

        if rc == string.lower (_("Back")):
            return INSTALL_BACK

        if rc == string.lower (_("No")):
            indiv.set (0)
        else:
            indiv.set (1)

        return INSTALL_OK


class WelcomeWindow:
    def __call__(self, screen):
        rc = ButtonChoiceWindow(screen, _("Red Hat Linux"), 
                                _("Welcome to Red Hat Linux!\n\n"
                                  "This installation process is outlined in detail in the "
                                  "Official Red Hat Linux Installation Guide available from "
                                  "Red Hat Software. If you have access to this manual, you "
                                  "should read the installation section before continuing.\n\n"
                                  "If you have purchased Official Red Hat Linux, be sure to "
                                  "register your purchase through our web site, "
                                  "http://www.redhat.com/."),
                                buttons = [_("OK"), _("Back")], width = 50,
				help = "welcome")

	if rc == string.lower(_("Back")):
	    return INSTALL_BACK

        return INSTALL_OK

class ReconfigWelcomeWindow:
    def __call__(self, screen):
        rc = ButtonChoiceWindow(screen, _("Red Hat Linux"), 
                                _("Welcome to the Red Hat Linux!\n\n"
                                  "You have entered reconfiguration mode, "
                                  "which will allow you to configure "
                                  "site-specific options of your computer."
                                  "\n\n"
                                  "To exit without changing your setup "
                                  "select the ""Cancel"" button below."),
                                buttons = [_("OK"), _("Cancel")], width = 50,
				help = "reconfigwelcome")

	if rc == string.lower(_("Cancel")):
            screen.finish()
	    os._exit(0)

        return INSTALL_OK

class XConfigWindow:
    def __call__(self, screen, todo):
        #
        # if in reconfigOnly mode we query existing rpm db
        # if X not installed, just skip this step
        #
        if todo.reconfigOnly:
#            import rpm
#            db = rpm.opendb()
#            rc = db.findbyname ("XFree86")
#            if len(rc) == 0:
#                return None

#
#       for now ignore request to configure X11 in reconfig mode
#
            return None
        
        else:
            # we need to get the package list here for things like
            # workstation install - which will not have read the
            # package list yet.
            todo.getCompsList ()

            if not todo.hdList.packages.has_key('XFree86') or \
               not todo.hdList.packages['XFree86'].selected:
                return None

        todo.x.probe (probeMonitor = 0)

        if todo.x.server:
            rc = ButtonChoiceWindow (screen, _("X probe results"),
                                     todo.x.probeReport (),
                                     buttons = [ _("OK"), _("Back") ])
        
            if rc == string.lower (_("Back")):
                return INSTALL_BACK

	    todo._cardindex = -1
            return INSTALL_OK

	if todo.serial:
	    # if doing serial installation and no card was probed,
	    # assume no card is present (typical case).
	    return INSTALL_NOOP

	# if we didn't find a server, we need the user to choose...
	carddb = todo.x.cards()
	cards = carddb.keys ()
	cards.sort ()
	cards.append (_("Unlisted Card"))

	servers = [ "Mono", "VGA16", "SVGA", "S3", "Mach32", "Mach8", "8514", "P9000", "AGX",
		    "W32", "W32", "Mach64", "I128", "S3V", "3DLabs" ]
	server = None

	rc = INSTALL_NOOP
	while rc != INSTALL_OK:
	    (rc, choice) = ListboxChoiceWindow(screen, _("Video Card Selection"),
					       _("Which video card do you have?"),
					       cards,
					       buttons = [_("OK"), _("Back")],
					       width = 70, scroll = 1,
					       height = screen.height - 14,
					       help = "videocard")
	    if rc == string.lower (_("Back")):
		return INSTALL_BACK

	    todo._cardindex = -1

	    if cards[choice] == _("Unlisted Card"):
		(rc , choice) = \