* Symlink changes are special. Handle with care and Avril is so beautiful.
This commit is contained in:
@@ -260,14 +260,23 @@ class Install(AtomicOperation):
|
|||||||
|
|
||||||
config_changed = []
|
config_changed = []
|
||||||
def check_config_changed(config):
|
def check_config_changed(config):
|
||||||
|
changed = False
|
||||||
fpath = pisi.util.join_path(ctx.config.dest_dir(), config.path)
|
fpath = pisi.util.join_path(ctx.config.dest_dir(), config.path)
|
||||||
if os.path.exists(fpath) and not os.path.isdir(fpath):
|
if os.path.exists(fpath) and not os.path.isdir(fpath):
|
||||||
if pisi.util.sha1_file(fpath) != config.hash:
|
if os.path.islink(fpath):
|
||||||
config_changed.append(fpath)
|
file = os.readlink(fpath)
|
||||||
if os.path.exists(fpath + '.old'):
|
if os.path.exists(file) and pisi.util.sha1_data(file) != config.hash:
|
||||||
os.unlink(fpath + '.old')
|
changed = True
|
||||||
os.rename(fpath, fpath + '.old')
|
else:
|
||||||
|
if pisi.util.sha1_file(fpath) != config.hash:
|
||||||
|
changed = True
|
||||||
|
|
||||||
|
if changed:
|
||||||
|
config_changed.append(fpath)
|
||||||
|
if os.path.exists(fpath + '.old'):
|
||||||
|
os.unlink(fpath + '.old')
|
||||||
|
os.rename(fpath, fpath + '.old')
|
||||||
|
|
||||||
# old config files are kept as they are. New config files from the installed
|
# old config files are kept as they are. New config files from the installed
|
||||||
# packages are saved with ".newconfig" string appended to their names.
|
# packages are saved with ".newconfig" string appended to their names.
|
||||||
def rename_configs():
|
def rename_configs():
|
||||||
|
|||||||
Reference in New Issue
Block a user