home · contact · privacy
Add new Buster setup (or at least beginnings of it).
[config] / buster / setup_scripts / copy_etc.sh
1 #!/bin/sh
2 # Copy files to those in argument-selected subdirectories of
3 # linkable_etc_files//, e.g. copy /etc/foo/bar to
4 # linkable_etc_files/$1/etc/foo/bar and so on. Create directories as
5 # necessary.
6 #
7 # CAUTION: This removes original files at the affected paths.
8 set -e
9
10 config_tree_prefix="${HOME}/config/buster"
11 etc_files_dir="${config_tree_prefix}/etc_files"
12
13 for target in "$@"; do
14     cd "${etc_files_dir}/${target}"
15     for path in $(find . -type f); do
16         target=$(echo "${path}" | cut -c2-)
17         source=$(realpath "${path}")
18         dir=$(dirname "${target}")
19         mkdir -p "${dir}"
20         cp "${source}" "${target}"
21     done
22 done