--- /dev/null
+# connectivity: ifupdown seems necessary everyhwere, isc-dhcp-client unpredictably so
+ifupdown
+isc-dhcp-client
+# git for the setup directory; cloning works with ca-certificates
+ca-certificates
+git
+# to avoid constant warnings about no locale being found
+locales
+# extremely useful for basic network debugging; missed these more than once in an emergency
+netcat-traditional
+iputils-ping
+# to set the time
+ntpsec-ntpdate
+#
--- /dev/null
+# so we can log in at all …
+openssh-server
+# firewalling
+nftables
--- /dev/null
+# stuff we want on any system with interactive plom user account
+#
+# ping won't work for user without this – see <https://shallowsky.com/blog/linux/ping-permissions.html>
+linux-sysctl-defaults
+# generally useful
+ack
+vim
+sudo
+less
+man-db
+manpages
+procps
+# for syncing
+borgbackup
+# for my own scripts to run
+python3-venv
+#
--- /dev/null
+APT::AutoRemove::RecommendsImportant "false";
+APT::AutoRemove::SuggestsImportant "false";
+APT::Install-Recommends "false";
+APT::Install-Suggests "false";
--- /dev/null
+deb http://deb.debian.org/debian bookworm main contrib non-free non-free-firmware
+deb http://security.debian.org/debian-security bookworm-security main contrib non-free non-free-firmware
+deb http://deb.debian.org/debian bookworm-updates main contrib non-free non-free-firmware
+deb http://ftp.debian.org/debian bookworm-backports main contrib non-free non-free-firmware
--- /dev/null
+
+# This is the sshd server system-wide configuration file. See
+# sshd_config(5) for more information.
+
+# This sshd was compiled with PATH=/usr/local/bin:/usr/bin:/bin:/usr/games
+
+# The strategy used for options in the default sshd_config shipped with
+# OpenSSH is to specify options with their default value where
+# possible, but leave them commented. Uncommented options override the
+# default value.
+
+Include /etc/ssh/sshd_config.d/*.conf
+
+#Port 22
+#AddressFamily any
+#ListenAddress 0.0.0.0
+#ListenAddress ::
+
+#HostKey /etc/ssh/ssh_host_rsa_key
+#HostKey /etc/ssh/ssh_host_ecdsa_key
+#HostKey /etc/ssh/ssh_host_ed25519_key
+
+# Ciphers and keying
+#RekeyLimit default none
+
+# Logging
+#SyslogFacility AUTH
+#LogLevel INFO
+
+# Authentication:
+
+#LoginGraceTime 2m
+#PermitRootLogin prohibit-password
+PermitRootLogin no # plomlompom's security rule
+#StrictModes yes
+#MaxAuthTries 6
+#MaxSessions 10
+
+#PubkeyAuthentication yes
+
+# Expect .ssh/authorized_keys2 to be disregarded by default in future.
+#AuthorizedKeysFile .ssh/authorized_keys .ssh/authorized_keys2
+
+#AuthorizedPrincipalsFile none
+
+#AuthorizedKeysCommand none
+#AuthorizedKeysCommandUser nobody
+
+# For this to work you will also need host keys in /etc/ssh/ssh_known_hosts
+#HostbasedAuthentication no
+# Change to yes if you don't trust ~/.ssh/known_hosts for
+# HostbasedAuthentication
+#IgnoreUserKnownHosts no
+# Don't read the user's ~/.rhosts and ~/.shosts files
+#IgnoreRhosts yes
+
+# To disable tunneled clear text passwords, change to no here!
+PasswordAuthentication no
+#PermitEmptyPasswords no
+
+# Change to yes to enable challenge-response passwords (beware issues with
+# some PAM modules and threads)
+KbdInteractiveAuthentication no
+
+# Kerberos options
+#KerberosAuthentication no
+#KerberosOrLocalPasswd yes
+#KerberosTicketCleanup yes
+#KerberosGetAFSToken no
+
+# GSSAPI options
+#GSSAPIAuthentication no
+#GSSAPICleanupCredentials yes
+#GSSAPIStrictAcceptorCheck yes
+#GSSAPIKeyExchange no
+
+# Set this to 'yes' to enable PAM authentication, account processing,
+# and session processing. If this is enabled, PAM authentication will
+# be allowed through the KbdInteractiveAuthentication and
+# PasswordAuthentication. Depending on your PAM configuration,
+# PAM authentication via KbdInteractiveAuthentication may bypass
+# the setting of "PermitRootLogin prohibit-password".
+# If you just want the PAM account and session checks to run without
+# PAM authentication, then enable this but set PasswordAuthentication
+# and KbdInteractiveAuthentication to 'no'.
+UsePAM yes
+
+#AllowAgentForwarding yes
+#AllowTcpForwarding yes
+#GatewayPorts no
+X11Forwarding yes
+#X11DisplayOffset 10
+#X11UseLocalhost yes
+#PermitTTY yes
+PrintMotd no
+#PrintLastLog yes
+#TCPKeepAlive yes
+#PermitUserEnvironment no
+#Compression delayed
+ClientAliveInterval 15
+#ClientAliveCountMax 3
+#UseDNS no
+#PidFile /run/sshd.pid
+#MaxStartups 10:30:100
+#PermitTunnel no
+#ChrootDirectory none
+#VersionAddendum none
+
+# no default banner path
+#Banner none
+
+# Allow client to pass locale environment variables
+AcceptEnv LANG LC_*
+
+# override default of no subsystems
+Subsystem sftp /usr/lib/openssh/sftp-server
+
+# Example of overriding settings on a per-user basis
+#Match User anoncvs
+# X11Forwarding no
+# AllowTcpForwarding no
+# PermitTTY no
+# ForceCommand cvs server
--- /dev/null
+# ~/.bash_profile, if it exists, is sourced by Bash for all login shells,
+# instead of ~/.profile
+#
+# While I prefer using ~/.profile, I provide ~/.bash_profile because some
+# applications write to it even if it does not previously exist, which
+# deactivates ~/.profile if not explicitly sourced from within here.
+. "${HOME}/.profile"
+
--- /dev/null
+# ~/.bashrc is sourced by Bash for any interactive shells.
+
+# Use vim as default editor for anything.
+export VISUAL=vim
+export EDITOR="${VISUAL}"
+
+# Some helpful aliases.
+alias curlpost='curl -H "Content-Type: application/json" -X POST'
+alias ls="ls --color=auto"
+
+# Colored prompt with username, hostname, date/time, directory.
+COLOR_NUMBER=7 # default to white
+COLOR_NUMBER_FILE="${HOME}/.shell_prompt_color"
+[ -f "${COLOR_NUMBER_FILE}" ] && COLOR_NUMBER=`cat "${COLOR_NUMBER_FILE}"`
+tput_color="$(tput setaf "${COLOR_NUMBER}")$(tput bold)"
+tput_reset="$(tput sgr0)"
+# Bash confuses the line length when not told to not count escape sequences.
+if [ -n "${BASH}" ]; then
+ tput_color="\[$tput_color\]"
+ tput_reset="\[$tput_reset\]"
+fi
+PS1="${tput_color}["\$\(date\ +%Y-%m-%d/%H:%M:%S/%Z\)" $(whoami)@$(hostname):"\$\(pwd\)"]$ ${tput_reset}"
+PS2="${tput_color}> ${tput_reset}"
+PS3="${tput_color}select: ${tput_reset}"
+PS4="${tput_color}+ ${tput_reset}"
+
+# include others
+. "${HOME}/.plomlib.sh/file_dot_variants"
+file_dot_variants "${HOME}/\.bashrc"
--- /dev/null
+file_dot_variants() {
+ for FILE in ${1}\.*; do
+ if [ -f "${FILE}" ]; then
+ . "${FILE}"
+ fi
+ done
+}
--- /dev/null
+# ~/.profile is sourced on login, with its exports inherited by all processes
+# started below it under the same login, i.e. it has a very deep effect, but
+# changes to it only apply to new login sessions (compare to e.g. ~/.bashrc
+# which by is sourced anew for every new interactive Bash, login or not).
+#
+# Notably this makes ~/.profile (outside its optional sourcing of ~/.bashrc)
+# useful for providing environment variables to non-shell applications started
+# within a login session.
+PATH_BASHRC="${HOME}/.bashrc"
+[ -n "${BASH_VERSION}" -a -f "${PATH_BASHRC}" ] && . "${PATH_BASHRC}"
+
+PATH_LOCAL_BIN="${HOME}/.local/bin"
+[ -d "${PATH_LOCAL_BIN}" ] && PATH="${PATH_LOCAL_BIN}:${PATH}"
+
+# local changes to this shell variable otherwise will get lost
+export PATH
+
+# include others
+. "${HOME}/.plomlib.sh/file_dot_variants"
+file_dot_variants "${HOME}/\.profile"
#_preseed_V1
-d-i passwd/root-login boolean true
-user-setup-udeb passwd/make-user boolean false
+d-i debian-installer/load-cdrom/title
d-i netcfg/choose_interface select auto
d-i netcfg/link_wait_timeout string 3
-d-i netcfg/wireless_security_type wpa
-#d-i netcfg/wireless_wep string
-#d-i netcfg/disable_autoconfig boolean false
+#d-i netcfg/wireless_security_type wpa
d-i netcfg/use_autoconfig true
-d-i netcfg/wireless_essid kadatheron
+#d-i netcfg/wireless_essid kadatheron
d-i netcfg/get_hostname string unassigned-hostname
d-i netcfg/get_domain string unassigned-domain
+d-i passwd/root-login boolean true
+user-setup-udeb passwd/make-user boolean false
+
# d-i partman-auto/method string crypto
d-i partman-auto-lvm/guided_size string max
#d-i partman-auto/choose_recipe select atomic
# d-i pkgsel/run_tasksel boolean false
+d-i apt-setup/use-mirror true
d-i mirror/protocol string http
+d-i mirror/http/proxy
#d-i mirror/http/hostname string http.us.debian.org
+d-i apt-setup/enable-source-repositories true
d-i apt-setup/non-free-firmware boolean true
d-i apt-setup/non-free boolean true
d-i apt-setup/contrib boolean true
d-i apt-setup/services-select security, updates
# d-i grub-installer/only_debian boolean true
-grub-installer/enable_os_prober_otheros_no false
-grub-installer/force-efi-extra-removable false
+d-i grub-installer/force-efi-extra-removable false
+d-i grub-installer/update-nvram true
+d-i grub-installer/enable_os_prober_otheros_no false
clock-setup clock-setup/utc boolean true
d-i finish-install/reboot_in_progress note
--- /dev/null
+#!/bin/sh
+set -e
+cd $(dirname "$0")
+. lib/constants_server
+. lib/expect_min_n_args
+
+PATH_KNOWN_HOSTS="${PATH_SSH}/known_hosts"
+
+expect_min_n_args 1 '(server)' "$@"
+SERVER="$1"
+
+echo '\nKnow host.\n'
+set +e
+ssh-keygen -f "${PATH_KNOWN_HOSTS}" -R "${SERVER}"
+set -e
+ssh-keyscan "${SERVER}" >> "${PATH_KNOWN_HOSTS}"
+
+echo '\nAsking for new root password.\n'
+ssh "root@${SERVER}" 'printf "\n\n" && passwd'
+
+echo '\nSetting up config repo.'
+ssh "root@${SERVER}" 'apt update && apt install -y git && git clone https://plomlompom.com/repos/clone/config'
--- /dev/null
+PATH_REL_SSH=.ssh
+PATH_SSH="${HOME}/${PATH_REL_SSH}"
--- /dev/null
+copy_dirtree() {
+ expect_min_n_args 3 '(source root, target root, tags)' "$@"
+ SOURCE_ROOT="$1"
+ TARGET_ROOT="$2"
+ shift 2
+ TAGS="$@"
+ for TAG in ${TAGS}; do
+ PATH_TAG="${SOURCE_ROOT}/${TAG}"
+ if [ ! -d "${PATH_TAG}" ]; then
+ continue
+ fi
+ cd "${PATH_TAG}"
+ for PATH_REL in $(find . -type f,l); do
+ PATH_TARGET="${TARGET_ROOT}"$(echo "${PATH_REL}" | cut -c2-)
+ PATH_SOURCE=$(realpath "${PATH_REL}")
+ DIRECTORY=$(dirname "${PATH_TARGET}")
+ mkdir -p "${DIRECTORY}"
+ cp -L "${PATH_SOURCE}" "${PATH_TARGET}"
+ done
+ cd -
+ done
+}
--- /dev/null
+determine_ip() {
+ FINAL_IP="127.0.1.1"
+ for IP in $(hostname -I); do
+ if [ $(echo "${IP}" | grep ':' | wc -l) -eq 1 ]; then
+ continue
+ fi
+ RANGE_1=$(echo "${IP}" | cut -d "." -f 1)
+ RANGE_2=$(echo "${IP}" | cut -d "." -f 2)
+ if [ "${RANGE_1}" -eq 127 ]; then
+ continue
+ elif [ "${RANGE_1}" -eq 10 ]; then
+ continue
+ elif [ "${RANGE_1}" -eq 172 ]; then
+ if [ "${RANGE_2}" -ge 16 ] && [ "${RANGE_2}" -le 31 ]; then
+ continue
+ fi
+ elif [ "${RANGE_1}" -eq 192 ]; then
+ if [ "${RANGE_2}" -eq 168 ]; then
+ continue
+ fi
+ fi
+ FINAL_IP="${IP}"
+ done
+ printf "${FINAL_IP}"
+}
--- /dev/null
+install_aptmarkeds() {
+ # Walk through the package names in ../aptmark/ files to ensure the respective
+ # packages are installed.
+ for TAG in $@; do
+ PATH_APTMARK_TAG="${PATH_CONF}/aptmark/${TAG}"
+ if [ ! -f "${PATH_APTMARK_TAG}" ]; then
+ continue
+ fi
+ cat "${PATH_APTMARK_TAG}" | while read LINE; do
+ if [ ! $(echo "${LINE}" | cut -c1) = "#" ]; then
+ apt-get -y -o Dpkg::Options::="--force-confnew" install "${LINE}"
+ fi
+ done
+ done
+}
--- /dev/null
+mark_nonrequireds_auto() {
+ PATH_LIST_PREFIX=/tmp/list_
+ PATH_LIST_UNSORTED="${PATH_LIST_PREFIX}unsorted"
+ PATH_LIST_ALL_PACKAGES="${PATH_LIST_PREFIX}all_packages"
+ PATH_LIST_WHITE="${PATH_LIST_PREFIX}white"
+ PATH_LIST_BLACK="${PATH_LIST_PREFIX}black"
+ TOK_REQ=' required'
+ dpkg-query -Wf '${Package} ${Priority}\n' | grep "${TOK_REQ}" | sed "s/${TOK_REQ}//" > "${PATH_LIST_UNSORTED}"
+ sort "${PATH_LIST_UNSORTED}" | uniq > "${PATH_LIST_WHITE}"
+ dpkg-query -Wf '${Package}\n' > "${PATH_LIST_UNSORTED}"
+ sort "${PATH_LIST_UNSORTED}" | uniq > "${PATH_LIST_ALL_PACKAGES}"
+ comm -3 "${PATH_LIST_ALL_PACKAGES}" "${PATH_LIST_WHITE}" > "${PATH_LIST_BLACK}"
+ apt-mark auto `cat "${PATH_LIST_BLACK}"`
+ rm "${PATH_LIST_UNSORTED}" "${PATH_LIST_ALL_PACKAGES}" "${PATH_LIST_WHITE}" "${PATH_LIST_BLACK}"
+}
--- /dev/null
+#!/bin/sh
+set -e
+cd $(dirname "$0")
+. lib/constants_server # PATH_REL_SSH, PATH_SSH
+. lib/copy_dirtree
+. lib/determine_ip
+. lib/expect_min_n_args
+. lib/install_aptmarkeds
+. lib/mark_nonrequireds_auto
+
+MIN_TAGS='all server'
+
+expect_min_n_args 2 '(hostname, FQDN)' "$@"
+HOSTNAME="$1"
+FQDN="$2"
+
+USERNAME=plom
+PATH_USER_HOME="/home/${USERNAME}"
+PARENT_DIR="$(dirname $(pwd))"
+DEBIAN_RELEASE="$(basename ${PARENT_DIR})"
+PATH_REPO="$(dirname ${PARENT_DIR})"
+PATH_REL_ETC=etc
+PATH_CONF="${PATH_REPO}/${DEBIAN_RELEASE}"
+PATH_CONF_ETC="${PATH_CONF}/${PATH_REL_ETC}"
+PATH_CONF_HOME="${PATH_CONF}/home"
+PATH_USER_SSH="${PATH_USER_HOME}/${PATH_REL_SSH}"
+PATH_ETC="/${PATH_REL_ETC}"
+PATH_HOSTS="${PATH_ETC}/hosts"
+
+mark_nonrequireds_auto
+install_aptmarkeds ${MIN_TAGS}
+apt -y --purge autoremove
+apt -y dist-upgrade
+
+echo '\nSetting hostname and FQDN.'
+echo "${HOSTNAME}" > "${PATH_ETC}/hostname"
+hostname "${HOSTNAME}"
+echo '127.0.0.1 localhost.localdomain localhost' > "${PATH_HOSTS}"
+echo "$(determine_ip) ${FQDN} ${HOSTNAME}" >> "${PATH_HOSTS}"
+
+echo '\nAdapting /etc to our needs.'
+copy_dirtree "${PATH_CONF_ETC}" "${PATH_ETC}"${MIN_TAGS}
+echo '\nSetting Berlin localtime.'
+ln -sf /usr/share/zoneinfo/Europe/Berlin "${PATH_ETC}/localtime"
+ntpdate-debian
+
+# # Enable firewall.
+# systemctl enable nftables.service
+
+echo "\nSetting up root user's home directory."
+copy_dirtree "${PATH_CONF_HOME}" '/root' ${MIN_TAGS} root
+
+echo "\nSetting up user ${USERNAME}."
+adduser --disabled-password --gecos "" "${USERNAME}"
+usermod -a -G sudo "${USERNAME}"
+copy_dirtree "${PATH_CONF_HOME}" "${PATH_USER_HOME}" ${MIN_TAGS} user
+mkdir -p "${PATH_USER_SSH}"
+mv "${PATH_SSH}/authorized_keys" "${PATH_USER_SSH}/"
+chown -R "${USERNAME}:${USERNAME}" "${PATH_USER_HOME}"
+++ /dev/null
-# connectivity: ifupdown seems necessary everyhwere, isc-dhcp-client unpredictably so
-ifupdown
-isc-dhcp-client
-# git for the setup directory; cloning works with ca-certificates
-ca-certificates
-git
-# to avoid constant warnings about no locale being found
-locales
-# extremely useful for basic network debugging; missed these more than once in an emergency
-netcat-traditional
-iputils-ping
-# to set the time
-ntpsec-ntpdate
-#
--- /dev/null
+../../bookworm/aptmark/all
\ No newline at end of file
+++ /dev/null
-# stuff we want on any system with interactive plom user account
-#
-# ping won't work for user without this – see <https://shallowsky.com/blog/linux/ping-permissions.html>
-linux-sysctl-defaults
-# generally useful
-ack
-vim
-sudo
-less
-man-db
-manpages
-procps
-# for syncing
-borgbackup
-# for my own scripts to run
-python3-venv
-#
--- /dev/null
+../../bookworm/aptmark/user
\ No newline at end of file
+++ /dev/null
-APT::AutoRemove::RecommendsImportant "false";
-APT::AutoRemove::SuggestsImportant "false";
-APT::Install-Recommends "false";
-APT::Install-Suggests "false";
--- /dev/null
+../../../../../bookworm/etc/all/apt/apt.conf.d/99_minimize_dependencies
\ No newline at end of file
+++ /dev/null
-# ~/.bash_profile, if it exists, is sourced by Bash for all login shells,
-# instead of ~/.profile
-#
-# While I prefer using ~/.profile, I provide ~/.bash_profile because some
-# applications write to it even if it does not previously exist, which
-# deactivates ~/.profile if not explicitly sourced from within here.
-. "${HOME}/.profile"
-
--- /dev/null
+../../../bookworm/home/all/.bash_profile
\ No newline at end of file
+++ /dev/null
-# ~/.bashrc is sourced by Bash for any interactive shells.
-
-# Use vim as default editor for anything.
-export VISUAL=vim
-export EDITOR="${VISUAL}"
-
-# Some helpful aliases.
-alias curlpost='curl -H "Content-Type: application/json" -X POST'
-alias ls="ls --color=auto"
-
-# Colored prompt with username, hostname, date/time, directory.
-COLOR_NUMBER=7 # default to white
-COLOR_NUMBER_FILE="${HOME}/.shell_prompt_color"
-[ -f "${COLOR_NUMBER_FILE}" ] && COLOR_NUMBER=`cat "${COLOR_NUMBER_FILE}"`
-tput_color="$(tput setaf "${COLOR_NUMBER}")$(tput bold)"
-tput_reset="$(tput sgr0)"
-# Bash confuses the line length when not told to not count escape sequences.
-if [ -n "${BASH}" ]; then
- tput_color="\[$tput_color\]"
- tput_reset="\[$tput_reset\]"
-fi
-PS1="${tput_color}["\$\(date\ +%Y-%m-%d/%H:%M:%S/%Z\)" $(whoami)@$(hostname):"\$\(pwd\)"]$ ${tput_reset}"
-PS2="${tput_color}> ${tput_reset}"
-PS3="${tput_color}select: ${tput_reset}"
-PS4="${tput_color}+ ${tput_reset}"
-
-# include others
-. "${HOME}/.plomlib.sh/file_dot_variants"
-file_dot_variants "${HOME}/\.bashrc"
--- /dev/null
+../../../bookworm/home/all/.bashrc
\ No newline at end of file
+++ /dev/null
-file_dot_variants() {
- for FILE in ${1}\.*; do
- if [ -f "${FILE}" ]; then
- . "${FILE}"
- fi
- done
-}
--- /dev/null
+../../../../bookworm/home/all/.plomlib.sh/file_dot_variants
\ No newline at end of file
+++ /dev/null
-# ~/.profile is sourced on login, with its exports inherited by all processes
-# started below it under the same login, i.e. it has a very deep effect, but
-# changes to it only apply to new login sessions (compare to e.g. ~/.bashrc
-# which by is sourced anew for every new interactive Bash, login or not).
-#
-# Notably this makes ~/.profile (outside its optional sourcing of ~/.bashrc)
-# useful for providing environment variables to non-shell applications started
-# within a login session.
-PATH_BASHRC="${HOME}/.bashrc"
-[ -n "${BASH_VERSION}" -a -f "${PATH_BASHRC}" ] && . "${PATH_BASHRC}"
-
-PATH_LOCAL_BIN="${HOME}/.local/bin"
-[ -d "${PATH_LOCAL_BIN}" ] && PATH="${PATH_LOCAL_BIN}:${PATH}"
-
-# local changes to this shell variable otherwise will get lost
-export PATH
-
-# include others
-. "${HOME}/.plomlib.sh/file_dot_variants"
-file_dot_variants "${HOME}/\.profile"
--- /dev/null
+../../../bookworm/home/all/.profile
\ No newline at end of file
--- /dev/null
+../../../bookworm/home/root/.shell_prompt_color
\ No newline at end of file
--- /dev/null
+../../../bookworm/scripts/lib/copy_dirtree
\ No newline at end of file
--- /dev/null
+../../../bookworm/scripts/lib/determine_ip
\ No newline at end of file
--- /dev/null
+../../../bookworm/scripts/lib/install_aptmarkeds
\ No newline at end of file
--- /dev/null
+../../../bookworm/scripts/lib/mark_nonrequireds_auto
\ No newline at end of file
#!/bin/sh
set -e
cd $(dirname "$0")
-. lib/constants # PATH_USER_HOME, USERNAME
-. lib/expect_min_n_args
. lib/abort
. lib/abort_if_offline
+. lib/constants # PATH_USER_HOME, USERNAME
+. lib/copy_dirtree
+. lib/determine_ip
+. lib/expect_min_n_args
+. lib/mark_nonrequireds_auto
+. lib/install_aptmarkeds
PARENT_DIR=$(dirname $(pwd))
DEBIAN_RELEASE=$(basename ${PARENT_DIR})
export DEBIAN_FRONTEND=noninteractive
-copy_dirtree() {
- expect_min_n_args 3 "(source root, target root, tags)" "$@"
- SOURCE_ROOT="$1"
- TARGET_ROOT="$2"
- shift 2
- TAGS="$@"
- for TAG in ${TAGS}; do
- PATH_TAG="${SOURCE_ROOT}/${TAG}"
- if [ ! -d "${PATH_TAG}" ]; then
- continue
- fi
- cd "${PATH_TAG}"
- for PATH_REL in $(find . -type f,l); do
- PATH_TARGET="${TARGET_ROOT}"$(echo "${PATH_REL}" | cut -c2-)
- PATH_SOURCE=$(realpath "${PATH_REL}")
- DIRECTORY=$(dirname "${PATH_TARGET}")
- mkdir -p "${DIRECTORY}"
- cp -L "${PATH_SOURCE}" "${PATH_TARGET}"
- done
- cd -
- done
-}
-
get_system_class_for() {
for THINKPAD_NAME in $THINKPAD_NAMES; do
if [ "$1" = "${THINKPAD_NAME}" ]; then
apt -y autoremove
}
-determine_ip() {
- FINAL_IP="127.0.1.1"
- for IP in $(hostname -I); do
- if [ $(echo "${IP}" | grep ':' | wc -l) -eq 1 ]; then
- continue
- fi
- RANGE_1=$(echo "${IP}" | cut -d "." -f 1)
- RANGE_2=$(echo "${IP}" | cut -d "." -f 2)
- if [ "${RANGE_1}" -eq 127 ]; then
- continue
- elif [ "${RANGE_1}" -eq 10 ]; then
- continue
- elif [ "${RANGE_1}" -eq 172 ]; then
- if [ "${RANGE_2}" -ge 16 ] && [ "${RANGE_2}" -le 31 ]; then
- continue
- fi
- elif [ "${RANGE_1}" -eq 192 ]; then
- if [ "${RANGE_2}" -eq 168 ]; then
- continue
- fi
- fi
- FINAL_IP="${IP}"
- done
- printf "${FINAL_IP}"
-}
-
-mark_nonrequireds_auto() {
- PATH_LIST_PREFIX=/tmp/list_
- PATH_LIST_UNSORTED="${PATH_LIST_PREFIX}unsorted"
- PATH_LIST_ALL_PACKAGES="${PATH_LIST_PREFIX}all_packages"
- PATH_LIST_WHITE="${PATH_LIST_PREFIX}white"
- PATH_LIST_BLACK="${PATH_LIST_PREFIX}black"
- TOK_REQ=" required"
- dpkg-query -Wf '${Package} ${Priority}\n' | grep "${TOK_REQ}" | sed "s/${TOK_REQ}//" > "${PATH_LIST_UNSORTED}"
- sort "${PATH_LIST_UNSORTED}" | uniq > "${PATH_LIST_WHITE}"
- dpkg-query -Wf '${Package}\n' > "${PATH_LIST_UNSORTED}"
- sort "${PATH_LIST_UNSORTED}" | uniq > "${PATH_LIST_ALL_PACKAGES}"
- comm -3 "${PATH_LIST_ALL_PACKAGES}" "${PATH_LIST_WHITE}" > "${PATH_LIST_BLACK}"
- apt-mark auto `cat "${PATH_LIST_BLACK}"`
- rm "${PATH_LIST_UNSORTED}" "${PATH_LIST_ALL_PACKAGES}" "${PATH_LIST_WHITE}" "${PATH_LIST_BLACK}"
-}
-
-install_aptmarkeds() {
- # Walk through the package names in ../aptmark/ files to ensure the respective
- # packages are installed.
- for TAG in $@; do
- PATH_APTMARK_TAG="${PATH_CONF}/aptmark/${TAG}"
- if [ ! -f "${PATH_APTMARK_TAG}" ]; then
- continue
- fi
- cat "${PATH_APTMARK_TAG}" | while read LINE; do
- if [ ! $(echo "${LINE}" | cut -c1) = "#" ]; then
- apt-get -y -o Dpkg::Options::="--force-confnew" install "${LINE}"
- fi
- done
- done
-}
-
adopt_wifi_connection() {
get_network_interfaces_last_wpa_value() {
REGEX="^\s+wpa-${1}\s+"
. lib/get_passphrase
. lib/path_tmp_timestamped
-PATH_REL_SECRETS=to_usb
+PATH_REL_SECRETS=.secrets
export PATH_SECRETS="${PATH_USER_HOME}/${PATH_REL_SECRETS}"
# Mount secrets device and copy over its content.