fix #587
This commit is contained in:
@@ -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"""
|
||||
|
||||
@@ -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 /")
|
||||
|
||||
Reference in New Issue
Block a user