From 2fa5515e828c653a733a0a1ca5b50147cc8fff42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=2E=C3=87a=C4=9Flar=20Onur?= Date: Wed, 12 Oct 2005 14:25:56 +0000 Subject: [PATCH] =?UTF-8?q?Env.=20de=C4=9Fi=C5=9Fkenlerini=20ve=20ld.so.co?= =?UTF-8?q?nf'u=20update=20etmek=20i=C3=A7in=20gerekli=20arac=C4=B1n=20ilk?= =?UTF-8?q?=20hali,=20tamamlanmas=C4=B1=20i=C3=A7in=20bir=20iki=20=C3=B6ze?= =?UTF-8?q?lli=C4=9Fe=20ihtiyac=C4=B1=20var=20fakat=20=C3=A7al=C4=B1=C5=9F?= =?UTF-8?q?=C4=B1yor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tools/ebuild2pisi.py | 4 ++-- tools/update-environ.py | 48 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+), 2 deletions(-) create mode 100755 tools/update-environ.py diff --git a/tools/ebuild2pisi.py b/tools/ebuild2pisi.py index 27868649..9fb16904 100755 --- a/tools/ebuild2pisi.py +++ b/tools/ebuild2pisi.py @@ -26,8 +26,8 @@ PSPEC_TEMPLATE=''' %(packagename)s %(homepage)s - PACKAGER - PACKAGER_EMAIL + S.Çağlar Onur + caglar@uludag.org.tr %(license)s category diff --git a/tools/update-environ.py b/tools/update-environ.py new file mode 100755 index 00000000..9db7c68d --- /dev/null +++ b/tools/update-environ.py @@ -0,0 +1,48 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- + +# Generates /etc/ld.so.conf and /etc/profile.env according to /etc/env.d directory + +import os +import re + +def env_update(): + if not os.path.exists("/etc/env.d"): + os.makedirs("/etc/env.d", 0755) + + list = [] + for file in os.listdir("/etc/env.d"): + if not os.path.isdir(os.path.join("/etc/env.d", file)): + list.append(file) + + list.sort() + + keys = {} + for file in list: + f = open(os.path.join("/etc/env.d", file), "r") + for line in f: + if not re.search("^#", line.strip()): + currentLine = line.strip().split("=") + + try: + if keys.has_key(currentLine[0]): + keys[currentLine[0]] += ":" + currentLine[1].replace("\"", "") + else: + keys[currentLine[0]] = currentLine[1].replace("\"", "") + except IndexError: + pass + + keys["PATH"] += ":/bin/:/sbin/:/usr/bin/" + f = open("/etc/profile.env", "w") + for key in keys: + f.write("export %s=\"%s\"\n" % (key, keys[key])) + f.close() + + f = open("/etc/ld.so.conf", "w") + for path in keys["LDPATH"].split(":"): + f.write("%s\n" % path) + f.close() + + +if __name__ == "__main__": + env_update()