summaryrefslogtreecommitdiff
path: root/ucf
diff options
context:
space:
mode:
authorManoj Srivastava <srivasta@debian.org>2020-05-20 22:51:43 -0700
committerManoj Srivastava <srivasta@debian.org>2020-05-20 22:51:43 -0700
commitbcc6ff48c49dcbc1b9156a414bf37ffe7d77ae3d (patch)
tree345557f5571bebe6a33f349c4e5042725ba397de /ucf
parent1d1b5e2744d895c1198716a9fab819b281b3a758 (diff)
bug(perm): ucf set permissions if destination file does not exist
while ucf should not alter the attributes of the file if the destination exists (the maintainer can do anythjing she wants after ucf is done), when there is no destination copy the permissions from the source. Signed-off-by: Manoj Srivastava <srivasta@debian.org>
Diffstat (limited to 'ucf')
-rwxr-xr-xucf9
1 files changed, 7 insertions, 2 deletions
diff --git a/ucf b/ucf
index a6d0893..e78047b 100755
--- a/ucf
+++ b/ucf
@@ -303,8 +303,13 @@ replace_conf_file () {
$action cp -pf $selinux "${real_file}" "${real_file}.${OLD_SUFFIX}"
fi
fi
- # Do not change the permissions and attributes of the destination
- $action cp -f $selinux "$new_file" "${real_file}"
+ if [ -e "${real_file}" ]; then
+ # Do not change the permissions and attributes of the destination
+ $action cp -f $selinux "$new_file" "${real_file}"
+ else
+ # No destination file exists
+ $action cp -pf $selinux "$new_file" "${real_file}"
+ fi
replace_md5sum;
}