Add replace attribute to Path:
A new build which sets 'replace' for a config file will overwrite the file installed on the system regardless of its status: <Path fileType="config" replace="true">/etc/hede.conf</Path> Tested on a simple install/reinstall, works well. Should test further with delta updates before applying.
This commit is contained in:
@@ -117,6 +117,7 @@ suck anyway -->
|
||||
(executable|library|data|config|doc|man|info|localedata|header)
|
||||
#REQUIRED>
|
||||
<!ATTLIST Path permanent (false|true) #IMPLIED>
|
||||
<!ATTLIST Path replace (false|true) #IMPLIED>
|
||||
|
||||
|
||||
<!-- History Section -->
|
||||
|
||||
@@ -1521,6 +1521,14 @@
|
||||
</choice>
|
||||
</attribute>
|
||||
</optional>
|
||||
<optional>
|
||||
<attribute name="replace">
|
||||
<choice>
|
||||
<value>false</value>
|
||||
<value>true</value>
|
||||
</choice>
|
||||
</attribute>
|
||||
</optional>
|
||||
</group>
|
||||
</define>
|
||||
|
||||
|
||||
@@ -390,8 +390,8 @@ class Install(AtomicOperation):
|
||||
Remove.remove_file(old_fileinfo[path], self.pkginfo.name)
|
||||
|
||||
if self.reinstall():
|
||||
# get 'config' typed file objects
|
||||
new = filter(lambda x: x.type == 'config', self.files.list)
|
||||
# get 'config' typed file objects if replace is not set
|
||||
new = filter(lambda x: x.type == 'config' and not x.replace, self.files.list)
|
||||
old = filter(lambda x: x.type == 'config', self.old_files.list)
|
||||
|
||||
# get config path lists
|
||||
|
||||
@@ -29,6 +29,7 @@ class FileInfo:
|
||||
t_Mode = [ autoxml.String, autoxml.optional ]
|
||||
t_Hash = [ autoxml.String, autoxml.optional, "SHA1Sum" ]
|
||||
t_Permanent = [ autoxml.String, autoxml.optional ]
|
||||
t_Replace = [ autoxml.String, autoxml.optional ]
|
||||
|
||||
def __str__(self):
|
||||
s = "/%s, type: %s, size: %s, sha1sum: %s" % (self.path, self.type,
|
||||
|
||||
@@ -127,6 +127,7 @@ class Path:
|
||||
s_Path = [autoxml.String, autoxml.mandatory]
|
||||
a_fileType = [autoxml.String, autoxml.optional]
|
||||
a_permanent = [autoxml.String, autoxml.optional]
|
||||
a_replace = [autoxml.String, autoxml.optional]
|
||||
|
||||
def __str__(self):
|
||||
s = self.path
|
||||
|
||||
Reference in New Issue
Block a user