foryali first commit
works continue..
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Licensed under the GNU General Public License, version 3.
|
||||
# See the file http://www.gnu.org/licenses/gpl.txt
|
||||
|
||||
from pisi.actionsapi import pisitools
|
||||
from pisi.actionsapi import pythonmodules
|
||||
|
||||
def install():
|
||||
pythonmodules.install("--install-lib=/usr/lib/pardus")
|
||||
|
||||
pisitools.dosym("zorg-cli", "/usr/bin/zorg")
|
||||
|
||||
# This is now provided by xorg-server package.
|
||||
pisitools.remove("/usr/share/X11/DriversDB")
|
||||
@@ -0,0 +1,20 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from pisi.version import Version
|
||||
|
||||
def postInstall(fromVersion, fromRelease, toVersion, toRelease):
|
||||
if fromVersion and Version("0.90") <= Version(fromVersion) <= Version("0.96"):
|
||||
from zorg import config
|
||||
|
||||
busId = call("zorg", "Xorg.Display", "activeDeviceID")
|
||||
device = config.getDeviceInfo(busId)
|
||||
|
||||
if device:
|
||||
config.saveDeviceInfo(device)
|
||||
config.saveXorgConfig(device)
|
||||
|
||||
if fromRelease and int(fromRelease) < 81:
|
||||
from zorg import config
|
||||
|
||||
layout, variant = config.getKeymapOld()
|
||||
config.saveKeymap(layout, variant)
|
||||
@@ -0,0 +1,222 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import os
|
||||
|
||||
import comar
|
||||
from pardus.sysutils import *
|
||||
|
||||
from zorg.config import *
|
||||
from zorg.consts import *
|
||||
from zorg.probe import *
|
||||
from zorg.utils import *
|
||||
|
||||
kernel_module_file = os.path.join(config_dir, "kernel_module")
|
||||
|
||||
def getDevice():
|
||||
bus = configuredBus()
|
||||
if not bus:
|
||||
return None
|
||||
|
||||
return getDeviceInfo(bus)
|
||||
|
||||
def getDeviceOutput(output):
|
||||
dev = getDevice()
|
||||
if not dev:
|
||||
return None, None
|
||||
|
||||
if output not in dev.outputs:
|
||||
dev.outputs[output] = Output(output)
|
||||
|
||||
return dev, dev.outputs[output]
|
||||
|
||||
# Model methods
|
||||
|
||||
def ready(boot):
|
||||
opts = {}
|
||||
|
||||
if boot:
|
||||
opts = get_kernel_option("xorg")
|
||||
|
||||
if "keymap" in opts:
|
||||
keymap = opts["keymap"].split("/", 1)
|
||||
setKeymap(*keymap)
|
||||
|
||||
if "safe" in opts:
|
||||
return False
|
||||
|
||||
driver = opts.get("driver")
|
||||
|
||||
if driver or "probe" in opts:
|
||||
return initialConfig(driver)
|
||||
|
||||
busId = configuredBus()
|
||||
if not busId:
|
||||
return initialConfig()
|
||||
|
||||
if boot:
|
||||
# Check if the active card is changed
|
||||
try:
|
||||
device = getDeviceInfo(busId)
|
||||
except IOError:
|
||||
# Device is not present on specified bus.
|
||||
# Check if the new device is configured before.
|
||||
newBus = getPrimaryCard()
|
||||
if newBus:
|
||||
device = getDeviceInfo(VideoDevice(newBus).bus_id)
|
||||
if device and not device.isChanged():
|
||||
# Yes, it is configured before.
|
||||
# Reenable driver and write xorg.conf.
|
||||
device.enableDriver()
|
||||
saveXorgConfig(device)
|
||||
else:
|
||||
# This is a different card.
|
||||
return initialConfig()
|
||||
else:
|
||||
# No card is present. Return True in order to
|
||||
# start with a manually edited xorg.conf.
|
||||
return True
|
||||
else:
|
||||
if not device or device.isChanged():
|
||||
return initialConfig()
|
||||
|
||||
# Check kernel module. Later, this should be done
|
||||
# with Xorg.Driver.ready method.
|
||||
if os.path.exists(kernel_module_file):
|
||||
kernelModule = file(kernel_module_file).read()
|
||||
if run("/sbin/modprobe", "-i", kernelModule) and kernelModule != "fglrx":
|
||||
return False
|
||||
|
||||
return True
|
||||
|
||||
def initialConfig(preferredDriver=None):
|
||||
bus = getPrimaryCard()
|
||||
|
||||
if bus:
|
||||
device = VideoDevice(bus)
|
||||
else:
|
||||
# This machine might be a terminal server with no video cards.
|
||||
# We start X and leave the decision to the user.
|
||||
log_debug("No video card found.")
|
||||
return True
|
||||
|
||||
if preferredDriver is None:
|
||||
preferredDriver = device.preferredDriver()
|
||||
|
||||
device.setDriver(preferredDriver)
|
||||
|
||||
saveDeviceInfo(device)
|
||||
saveXorgConfig(device)
|
||||
|
||||
return True
|
||||
|
||||
def safeConfig():
|
||||
bus = getPrimaryCard()
|
||||
|
||||
if bus:
|
||||
device = VideoDevice(bus)
|
||||
else:
|
||||
# See the comment in initialConfig
|
||||
return True
|
||||
|
||||
device.setDriver("vesa")
|
||||
device.depth = 16
|
||||
device.outputs["default"] = Output("default")
|
||||
device.monitors["default"] = Monitor()
|
||||
|
||||
saveDeviceInfo(device)
|
||||
saveXorgConfig(device)
|
||||
|
||||
return True
|
||||
|
||||
# FIXME Confusing method name
|
||||
def activeDeviceID():
|
||||
return configuredBus()
|
||||
|
||||
def listDrivers():
|
||||
drivers = listAvailableDrivers()
|
||||
|
||||
link = comar.Link()
|
||||
packages = list(link.Xorg.Driver)
|
||||
for package in packages:
|
||||
try:
|
||||
info = link.Xorg.Driver[package].getInfo()
|
||||
except dbus.DBusException:
|
||||
continue
|
||||
alias = str(info["alias"])
|
||||
driver = str(info["xorg-module"])
|
||||
drivers.append(alias)
|
||||
if driver in drivers:
|
||||
drivers.remove(driver)
|
||||
|
||||
return sorted(drivers)
|
||||
|
||||
def setDriver(driver):
|
||||
dev = getDevice()
|
||||
if dev:
|
||||
dev.setDriver(driver)
|
||||
saveDeviceInfo(dev)
|
||||
|
||||
def setDepth(depth):
|
||||
dev = getDevice()
|
||||
if dev:
|
||||
dev.depth = depth
|
||||
saveDeviceInfo(dev)
|
||||
|
||||
def setOutput(output, enabled, ignored):
|
||||
dev, out = getDeviceOutput(output)
|
||||
|
||||
if dev:
|
||||
out.setEnabled(enabled)
|
||||
out.setIgnored(ignored)
|
||||
|
||||
saveDeviceInfo(dev)
|
||||
|
||||
def setMode(output, resolution, rate):
|
||||
dev, out = getDeviceOutput(output)
|
||||
|
||||
if dev:
|
||||
out.setMode(resolution, rate)
|
||||
|
||||
saveDeviceInfo(dev)
|
||||
|
||||
def setOrientation(output, rotation, reflection):
|
||||
dev, out = getDeviceOutput(output)
|
||||
|
||||
if dev:
|
||||
out.setOrientation(rotation, reflection)
|
||||
|
||||
saveDeviceInfo(dev)
|
||||
|
||||
def setPosition(output, position, arg):
|
||||
dev, out = getDeviceOutput(output)
|
||||
|
||||
if dev:
|
||||
out.setPosition(position, arg)
|
||||
|
||||
saveDeviceInfo(dev)
|
||||
|
||||
def setMonitor(output, vendor, model, horizSync, vertRefresh):
|
||||
dev, out = getDeviceOutput(output)
|
||||
|
||||
if dev:
|
||||
if model:
|
||||
mon = Monitor()
|
||||
mon.vendor = vendor
|
||||
mon.model = model
|
||||
mon.hsync = horizSync
|
||||
mon.vref = vertRefresh
|
||||
dev.monitors[output] = mon
|
||||
elif output in dev.monitors:
|
||||
del dev.monitors[output]
|
||||
else:
|
||||
return
|
||||
|
||||
saveDeviceInfo(dev)
|
||||
|
||||
def syncConfigs():
|
||||
dev = getDevice()
|
||||
if dev:
|
||||
saveXorgConfig(dev)
|
||||
|
||||
def setKeymap(layout, variant=""):
|
||||
saveKeymap(layout, variant)
|
||||
@@ -0,0 +1,106 @@
|
||||
Index: zorg-2.0.4/zorg/config.py
|
||||
===================================================================
|
||||
--- zorg-2.0.4.orig/zorg/config.py
|
||||
+++ zorg-2.0.4/zorg/config.py
|
||||
@@ -11,6 +11,21 @@ from zorg.parser import *
|
||||
from zorg.probe import VideoDevice, Monitor, Output
|
||||
from zorg.utils import *
|
||||
|
||||
+KEYMAP_CONF_TEMPLATE="""\
|
||||
+# This file is generated by zorg. If you want to change settings
|
||||
+# in this file, edit the file 10-keyboard.conf in the same
|
||||
+# directory.
|
||||
+
|
||||
+Section "InputClass"
|
||||
+ Identifier "Configured Keymap"
|
||||
+ MatchIsKeyboard "on"
|
||||
+ MatchTag "use_configured_keymap"
|
||||
+
|
||||
+ %(comment_layout)sOption "xkb_layout" "%(layout)s"
|
||||
+ %(comment_variant)sOption "xkb_variant" "%(variant)s"
|
||||
+EndSection
|
||||
+"""
|
||||
+
|
||||
def saveXorgConfig(card):
|
||||
parser = XorgParser()
|
||||
|
||||
@@ -265,7 +280,7 @@ def saveDeviceInfo(card):
|
||||
f = open(consts.config_file, "w")
|
||||
f.write(doc.toPrettyString().replace("\n\n", ""))
|
||||
|
||||
-def getKeymap():
|
||||
+def getKeymapOld():
|
||||
layout = None
|
||||
variant = ""
|
||||
|
||||
@@ -297,24 +312,44 @@ def getKeymap():
|
||||
|
||||
return layout, variant
|
||||
|
||||
-def saveKeymap(layout, variant=""):
|
||||
- if not os.path.exists(consts.config_dir):
|
||||
- os.mkdir(consts.config_dir, 0755)
|
||||
+def getKeymap():
|
||||
+ layout = None
|
||||
+ variant = ""
|
||||
|
||||
try:
|
||||
- doc = piksemel.parse(consts.config_file)
|
||||
+ p = XorgParser()
|
||||
+ p.parseFile(consts.keymap_conf)
|
||||
+ section = p.getSections("InputClass")[0]
|
||||
+ layout = section.get("xkb_layout")
|
||||
+ variant = section.get("xkb_variant", "")
|
||||
+
|
||||
except OSError:
|
||||
- doc = piksemel.newDocument("ZORG")
|
||||
+ pass
|
||||
+
|
||||
+ if not layout:
|
||||
+ from pardus.localedata import languages
|
||||
|
||||
- keyboardTag = doc.getTag("Keyboard")
|
||||
+ try:
|
||||
+ language = file("/etc/mudur/language").read().strip()
|
||||
+ except IOError:
|
||||
+ language = "en"
|
||||
+
|
||||
+ if not languages.has_key(language):
|
||||
+ language = "en"
|
||||
|
||||
- if keyboardTag:
|
||||
- keyboardTag.hide()
|
||||
+ keymap = languages[language].keymaps[0]
|
||||
+ layout = keymap.xkb_layout
|
||||
+ variant = keymap.xkb_variant
|
||||
|
||||
- keyboardTag = doc.insertTag("Keyboard")
|
||||
- keyboardTag.insertTag("Layout").insertData(layout)
|
||||
- if variant:
|
||||
- keyboardTag.insertTag("Variant").insertData(variant)
|
||||
+ return layout, variant
|
||||
|
||||
- f = file(consts.config_file, "w")
|
||||
- f.write(doc.toPrettyString().replace("\n\n", ""))
|
||||
+def saveKeymap(layout, variant=""):
|
||||
+ opts = {"layout": layout,
|
||||
+ "variant": variant,
|
||||
+ "comment_layout": "" if layout else "#",
|
||||
+ "comment_variant": "" if variant else "#"}
|
||||
+
|
||||
+ with open(consts.keymap_conf, "w") as f:
|
||||
+ f.write(KEYMAP_CONF_TEMPLATE % opts)
|
||||
+ f.flush()
|
||||
+ os.fsync(f.fileno())
|
||||
Index: zorg-2.0.4/zorg/consts.py
|
||||
===================================================================
|
||||
--- zorg-2.0.4.orig/zorg/consts.py
|
||||
+++ zorg-2.0.4/zorg/consts.py
|
||||
@@ -8,6 +8,7 @@ data_dir = "/usr/share/X11"
|
||||
modules_dir = "/usr/lib/xorg/modules"
|
||||
|
||||
xorg_conf_file = "/etc/X11/xorg.conf"
|
||||
+keymap_conf = "/etc/X11/xorg.conf.d/00-configured-keymap.conf"
|
||||
config_file = join(config_dir, "config.xml")
|
||||
configured_bus_file = join(config_dir, "configured_bus")
|
||||
drivers_file = join(data_dir, "DriversDB")
|
||||
@@ -0,0 +1,19 @@
|
||||
Index: zorg-cli
|
||||
===================================================================
|
||||
--- zorg-cli (revision 31546)
|
||||
+++ zorg-cli (revision 31547)
|
||||
@@ -94,8 +94,12 @@
|
||||
setDriver(opts.driver)
|
||||
|
||||
elif opts.keymap:
|
||||
- keymap = opts.keymap.split("/", 1)
|
||||
- link.Xorg.Display["zorg"].setKeymap(*keymap)
|
||||
+ if "/" in opts.keymap:
|
||||
+ layout, variant = opts.keymap.split("/", 1)
|
||||
+ else:
|
||||
+ layout, variant = opts.keymap, ""
|
||||
|
||||
+ link.Xorg.Display["zorg"].setKeymap(layout, variant)
|
||||
+
|
||||
else:
|
||||
parser.print_help()
|
||||
@@ -0,0 +1,40 @@
|
||||
Section "Module"
|
||||
SubSection "extmod"
|
||||
Option "omit xfree86-dga" "true"
|
||||
EndSubSection
|
||||
EndSection
|
||||
|
||||
Section "ServerFlags"
|
||||
Option "BlankTime" "0"
|
||||
Option "OffTime" "0"
|
||||
Option "SuspendTime" "0"
|
||||
Option "AllowMouseOpenFail" "true"
|
||||
Option "StandbyTime" "0"
|
||||
EndSection
|
||||
|
||||
Section "Device"
|
||||
Identifier "VideoCard"
|
||||
Driver "vesa"
|
||||
EndSection
|
||||
|
||||
Section "Screen"
|
||||
Identifier "Screen"
|
||||
Device "VideoCard"
|
||||
Monitor "Default Monitor"
|
||||
DefaultDepth 16
|
||||
SubSection "Display"
|
||||
Depth 16
|
||||
Modes "800x600" "640x480"
|
||||
EndSubSection
|
||||
EndSection
|
||||
|
||||
Section "ServerLayout"
|
||||
Identifier "Layout"
|
||||
Screen "Screen"
|
||||
EndSection
|
||||
|
||||
Section "Monitor"
|
||||
Identifier "Default Monitor"
|
||||
HorizSync 31.5 - 50
|
||||
VertRefresh 50 - 70
|
||||
EndSection
|
||||
@@ -0,0 +1,50 @@
|
||||
<?xml version="1.0" ?>
|
||||
<!DOCTYPE PISI SYSTEM "http://www.pisilinux.org/projeler/pisi/pisi-spec.dtd">
|
||||
<PISI>
|
||||
<Source>
|
||||
<Name>zorg</Name>
|
||||
<Homepage>http://www.pisilinux.org</Homepage>
|
||||
<Packager>
|
||||
<Name>PisiLinux Community</Name>
|
||||
<Email>admins@pisilinux.org</Email>
|
||||
</Packager>
|
||||
<License>GPLv2</License>
|
||||
<IsA>app:console</IsA>
|
||||
<Summary>Çomar's X configuration tools</Summary>
|
||||
<Description>zorg is a set of X configuration tools and monitor and display adapter database files.</Description>
|
||||
<Archive sha1sum="e643f28430d9c6f190a5164e87960ae0094f0cd0" type="targz">https://github.com/forYali/zorg/archive/2.0.4.tar.gz</Archive>
|
||||
<Patches>
|
||||
<Patch level="1">keyboard-config.patch</Patch>
|
||||
<!--Patch>setkeymap-signature.patch</Patch-->
|
||||
</Patches>
|
||||
</Source>
|
||||
|
||||
<Package>
|
||||
<Name>zorg</Name>
|
||||
<Files>
|
||||
<Path fileType="executable">/sbin</Path>
|
||||
<Path fileType="executable">/usr/bin</Path>
|
||||
<Path fileType="library">/usr/lib</Path>
|
||||
<Path fileType="data">/usr/share/X11</Path>
|
||||
<Path fileType="doc">/usr/share/doc</Path>
|
||||
<Path fileType="data">/var/lib/zorg</Path>
|
||||
</Files>
|
||||
<AdditionalFiles>
|
||||
<AdditionalFile owner="root" permission="0644" target="/usr/share/X11/xorg-safe.conf">xorg-safe.conf</AdditionalFile>
|
||||
</AdditionalFiles>
|
||||
<Provides>
|
||||
<COMAR script="xorg.display.py">Xorg.Display</COMAR>
|
||||
<COMAR script="package.py">System.Package</COMAR>
|
||||
</Provides>
|
||||
</Package>
|
||||
|
||||
<History>
|
||||
<Update release="1">
|
||||
<Date>2017-03-05</Date>
|
||||
<Version>2.0.4</Version>
|
||||
<Comment>First release</Comment>
|
||||
<Name>Ertuğrul Erata</Name>
|
||||
<Email>ertugrulerata@gmail.com</Email>
|
||||
</Update>
|
||||
</History>
|
||||
</PISI>
|
||||
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" ?>
|
||||
<PISI>
|
||||
<Source>
|
||||
<Name>zorg</Name>
|
||||
<Summary xml:lang="tr">Çomar'ın X yapılandırma araçları</Summary>
|
||||
<Description xml:lang="tr">X yapılandırma araçları, monitör ve ekran kartı veritabanları</Description>
|
||||
<Description xml:lang="fr">outils de configuration de X, fichiers de base de données des écrans et des cartes vidéo.</Description>
|
||||
<Summary xml:lang="de">Çomar's X-Konfigurationtools</Summary>
|
||||
</Source>
|
||||
</PISI>
|
||||
Reference in New Issue
Block a user