2022-07-27 22:45:40 -04:00
|
|
|
#!/usr/bin/bash
|
|
|
|
|
2024-11-28 14:11:19 -05:00
|
|
|
root=$(readlink root)
|
2022-07-27 22:45:40 -04:00
|
|
|
|
|
|
|
all_files() {
|
2024-12-11 10:32:28 -05:00
|
|
|
find "$root" -type f,l
|
2022-07-27 22:45:40 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
for f in $(all_files)
|
|
|
|
do
|
2022-12-27 22:02:48 -05:00
|
|
|
install_path="${f#"$root"}"
|
|
|
|
mkdir -p "$(dirname "$install_path")"
|
|
|
|
|
|
|
|
# Sometimes it is simpler to just link instead of copy
|
|
|
|
# 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
|
2022-07-27 22:45:40 -04:00
|
|
|
done
|
|
|
|
|
|
|
|
# vim: set filetype=bash:
|