diff options
author | Antoine Jacoutot <ajacoutot@cvs.openbsd.org> | 2018-10-28 09:00:08 +0000 |
---|---|---|
committer | Antoine Jacoutot <ajacoutot@cvs.openbsd.org> | 2018-10-28 09:00:08 +0000 |
commit | 047ff97e07d822c11fee54c4d437a54dd399be83 (patch) | |
tree | c10bf43906fedb8605017ec81d95c10d319669eb /usr.sbin | |
parent | 5d3db5a15f24ad0f471e02b821ddabf7f71b0b74 (diff) |
Properly handle symlinks.
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/syspatch/syspatch.sh | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/usr.sbin/syspatch/syspatch.sh b/usr.sbin/syspatch/syspatch.sh index 25d14f92330..7ad55ed1265 100644 --- a/usr.sbin/syspatch/syspatch.sh +++ b/usr.sbin/syspatch/syspatch.sh @@ -1,6 +1,6 @@ #!/bin/ksh # -# $OpenBSD: syspatch.sh,v 1.138 2018/10/16 07:09:13 ajacoutot Exp $ +# $OpenBSD: syspatch.sh,v 1.139 2018/10/28 09:00:07 ajacoutot Exp $ # # Copyright (c) 2016, 2017 Antoine Jacoutot <ajacoutot@openbsd.org> # @@ -137,13 +137,17 @@ fetch_and_verify() install_file() { - # XXX handle hard and symbolic links, dir->file, file->dir? + # XXX handle hard link, dir->file, file->dir? local _dst=$2 _fgrp _fmode _fown _src=$1 [[ -f ${_src} && -f ${_dst} ]] - eval $(stat -f "_fmode=%OMp%OLp _fown=%Su _fgrp=%Sg" ${_src}) - - install -DFSp -m ${_fmode} -o ${_fown} -g ${_fgrp} ${_src} ${_dst} + if [[ -h ${_src} ]]; then + ln -sf $(readlink ${_src}) ${_dst} + else + eval $(stat -f "_fmode=%OMp%OLp _fown=%Su _fgrp=%Sg" ${_src}) + install -DFSp -m ${_fmode} -o ${_fown} -g ${_fgrp} ${_src} \ + ${_dst} + fi } ls_installed() |