Index: /SConstruct
===================================================================
--- /SConstruct	(revision 276)
+++ /SConstruct	(revision 277)
@@ -9,4 +9,5 @@
 libtalloc_path='.export/win32/libtalloc/'
 
+latest_release='1.0.1'
 source_targets=('src-trunk', 'src-0.99.0', 'src-1.0.0', 'src-1.0.1')
 win32_targets=('win32-trunk', 'win32-0.99.0', 'win32-1.0.0', 'win32-1.0.1')
@@ -41,5 +42,5 @@
 svn info svn+ssh://%(user)s@sentinelchicken.org/home/projects/subversion/reglookup\
   | grep "Last Changed Rev:" | cut -d' ' -f 4 \
-  | sed 's/^/REGFI_VERSION="svn-/' | sed 's/$/"/' > .export/%(path)s/regfi_version.py
+  | sed 's/^/REGFI_VERSION="%(latest_release)s./' | sed 's/$/"/' > .export/%(path)s/regfi_version.py
 '''
 
@@ -168,5 +169,6 @@
     params = {'user':os.environ['USER'], 
               'path':version2input(version), 
-              'version':version}
+              'version':version,
+              'latest_release':latest_release}
     env.Execute(export_cmds % params)
     if version == 'trunk':
Index: /trunk/SConstruct
===================================================================
--- /trunk/SConstruct	(revision 276)
+++ /trunk/SConstruct	(revision 277)
@@ -24,5 +24,6 @@
 # Libraries
 libregfi_static = env.Library(lib_src)
-libregfi = env.SharedLibrary(lib_src, LIBS=['m','pthread', 'talloc'])
+libregfi = env.SharedLibrary(lib_src, LIBS=['m','pthread', 'talloc'], 
+                             LINKFLAGS="-shared -fPIC -Wl,-soname,libregfi.so.%s" % REGFI_VERSION)
 
 
@@ -46,19 +47,24 @@
 
 # Installation
-prefix='/usr/local/'
-if 'PREFIX' in os.environ:
-   prefix = os.environ['PREFIX']+'/'
+prefix     = os.environ.get('PREFIX','/usr/local')+'/'
+destdir    = os.environ.get('DESTDIR','')
+bindir     = os.environ.get('BINDIR', prefix + 'bin')
+libdir     = os.environ.get('LIBDIR', prefix + 'lib')
+includedir = os.environ.get('INCLUDEDIR', prefix + 'include')
+mandir     = os.environ.get('MANDIR', prefix + 'man')
 
-install_items = [prefix+'bin',
-                 prefix+'lib', 
-                 prefix+'include/regfi',
-                 prefix+'man']
+install_items = [destdir + bindir,
+                 destdir + libdir,
+                 destdir + includedir + '/regfi',
+                 destdir + mandir]
 
-env.Install(prefix+'bin', [reglookup, reglookup_recover, 'bin/reglookup-timeline'])
-libinstall = env.Install(prefix+'lib', [libregfi, libregfi_static])
-env.Install(prefix+'include/regfi', Glob('include/*.h'))
-env.Install(prefix+'man/man1', [man_reglookup, man_reglookup_recover,
-                                man_reglookup_timeline])
-env.AddPostAction(libinstall, 'ldconfig')
+
+env.Install(destdir+bindir, [reglookup, reglookup_recover, 'bin/reglookup-timeline'])
+libinstall = env.Install(destdir+libdir, [libregfi, libregfi_static])
+env.Install(destdir+includedir+'/regfi', Glob('include/*.h'))
+env.Install(destdir+mandir+'/man1', [man_reglookup, man_reglookup_recover,
+                                     man_reglookup_timeline])
+if os.getuid() == 0:
+   env.AddPostAction(libinstall, 'ldconfig')
 
 if sys.version_info[0] == 2:
@@ -67,5 +73,5 @@
                                         'python/pyregfi/structures.py', 
                                         'python/pyregfi/winsec.py'],
-               "python pyregfi-distutils.py install | tee pyregfi2-install.log")
+               "python pyregfi-distutils.py install --root=%s | tee pyregfi2-install.log" % destdir)
 
 python_path = os.popen('which python3').read()
@@ -75,5 +81,5 @@
                                         'python/pyregfi/structures.py', 
                                         'python/pyregfi/winsec.py'], 
-               "python3 pyregfi-distutils.py install | tee pyregfi3-install.log")
+               "python3 pyregfi-distutils.py install --root=%s | tee pyregfi3-install.log" % destdir)
 
 # API documentation
Index: /trunk/pyregfi-distutils.py
===================================================================
--- /trunk/pyregfi-distutils.py	(revision 276)
+++ /trunk/pyregfi-distutils.py	(revision 277)
@@ -1,4 +1,8 @@
 # Called from scons with appropriate python version
+import sys
+from distutils.core import setup
+sys.dont_write_bytecode = True
+from regfi_version import REGFI_VERSION
+sys.dont_write_bytecode = False
 
-from distutils.core import setup
-setup(name='pyregfi', version='1.0', package_dir={'':'python'}, packages=['pyregfi'])
+setup(name='pyregfi', version=REGFI_VERSION, package_dir={'':'python'}, packages=['pyregfi'])
Index: /trunk/regfi_version.py
===================================================================
--- /trunk/regfi_version.py	(revision 276)
+++ /trunk/regfi_version.py	(revision 277)
@@ -1,2 +1,2 @@
 SVN_REV = "$Rev$"
-REGFI_VERSION = "svn-%s" % SVN_REV.split(' ')[1]
+REGFI_VERSION = "99.99.99.%s" % SVN_REV.split(' ')[1]
