* simplify a bit
* fix: do not create a ".new" file if an existing config file is the same while installing (hersey ismail icin)
This commit is contained in:
@@ -300,9 +300,7 @@ class Install(AtomicOperation):
|
||||
if os.path.exists(fpath + '.old'):
|
||||
os.unlink(fpath + '.old')
|
||||
os.rename(fpath, fpath + '.old')
|
||||
else:
|
||||
# old config file not changed, overwrite
|
||||
pass
|
||||
# otherwise, old config file not changed, overwrite
|
||||
except pisi.util.FileError, e:
|
||||
pass
|
||||
else:
|
||||
@@ -310,10 +308,14 @@ class Install(AtomicOperation):
|
||||
if file.type == 'config':
|
||||
fpath = pisi.util.join_path(ctx.config.dest_dir(), file.path)
|
||||
if os.path.exists(fpath): # there is an old config file lying around
|
||||
config_changed.append(fpath)
|
||||
if os.path.exists(fpath + '.old'):
|
||||
os.unlink(fpath + '.old')
|
||||
os.rename(fpath, fpath + '.old')
|
||||
try:
|
||||
if pisi.util.sha1_file(fpath) != file.hash:
|
||||
config_changed.append(fpath)
|
||||
if os.path.exists(fpath + '.old'):
|
||||
os.unlink(fpath + '.old')
|
||||
os.rename(fpath, fpath + '.old')
|
||||
except pisi.util.FileError, e:
|
||||
pass
|
||||
|
||||
self.package.extract_install(ctx.config.dest_dir())
|
||||
|
||||
|
||||
Reference in New Issue
Block a user