Kaydet (Commit) 8442f458 authored tarafından Ozan Çağlayan's avatar Ozan Çağlayan

Remove mudur from comar/

üst e7c5911d
......@@ -13,7 +13,6 @@ api: ÇomarAPI genel yapılandırma fonksiyonlarını içeren Python paket
belgeler: Belgeler ve sunumlar
betikler: Taslak halindeki betikler
comar: Çomar sistem servisi, Çomar altyapısının çekirdeği
mudur: Pardus açılış ve donanım tanıma sistemi
smed: Çomar model.xml dosyası için basit bir editör
zorg: Pardus grafik yapılandırma sistemi
......@@ -13,7 +13,6 @@ api: ComarAPI Python package for generic configuration operations
belgeler: Documentation
betikler: Work-in-progress scripts
comar: Çomar system service, core part of the Çomar framework
mudur: Pardus initialization and hardware detection subsystem
smed: Simple editor for Çomar model.xml files (out-of-date, needs maintenance)
zorg: Pardus display configuration subsystem
Gürer Özen <gurer [at] pardus.org.tr>
S.Çağlar Onur <caglar [at] pardus.org.tr>
Onur Küçük <onur [at] pardus.org.tr>
2009-03-20 Ozan Çağlayan <ozan@pardus.org.tr>
* bin/mudur.py (copyUdevRules): Upstream says that we don't have to
retrigger for persistent rules,
* bin/mudur.py (CPU): Completely remove the CPU class as cpufreq
probing will be done by kernel,
* bin/mudur.py (checkFileSystems): Delete /forcefsck only if it
exists. Fixes an unhandled exception during boot if mudur=forcefsck
is given,
* bin/mudur.py (readyService): Remove this method and use startService
with a second parameter equal to 'ready' instead of this,
* bin/mudur.py (startService): Add a second parameter command= for
being able to call "service --ready" for some services.
* bin/mudur.py (Config.__init__): Enable debug by default as we don't
flood the mudur.log with millions of lines when it's enabled.
2009-03-16 Ozan Çağlayan <ozan@pardus.org.tr>
* bin/mudur.py: Disable CPUFreq probing as they will be
built into kernel.
2009-03-04 Ozan Çağlayan <ozan@pardus.org.tr>
* bin/mudur.py: Add occasional debug calls for
better logging into /var/log/mudur.log
2009-03-03 Ozan Çağlayan <ozan@pardus.org.tr>
* bin/mudur.py: The I/O redirection of start-stop-daemon
doesn't work at all. Implemented a new method run_async()
which runs a command in background and optionally redirects
its output and error streams.
* bin/mudur.py (startUdev): Use run_async() for spawning
udevadm monitor instead of buggy start-stop-daemon.
* bin/mudur.py (Logger.sync): Use epoch time instead of
uptime for not reading /proc/uptime for every log attempt.
Use writelines() instead of map().
2009-02-26 Ozan Çağlayan <ozan@pardus.org.tr>
* bin/network.py: Remove useless import.
* bin/service.py (loadConfig, Service.__init__): Rename shadowed builtin variables.
* bin/update-environment.py (read_env_d): Rename shadowed builtin variables.
* bin/mudur.py:
Comment the code,
Rename some functions for better self-explanation,
Split setupUdev() to setupUdev() and startUdev(),
Make the code pychecker clean.
* bin/mudur.py (loadFile, writeToFile):
Use open() instead of file().
* bin/mudur.py (setupUdev):
Limit the size of /dev to 10M,
No need to traverse /lib/udev/devices, just copy it recursively,
Remove uevent_helper hack for older kernels.
* bin/mudur.py (startUdev):
Use start-stop-daemon for udev monitor startup/cleanup.
* bin/mudur.py (stopSystem):
Call stopUdev() to stop udev daemon.
2009-02-25 Ozan Çağlayan <ozan@pardus.org.tr>
* bin/mudur.py (copyUdevFiles): Implement a new method for
copying the rules and log file instead of spawning a new process.
2009-02-23 Ozan Çağlayan <ozan@pardus.org.tr>
* bin/mudur.py (setupUdev):
Use start-stop-daemon for udev startup,
The default timeout is 180, no need to give it as a parameter,
Call "udevadm monitor" for logging into /dev/.udev.log,
Call /usr/bin/udevsync after rw remounting of the root filesystem
for copying the log file and the persistent network/cdrom rules
from /dev into /var/log and /etc (#8458, #8520).
2009-02-21 Fatih Aşıcı <fatih@pardus.org.tr>
* bin/mudur.py (startServices): Increase timeout for waiting X
socket to be ready and do not wait if xorg=off is passed on kernel
command line.
2009-02-02 Ozan Çağlayan <ozan@pardus.org.tr>
* bin/mudur.py (stopSystem): Use lambda function for sort helper.
2009-02-02 Bahadır Kandemir <bahadir@pardus.org.tr>
* bin/mudur.py: Handle logger.sync() exceptions (Fixes #7410).
2009-01-25 Ozan Çağlayan <ozan@pardus.org.tr>
* bin/mudur.py: Drop legacy kernel check for udev initialization.
2009-01-14 Furkan Duman <coderlord@gmail.com>
* bin/network.py: Unicode fix for Turkish characters in connection name.
2009-01-08 Ozan Çağlayan <ozan@pardus.org.tr>
* bin/mudur.py: Use lat0-16 instead of lat9-16 for Swedish font (#8940).
2009-01-06 Ozan Çağlayan <ozan@pardus.org.tr>
* bin/mudur.py (startServices): Start sysklogd after startNetwork and
remove redundant sysklogd as it's manually started.
2008-12-26 Onur Küçük <onur@pardus.org.tr>
* bin/mudur.py (cleanupTmp) : Add kde4 directories.
2008-12-26 Ozan Çağlayan <ozan@pardus.org.tr>
* po/es.po : Updated Spanish translation.
* bin/mudur.py : Encapsulate mudur with a main() function.
* bin/mudur.py : Replace old_handler stuff with Python's
default SIGINT signal handler.
2008-12-24 Ozan Çağlayan <ozan@pardus.org.tr>
* bin/mudur.py (modules): Remove module dependency calculation
as it's handled by kernel's pakhandler.
2008-12-11 Bahadır Kandemir <bahadir@pardus.org.tr>
* bin/mudur.py (cleanupVar): Ignore errors during the cleanup of
/var directory.
2008-11-10 Gökçen Eraslan <gokcen@pardus.org.tr>
* bin/update_environment.py (update_environment): Add PKG_CONFIG_PATH
to the special environment variables.
2008-10-13 Ozan Çağlayan <ozan@pardus.org.tr>
* bin/mudur.py (modules): i18n fix for 'Calculating module
dependencies...' string.
2008-10-12 Bahadır Kandemir <bahadir@pardus.org.tr>
* bin/service.py: Replace "-" with "_" before passing package
name to D-Bus
2008-09-17 Fatih Aşıcı <fatih@pardus.org.tr>
* bin/update-fstab.py: Do not create a directory when mount
point is 'none'.
2008-09-13 Ozan Çağlayan <ozan@pardus.org.tr>
* bin/service.py (format_service_list): Stopped conditional
services are now colored yellow in /bin/service's output.
2008-09-11 Fatih Aşıcı <fatih@pardus.org.tr>
* bin/update-environment.py (update_environment): Set the
default value of the new argument 'live' to False.
2008-09-11 Fatih Aşıcı <fatih@pardus.org.tr>
* bin/update-environment.py (update_environment): Add new
argument 'live' for being able to not call ldconfig
on live cd's.
(usage): Add the new command line argument '--live' to the
usage function's output.
(main): Parse the new argument '--live' using getopt and
pass it to update_environment() for further processing.
* bin/mudur.py (main): Call update-environment with '--live' in
case of a livecd boot.
2008-08-27 Bahadır Kandemir <bahadir@pardus.org.tr>
* bin/mudur.py (languages): Add sv_SE locale.
2008-07-07 Ozan Çağlayan <ozan@pardus.org.tr>
* bin/mudur.py (startDBus): Gettextize the string 'Starting DBus'.
2008-06-27 Ekin Meroğlu <ekin@pardus.org.tr>
* etc/mudur.conf: Redefine head_start to be 'kdebase'
2008-06-27 Bahadır Kandemir <bahadir@pardus.org.tr>
* setup.py: Version 2.0
Mudur
-----
Mudur is the first component of Pardus initialization
system. It's the main startup script, called by init
and handles basic initialization and shutdown.
REQURIES:
udev >= 092
service komutu için:
start iken start, stop iken stop deyince çıkan mesajlar
sadece server tiplileri göster mesajı
belki sıralama seçenekleri?
cpufreq modüllerini yükleme işi muavin'den müdüre taşınacak
muavin'de ki bir kaç özel durum mudur ile halledelimeli
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2007, TUBITAK/UEKAE
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation; either version 2 of the License, or (at your
# option) any later version. Please read the COPYING file.
#
import sys
import os
import subprocess
def wrap_service(package, op):
cmd = ["service", package, op]
return subprocess.call(cmd)
def populate_initd():
for name in os.listdir("/var/db/comar/code"):
if name.startswith("System_Service_"):
srvname = name[15:-3]
if not os.path.exists("/etc/init.d/%s" % srvname):
os.symlink("compat.py", "/etc/init.d/%s" % srvname)
if __name__ == "__main__":
myname = os.path.basename(sys.argv[0])
if len(sys.argv) == 2:
sys.exit(wrap_service(myname, sys.argv[1]))
elif myname == "compat.py" and os.getuid() == 0:
populate_initd()
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2006, TUBITAK/UEKAE
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation; either version 2 of the License, or (at your
# option) any later version. Please read the COPYING file.
#
import sys
import os
import subprocess
import getopt
header = "### This file is automatically generated by update-environment"
header_note = """
#
# Please do not edit this file directly. If you want to change
# anything, please take a look at the files in /etc/env.d
# and read the Pardus initialization system documentation.
#
# Bu otomatik olarak oluşturulmuş bir dosyadır.
# Lütfen bu dosyayı elle değiştirmeyin. Değiştirmek istediğiniz
# şeyler varsa, /etc/env.d dizinindeki dosyalara ve Pardus
# açılış sistemi belgesine bakın.
#
"""
specials = (
"KDEDIRS",
"PATH",
"CLASSPATH",
"LDPATH",
"MANPATH",
"INFOPATH",
"ROOTPATH",
"CONFIG_PROTECT",
"CONFIG_PROTECT_MASK",
"PRELINK_PATH",
"PRELINK_PATH_MASK",
"PYTHONPATH",
"ADA_INCLUDE_PATH",
"ADA_OBJECTS_PATH",
"PKG_CONFIG_PATH"
)
def read_env_d(envdir):
d = {}
paths = []
for name in os.listdir(envdir):
path = os.path.join(envdir, name)
# skip dirs (.svn, .cvs, etc)
if os.path.isdir(path):
continue
# skip backup and version control files
if name.endswith("~") or name.endswith(".bak") or name.endswith(",v"):
continue
# skip pisi's config file backups
# .oldconfig is obsolete, but checked anyway cause it may still exist at old systems
if name.endswith(".oldconfig") or name.endswith(".newconfig"):
continue
paths.append(path)
paths.sort()
for path in paths:
for line in file(path):
if line == "" or line.startswith("#"):
continue
line = line.rstrip("\n")
if "=" in line:
key, value = line.split("=", 1)
key = key.strip()
value = value.strip()
if value.startswith('"') or value.startswith("'"):
value = value[1:-1]
# Merge for special variables, override for others
if key in specials:
if d.has_key(key):
d[key].extend(value.split(":"))
else:
d[key] = value.split(":")
else:
d[key] = value
return d
def generate_profile_env(envdict, format='export %s="%s"\n'):
profile = ""
keys = envdict.keys()
keys.sort()
for key in keys:
if key != "LDPATH":
tmp = envdict[key]
if isinstance(tmp, list):
tmp = ":".join(tmp)
profile += format % (key, tmp)
return header + header_note + profile
def generate_ld_so_conf(envdict):
ldpaths = envdict["LDPATH"]
tmp = "\n".join(ldpaths)
return tmp + "\n"
def update_file(path, content):
f = file(path, "w")
f.write(content)
f.close()
def update_environment(prefix, live=False):
join = os.path.join
env = read_env_d(join(prefix, "etc/env.d"))
update_file(join(prefix, "etc/profile.env"), generate_profile_env(env))
update_file(join(prefix, "etc/csh.env"), generate_profile_env(env, 'setenv %s %s\n'))
if not live:
if env.has_key("LDPATH"):
update_file(join(prefix, "etc/ld.so.conf"), generate_ld_so_conf(env))
subprocess.call(["/sbin/ldconfig","-X","-r", prefix])
#
# Command line driver
#
def usage():
print "update-environment [--destdir <prefix>] [--live]"
def main(argv):
prefix = "/"
live = False
try:
opts, args = getopt.gnu_getopt(argv, "h", [ "help", "destdir=", "live" ])
except getopt.GetoptError:
usage()
for o, a in opts:
if o in ("-h", "--help"):
usage()
sys.exit(0)
if o in ("--destdir"):
prefix = a
if o in ("--live"):
live = True
update_environment(prefix, live)
if __name__ == "__main__":
main(sys.argv[1:])
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2005-2007 TUBITAK/UEKAE
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free
# Software Foundation; either version 2 of the License, or (at your option)
# any later version.
#
import os
import sys
import glob
import parted
# Default options
default_options = {
"vfat": ("quiet", "shortname=mixed", "dmask=007", "fmask=117", "utf8", "gid=6"),
"ext3": ("noatime", ),
"ext2": ("noatime", ),
"ntfs-3g": ("dmask=007", "fmask=117", "gid=6"),
"reiserfs": ("noatime", ),
"xfs": ("noatime", ),
"defaults": ("defaults", ),
}
default_mount_dir = "/mnt"
excluded_file_systems = ("proc", "tmpfs", "sysfs", "swap", "nfs", "nfs4", "cifs")
pardus_labels = ("PARDUS_ROOT", "PARDUS_HOME", "PARDUS_SWAP")
# Utility functions
def blockDevices():
devices = []
for dev_type in ["hd*", "sd*"]:
sysfs_devs = glob.glob("/sys/block/" + dev_type)
for sysfs_dev in sysfs_devs:
if not int(open(sysfs_dev + "/removable").read().strip()):
devlink = os.readlink(sysfs_dev + "/device")
devlink = os.path.realpath(os.path.join(sysfs_dev, "device", devlink))
if (not "/usb" in devlink) and (not "/fw-host" in devlink):
devices.append("/dev/" + os.path.basename(sysfs_dev))
devices.sort()
return devices
def blockPartitions(dev):
pdev = parted.PedDevice.get(dev)
try:
disk = parted.PedDisk.new(pdev)
except:
# FIXME: replace with what exception could we get here, bare except sucks
disk = pdev.disk_new_fresh(parted.disk_type_get("msdos"))
part = disk.next_partition()
while part:
if part.fs_type and part.fs_type.name != "linux-swap":
yield dev + str(part.num), part.fs_type.name
part = disk.next_partition(part)
def blockNameByLabel(label):
path = os.path.join("/dev/disk/by-label/%s" % label)
if os.path.islink(path):
return "/dev/%s" % os.readlink(path)[6:]
else:
return None
def getLocale():
try:
for line in file("/etc/env.d/03locale"):
if "LC_ALL" in line:
return line[7:].strip()
except:
pass
return "tr_TR.UTF-8"
# Fstab classes
class FstabEntry:
def __init__(self, line=None):
defaults = [ None, None, "auto", "defaults", 0, 0 ]
args = []
if line:
args = line.split()
args = args[:len(args)] + defaults[len(args):]
self.device_node = args[0]
self.mount_point = args[1]
self.file_system = args[2]
self.options = args[3]
self.dump_freq = args[4]
self.pass_no = args[5]
def __str__(self):
return "%-20s %-16s %-9s %-20s %s %s" % (
self.device_node,
self.mount_point,
self.file_system,
self.options,
self.dump_freq,
self.pass_no
)
class Fstab:
comment = """# See the manpage fstab(5) for more information.
#
# <fs> <mountpoint> <type> <opts> <dump/pass>
"""
def __init__(self, path=None):
if not path:
path = "/etc/fstab"
self.path = path
self.entries = []
self.partitions = None
self.labels = {}
for line in file(path):
if line.strip() != "" and not line.startswith('#'):
self.entries.append(FstabEntry(line))
def __str__(self):
return "\n".join(map(str, self.entries))
def scan(self):
self.partitions = {}
for dev in blockDevices():
for part, fstype in blockPartitions(dev):
self.partitions[part] = fstype, dev
if os.path.exists("/dev/disk/by-label"):
for label in os.listdir("/dev/disk/by-label/"):
self.labels[blockNameByLabel(label)] = label
def write(self, path=None):
if not path:
path = self.path
# Make sure mount points exist
for entry in self.entries:
if entry.mount_point != "none" and not os.path.exists(entry.mount_point):
os.makedirs(entry.mount_point)
f = file(path, "w")
f.write(self.comment)
f.write(str(self))
f.write("\n")
f.close()
def removeEntry(self, device_node):
for i, entry in enumerate(self.entries):
if entry.device_node == device_node and entry.mount_point != "/":
del self.entries[i]
def addEntry(self, device_node, mount_point=None):
if not self.partitions:
self.scan()
if not mount_point:
mount_point = os.path.join(default_mount_dir, os.path.basename(device_node))
file_system = self.partitions.get(device_node)[0]
if file_system in ("fat16", "fat32"):
file_system = "vfat"
if file_system == "ntfs":
file_system = "ntfs-3g"
if file_system == "hfs+":
file_system = "hfsplus"
options = default_options.get(file_system, None)
if not options:
options = default_options.get("defaults")
entry = FstabEntry()
entry.device_node = device_node
entry.mount_point = mount_point
entry.file_system = file_system
entry.options = ",".join(options)
if file_system == "ntfs-3g":
entry.options += ",locale=%s" % getLocale()
self.entries.append(entry)
return entry
def refresh(self):
if not self.partitions:
self.scan()
# Carefully remove non existing partitions
removal = []
for i, entry in enumerate(self.entries):
node = entry.device_node
if entry.mount_point == "/":
# Root partition is never removed
continue
if not entry.mount_point.startswith("/mnt"):
# Only remove partitions that were added in /mnt
continue
elif entry.file_system in excluded_file_systems:
# Virtual file systems are never removed
continue
elif node.startswith("LABEL="):
label = node.split("=", 1)[1]
if label in pardus_labels:
# Labelled Pardus system partitions are never removed
continue
if not self.partitions.has_key(blockNameByLabel(label)):
removal.append(node)
else:
if not self.partitions.has_key(node):
removal.append(node)
map(self.removeEntry, removal)
# Append all other existing non-removable partitions
mounted = set(map(lambda x: x.device_node, self.entries))
for part in self.partitions:
if not part in mounted:
if part in self.labels:
if "LABEL=%s" % self.labels[part] in mounted:
continue
self.addEntry(part)
# Command line driver
def refresh_fstab(path=None, debug=False):
f = Fstab(path)
if debug:
print "Fstab file:", f.path
print "--- Current table ---"
print f
f.refresh()
if debug:
print "--- Refreshed table ---"
print f
else:
f.write()
def main(args):
path = None
debug = False
if "--debug" in args:
args.remove("--debug")
debug = True
if len(args) > 0:
path = args[0]
refresh_fstab(path, debug)
if __name__ == "__main__":
main(sys.argv[1:])
#
# Pardus boot configuration
# Pardus açılış ayarları
#
# System language
# Sistem dili
#language="tr"
# System keymap, set if you are not using system language's default keymap.
# Sistem klavye haritası, sistem dilinin öntanımlısından farklıysa ayarlayın.
#keymap=
# Set to "UTC" if your computer's hardware clock is set to Greenwich
# mean time, set to "local" otherwise.
# Bilgisayarınızın donanım saati Greenwich saatine göre ayarlıysa bu
# değeri "UTC" yapın, aksi durumda "local" yapın.
#clock="local"
# Set to "yes" if you want to normalize systematic drift of the
# hardware clock, see the hwclock man page for more information.
# Donanım saatinin ritmik kaymasını düzeltmek için "yes" yapın,
# daha fazla bilgiyi hwclock komutunun man sayfasında bulabilirsiniz.
#clock_adjust="no"
# Number of TTYs
# Ayarlanacak konsol sayısı
#tty_number="6"
# First service to run with a head start
# Öncelikle başlatılacak servis
head_start="kdebase"
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2006-2008, TUBITAK/UEKAE
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation; either version 2 of the License, or (at your
# option) any later version. Please read the COPYING file.
#
import sys
import os
import glob
import shutil
import parser
version = "2.1.0"
distfiles = """
setup.py
bin/*.py
etc/mudur.conf
po/mudur.pot
po/*.po
"""
i18n_source_list = [ "bin/mudur.py", "bin/service.py", "bin/network.py" ]
def update_messages():
os.system("xgettext -o po/mudur.pot %s" % " ".join(i18n_source_list))
for item in os.listdir("po"):
if item.endswith(".po"):
os.system("msgmerge -q -o temp.po po/%s po/mudur.pot" % item)
os.system("cp temp.po po/%s" % item)
os.system("rm -f temp.po")
def make_dist():
distdir = "mudur-%s" % version
list = []
for t in distfiles.split():
list.extend(glob.glob(t))
if os.path.exists(distdir):
shutil.rmtree(distdir)
os.mkdir(distdir)
for file_ in list:
cum = distdir[:]
for d in os.path.dirname(file_).split('/'):
dn = os.path.join(cum, d)
cum = dn[:]
if not os.path.exists(dn):
os.mkdir(dn)
shutil.copy(file_, os.path.join(distdir, file_))
os.popen("tar -cjf %s %s" % ("mudur-" + version + ".tar.bz2", distdir))
shutil.rmtree(distdir)
def install_file(source, prefix, dest):
dest = os.path.join(prefix, dest)
if os.path.islink(dest):
os.unlink(dest)
try:
os.makedirs(os.path.dirname(dest))
except:
pass
print "installing '%s' to '%s'" % (source, dest)
os.system("cp %s %s" % (source, dest))
def install(args):
if args == []:
prefix = "/"
else:
prefix = args[0]
# Make sure that there isn't a syntax error in mudur.py
code = file("bin/mudur.py").read()
parser.suite(code).compile()
install_file("bin/mudur.py", prefix, "sbin/mudur.py")
install_file("bin/update-environment.py", prefix, "sbin/update-environment")
install_file("bin/update-fstab.py", prefix, "sbin/update-fstab")
install_file("bin/compat.py", prefix, "etc/init.d/compat.py")
install_file("bin/service.py", prefix, "bin/service")
install_file("bin/network.py", prefix, "bin/network")
install_file("etc/mudur.conf", prefix, "etc/conf.d/mudur")
for item in os.listdir("po"):
if item.endswith(".po"):
lang = item[:-3]
dest = "usr/share/locale/%s/LC_MESSAGES/mudur.mo" % lang
try:
os.makedirs(os.path.dirname(os.path.join(prefix, dest)))
except:
pass
path = os.path.join(prefix, dest)
print "compiling '%s' translation '%s'" % (lang, path)
os.system("msgfmt po/%s -o %s" % (item, path))
def usage():
print "setup.py install [prefix]"
print "setup.py update_messages"
print "setup.py dist"
def do_setup(args):
if args == []:
usage()
elif args[0] == "install":
install(args[1:])
elif args[0] == "update_messages":
update_messages()
elif args[0] == "dist":
make_dist()
else:
usage()
if __name__ == "__main__":
do_setup(sys.argv[1:])
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment