home · contact · privacy
Improve new setup.
authorChristian Heller <c.heller@plomlompom.de>
Wed, 14 Nov 2018 17:48:26 +0000 (18:48 +0100)
committerChristian Heller <c.heller@plomlompom.de>
Wed, 14 Nov 2018 17:48:26 +0000 (18:48 +0100)
all_new_2018/apt-mark/all [new file with mode: 0644]
all_new_2018/apt-mark/server [new file with mode: 0644]
all_new_2018/install_for_target.sh [new file with mode: 0755]
all_new_2018/limit_packages/purge_nonrequireds.sh [deleted file]
all_new_2018/limit_packages/required_nonrequireds [deleted file]
all_new_2018/purge_nonrequireds.sh [new file with mode: 0755]
all_new_2018/symlink_etc.sh

diff --git a/all_new_2018/apt-mark/all b/all_new_2018/apt-mark/all
new file mode 100644 (file)
index 0000000..f9caab8
--- /dev/null
@@ -0,0 +1,8 @@
+# connectivity
+ifupdown
+isc-dhcp-client
+# git
+ca-certificates
+git
+# to avoid constant warnings about no locale being found 
+locales
diff --git a/all_new_2018/apt-mark/server b/all_new_2018/apt-mark/server
new file mode 100644 (file)
index 0000000..3994b43
--- /dev/null
@@ -0,0 +1,4 @@
+# connectivity
+openssh-server
+# provides /etc/inputrc and understanding of ctrl+arrow key combos
+readline-common
diff --git a/all_new_2018/install_for_target.sh b/all_new_2018/install_for_target.sh
new file mode 100755 (executable)
index 0000000..9d2e1a6
--- /dev/null
@@ -0,0 +1,15 @@
+#!/bin/sh
+# Walks through the package names in the argument-selected files of
+# apt-mark/ and ensures the respective packages are installed.
+set -e
+
+config_tree_prefix="${HOME}/config/all_new_2018/apt-mark/"
+
+for target in "$@"; do
+    path="${config_tree_prefix}${target}"
+    for line in $(cat "${path}"); do
+        if [ ! $(echo "${line}" | cut -c1) = "#" ]; then
+            apt-get -y install "${line}"
+        fi
+    done
+done
diff --git a/all_new_2018/limit_packages/purge_nonrequireds.sh b/all_new_2018/limit_packages/purge_nonrequireds.sh
deleted file mode 100755 (executable)
index 36b6f38..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-#!/bin/sh
-# This script removes all Debian packages that are not of Priority
-# "required" or not depended on by packages of priority "required"
-# or not listed in the file ./required_nonrequireds.
-# If ./required_nonrequireds does not exist, will abort, as user
-# probably does not know what they are doing then.
-set -x
-set -e
-
-dpkg-query -Wf '${Package} ${Priority}\n' | grep ' required' | sed 's/ required//' > /tmp/list_white_unsorted
-cat 'required_nonrequireds' >> /tmp/list_white_unsorted
-sort /tmp/list_white_unsorted > /tmp/list_white
-dpkg-query -Wf '${Package}\n' > /tmp/list_all_packages
-sort /tmp/list_all_packages > /tmp/foo
-mv /tmp/foo /tmp/list_all_packages
-comm -3 /tmp/list_all_packages /tmp/list_white > /tmp/list_black
-apt-mark auto `cat /tmp/list_black`
-DEBIAN_FRONTEND=noninteractive apt-get -y --purge autoremove
-rm /tmp/list_all_packages /tmp/list_white_unsorted /tmp/list_white /tmp/list_black
diff --git a/all_new_2018/limit_packages/required_nonrequireds b/all_new_2018/limit_packages/required_nonrequireds
deleted file mode 100644 (file)
index dca4024..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-ifupdown
-isc-dhcp-client
-openssh-server
diff --git a/all_new_2018/purge_nonrequireds.sh b/all_new_2018/purge_nonrequireds.sh
new file mode 100755 (executable)
index 0000000..34692da
--- /dev/null
@@ -0,0 +1,25 @@
+#!/bin/sh
+# This script removes all Debian packages that are not of Priority
+# "required" or not depended on by packages of priority "required"
+# or not listed in the argument-selected files of apt-mark/.
+set -e
+
+config_tree_prefix="${HOME}/config/all_new_2018/apt-mark/"
+
+dpkg-query -Wf '${Package} ${Priority}\n' | grep ' required' | sed 's/ required//' > /tmp/list_white_unsorted
+for target in "$@"; do
+    path="${config_tree_prefix}${target}"
+    for line in $(cat "${path}"); do
+        if [ ! $(echo "${line}" | cut -c1) = "#" ]; then
+            echo "${line}" >> /tmp/list_white_unsorted
+        fi
+    done
+done
+sort /tmp/list_white_unsorted > /tmp/list_white
+dpkg-query -Wf '${Package}\n' > /tmp/list_all_packages
+sort /tmp/list_all_packages > /tmp/foo
+mv /tmp/foo /tmp/list_all_packages
+comm -3 /tmp/list_all_packages /tmp/list_white > /tmp/list_black
+apt-mark auto `cat /tmp/list_black`
+DEBIAN_FRONTEND=noninteractive apt-get -y --purge autoremove
+rm /tmp/list_all_packages /tmp/list_white_unsorted /tmp/list_white /tmp/list_black
index edee563182d1d02fa3b320bb5bca4dd4e0a0fec8..dd78fdfd89368bace33722a292ab0901b711b5db 100755 (executable)
@@ -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