Copy symlinks instead of contents
This commit is contained in:
parent
1b79c31f26
commit
adc1f3ce61
21
install.sh
21
install.sh
@ -3,16 +3,25 @@
|
|||||||
root="root"
|
root="root"
|
||||||
|
|
||||||
all_files() {
|
all_files() {
|
||||||
find $root -type f,l
|
find $root -type f,l
|
||||||
}
|
}
|
||||||
|
|
||||||
for f in $(all_files)
|
for f in $(all_files)
|
||||||
do
|
do
|
||||||
install_path="${f#"$root"}"
|
install_path="${f#"$root"}"
|
||||||
mkdir -p "$(dirname "$install_path")"
|
mkdir -p "$(dirname "$install_path")"
|
||||||
# ln -snf "$PWD/$f" "$install_path"
|
|
||||||
read -ra perm_options < <(stat -c '-m %a -g %g -o %u' "$PWD/$f")
|
# Sometimes it is simpler to just link instead of copy
|
||||||
install -C "${perm_options[@]}" "$PWD/$f" "$install_path"
|
# ln -snf "$PWD/$f" "$install_path"
|
||||||
|
|
||||||
|
# install -C only copies if destination has changed.
|
||||||
|
# However for symlinks, it always copies and it copies the *contents* and not the symlinks.
|
||||||
|
if [[ -L "$PWD/$f" ]]; then
|
||||||
|
cp -P "$PWD/$f" "$install_path"
|
||||||
|
else
|
||||||
|
read -ra perm_options < <(stat -c '-m %a -g %g -o %u' "$PWD/$f")
|
||||||
|
install -C "${perm_options[@]}" "$PWD/$f" "$install_path"
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
# vim: set filetype=bash:
|
# vim: set filetype=bash:
|
||||||
|
Loading…
Reference in New Issue
Block a user