home · contact · privacy
Generalize copy_etc.sh.
authorChristian Heller <c.heller@plomlompom.de>
Fri, 5 Apr 2019 20:38:37 +0000 (22:38 +0200)
committerChristian Heller <c.heller@plomlompom.de>
Fri, 5 Apr 2019 20:38:37 +0000 (22:38 +0200)
buster/apt-mark/eeepc
buster/setup_scripts/copy_dirtree.sh [new file with mode: 0755]
buster/setup_scripts/copy_etc.sh [deleted file]
buster/setup_scripts/setup.sh
buster/setup_scripts/setup_eeepc.sh

index d6e3a409321ce12ec85bf5fad1ad61fa0dcb1b3f..e04ae31e4085d140ad0f90265b878540db493195 100644 (file)
@@ -24,4 +24,8 @@ redshift
 alsa-utils
 # browser
 firefox-esr
+# also useful
+less
+man-db
+manpages
 
diff --git a/buster/setup_scripts/copy_dirtree.sh b/buster/setup_scripts/copy_dirtree.sh
new file mode 100755 (executable)
index 0000000..ff4d5b4
--- /dev/null
@@ -0,0 +1,32 @@
+#!/bin/sh
+# Copy files in argument-selected subdirectories of $1 to subdirectories
+# of $2 (which may be an empty string), e.g. with $1 of "etc_files", $2
+# of "" and $3 of "all", copy files below etc_files/all such as
+# etc_files/all/etc/foo/bar to equivalent locations below / such as
+# /etc/foo/bar. Create directories as necessary. Multiple arguments after
+# $3 are possible.
+#
+# CAUTION: This removes original files at the affected paths.
+set -e
+
+if [ "$#" -lt 3 ]; then
+    echo 'Need arguments: source root, target root, modules.'
+    false
+fi
+source_root="$1"
+target_root="$2"
+shift 2
+
+config_tree_prefix="${HOME}/config/buster"
+etc_files_dir="${config_tree_prefix}/etc_files"
+
+for target_module in "$@"; do
+    cd "${source_root}/${target_module}"
+    for path in $(find . -type f); do
+        target_path="${target_root}"$(echo "${path}" | cut -c2-)
+        source_path=$(realpath "${path}")
+        dir=$(dirname "${target_path}")
+        mkdir -p "${dir}"
+        cp "${source_path}" "${target_path}"
+    done
+done
diff --git a/buster/setup_scripts/copy_etc.sh b/buster/setup_scripts/copy_etc.sh
deleted file mode 100755 (executable)
index db07e4c..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-#!/bin/sh
-# Copy files to those in argument-selected subdirectories of
-# linkable_etc_files//, e.g. copy /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
-
-config_tree_prefix="${HOME}/config/buster"
-etc_files_dir="${config_tree_prefix}/etc_files"
-
-for target in "$@"; do
-    cd "${etc_files_dir}/${target}"
-    for path in $(find . -type f); do
-        target=$(echo "${path}" | cut -c2-)
-        source=$(realpath "${path}")
-        dir=$(dirname "${target}")
-        mkdir -p "${dir}"
-        cp "${source}" "${target}"
-    done
-done
index 93f30124947e09d34c9ab019845aee0f276374cc..792a80754fac5013e5c86af17f36738045523704 100755 (executable)
@@ -13,10 +13,10 @@ config_tree_prefix="${HOME}/config/buster"
 setup_scripts_dir="${config_tree_prefix}/setup_scripts"
 cd "${setup_scripts_dir}"
 
-# Adapt /etc/ to our needs by hardlinking into ./linkable_etc_files. This
-# will set basic configurations affecting following steps, such as setup
-# of APT and the locale selection, so needs to be right at the beginning.
-./copy_etc.sh all
+# Adapt /etc/ to our needs by copying from ./etc_files. This will set
+# basic configurations affecting following steps, such as setup of APT
+# and the locale selection, so needs to be right at the beginning.
+./copy_dirtree.sh "${config_tree_prefix}/etc_files" "" all
 
 # Set hostname and FQDN.
 ./set_hostname_and_fqdn.sh "${hostname}" "${fqdn}"
index 212c2c0357e88c3bedb54f37208c6fcf7c71dff2..7dcb351978d7f5c106563f7a16cf60f33c8769d2 100755 (executable)
@@ -11,5 +11,5 @@ config_tree_prefix="${HOME}/config/buster"
 setup_scripts_dir="${config_tree_prefix}/setup_scripts"
 cd "${setup_scripts_dir}"
 ./setup.sh "${hostname}" ""
-./copy_etc.sh eeepc
+./copy_dirtree.sh "${config_tree_prefix}/etc_files" "" eeepc
 ./install_for_target.sh eeepc