From f86d71f8d716a6831a3d0e1d94ac8e87cc929b53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=2E=C3=87a=C4=9Flar=20Onur?= Date: Wed, 12 Oct 2005 15:27:49 +0000 Subject: [PATCH] fix #587 --- pisi/install.py | 3 +++ pisi/util.py | 43 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+) diff --git a/pisi/install.py b/pisi/install.py index d0d73e42..34e6fa2a 100644 --- a/pisi/install.py +++ b/pisi/install.py @@ -68,6 +68,9 @@ class Installer: import pisi.comariface as comariface comariface.run_postinstall(self.pkginfo.name) self.update_databases() + ctx.ui.info("Regenerating /etc/ld.so.cache...") + util.env_update() + def check_requirements(self): """check system requirements""" diff --git a/pisi/util.py b/pisi/util.py index b819db0f..c71f1add 100644 --- a/pisi/util.py +++ b/pisi/util.py @@ -19,6 +19,7 @@ # standard python modules import os +import re import sys import sha import shutil @@ -446,3 +447,45 @@ def clean_locks(top = '.'): def package_name(name, version, release): return name + '-' + version + '-' + release + ctx.const.package_prefix + +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 + + # generate profile.env + 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() + + # generate ld.co.conf + f = open("/etc/ld.so.conf", "w") + for path in keys["LDPATH"].split(":"): + f.write("%s\n" % path) + f.close() + + # run ldconfig + run_batch("/sbin/ldconfig -X -r /")