home · contact · privacy
Update Firefox.
[config] / all_new_2018 / setup_scripts / hardlink_etc.sh
1 #!/bin/sh
2 # Hard link files to those in argument-selected subdirectories of
3 # linkable_etc_files//, e.g. link /etc/foo/bar to
4 # linkable_etc_files/$1/etc/foo/bar and so on. Create directories as
5 # necessary. We do the hard linking so files that should be readable to
6 # non-root in /etc/ remain so despite having a path below /root/, as
7 # symbolic links point into /root/ without making the targets readable
8 # to non-root.
9 # CAUTION: This removes original files at the affected paths.
10 set -e
11
12 config_tree_prefix="${HOME}/config/all_new_2018"
13 linkable_files_dir="${config_tree_prefix}/linkable_etc_files"
14
15 for target in "$@"; do
16     cd "${linkable_files_dir}/${target}"
17     for path in $(find . -type f); do
18         linking=$(echo "${path}" | cut -c2-)
19         linked=$(realpath "${path}")
20         dir=$(dirname "${linking}")
21         mkdir -p "${dir}"
22         ln -f "${linked}" "${linking}"
23     done
24 done