Commit 143a5c73 authored by T C's avatar T C
Browse files

symlinks in add_file: Use mode from argument, fix link creation

parent 21c32fd3
Pipeline #40413 failed with stage
in 14 seconds
......@@ -591,10 +591,12 @@ add_symlink() {
if [[ -z "$target" || "$name" == "$target" ]]; then
target="$(find "$name" -prune -printf '%l')"
if [[ -z $target ]]; then
error 'invalid symlink: %s' "$name"
return 1
fi
elif [[ -L "$target" ]]; then
target="$(realpath -eq -- "$target")"
fi
if [[ -z "$target" ]]; then
error 'invalid symlink: %s' "$name"
return 1
fi
add_dir "${name%/*}"
......@@ -641,11 +643,11 @@ add_file() {
if [[ -L "$src" ]]; then
# add the file
srcrealpath="$(realpath -- "$src")"
mode="$(stat -c %a -- "$srcrealpath")"
mode="${3:-$(stat -c %a -- "$srcrealpath")}"
add_file "$srcrealpath" "$srcrealpath" "$mode"
[[ -d "${BUILDROOT}${dest%/*}" ]] || install -d -- "${BUILDROOT}${dest%/*}"
# create the symlink
add_symlink "$src" "$dest"
add_symlink "$dest" "$src"
else
command install -Dm$mode "$src" "$BUILDROOT$dest"
fi
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment