X-Git-Url: https://plomlompom.com/repos/?a=blobdiff_plain;f=all_new_2018%2Fsymlink_etc.sh;h=dd78fdfd89368bace33722a292ab0901b711b5db;hb=ad51c30997402b922e5ae76dc55e5f1e89593ad7;hp=edee563182d1d02fa3b320bb5bca4dd4e0a0fec8;hpb=ce883f56c6285d25f0dc50584e39dbebff7a77f9;p=config diff --git a/all_new_2018/symlink_etc.sh b/all_new_2018/symlink_etc.sh index edee563..dd78fdf 100755 --- a/all_new_2018/symlink_etc.sh +++ b/all_new_2018/symlink_etc.sh @@ -1,22 +1,18 @@ #!/bin/sh -# Symbolically link files to those under linkable_etc_files/$1/, e.g. -# link /etc/foo/bar to linkable_etc_files/$1/etc/foo/bar. Create -# directories as necessary. +# Symbolically link files to those in argument-selected subdirectories +# of linkable_etc_files//, e.g. link /etc/foo/bar to +# linkable_etc_files/$1/etc/foo/bar and so on. Create directories as +# necessary. # CAUTION: This removes original files at the affected paths. set -e -target="$1" -if [ ! "${target}" = "all" ] && [ ! "${target}" = "server" ]; then - echo "Need proper target." - false -fi - -config_tree_prefix="${HOME}/config/all_new_2018/linkable_etc_files/" -cd "${config_tree_prefix}""${target}" -for path in $(find . -type f); do - linking=$(echo "${path}" | cut -c2-) - linked=$(realpath "${path}") - dir=$(dirname "${linking}") - mkdir -p "${dir}" - ln -fs "${linked}" "${linking}" +for target in "$@"; do + cd "${config_tree_prefix}${target}" + for path in $(find . -type f); do + linking=$(echo "${path}" | cut -c2-) + linked=$(realpath "${path}") + dir=$(dirname "${linking}") + mkdir -p "${dir}" + ln -fs "${linked}" "${linking}" + done done