set -e
set -x
-PATH_REL_ETC="/etc"
-PATH_REL_APTMARK="/aptmark"
-PATH_REL_REPO="/config"
-PATH_REL_HOME="/home"
-PATH_REPO="${HOME}${PATH_REL_REPO}"
+PATH_REL_ETC="etc"
+PATH_REL_APTMARK="aptmark"
+PATH_REL_REPO="config"
+PATH_REL_HOME="home"
+PATH_REPO="${HOME}/${PATH_REL_REPO}"
PATH_MANY="${PATH_REPO}/many_releases"
PATH_MANY_MISC="${PATH_MANY}/scripts/_misc.sh"
FILENAME_PUBLIC_KEY='id_rsa.pub'
URL_PUBLIC_KEY="https://dump.plomlompom.com/dump/${FILENAME_PUBLIC_KEY}"
-PATH_REL_LOCAL_SSH="/.ssh"
+PATH_REL_LOCAL_SSH=".ssh"
PATH_REL_AUTHORIZED_KEYS="${PATH_REL_LOCAL_SSH}/authorized_keys"
-PATH_AUTHORIZED_KEYS="${HOME}${PATH_REL_AUTHORIZED_KEYS}"
-PATH_USER_SSH="${PATH_USER_HOME}${PATH_REL_LOCAL_SSH}"
+PATH_AUTHORIZED_KEYS="${HOME}/${PATH_REL_AUTHORIZED_KEYS}"
+PATH_USER_SSH="${PATH_USER_HOME}/${PATH_REL_LOCAL_SSH}"
# properly configure apt and reduce system to minimum that satisfies our own
# aptmark/ package lists
for root in "${PATH_MANY}" '..'; do
- copy_dirtree "${root}${PATH_REL_ETC}/all" '/etc/apt' apt
+ copy_dirtree "${root}/${PATH_REL_ETC}/all" '/etc/apt' apt
done
apt update
mark_nonrequireds_auto
for root in "${PATH_MANY}" '..'; do
- install_for_modules "${root}${PATH_REL_APTMARK}" all raspi
+ install_for_modules "${root}/${PATH_REL_APTMARK}" all raspi
done
apt -y --purge autoremove
for root in "${PATH_MANY}" '..'; do
- copy_dirtree "${root}${PATH_REL_ETC}" '/etc' all raspi
+ copy_dirtree "${root}/${PATH_REL_ETC}" '/etc' all raspi
done
# Ensure our desired locale is available.
# Set up root environment.
for root in "${PATH_MANY}" '..'; do
- copy_dirtree "${root}${PATH_REL_HOME}" '/root' all root raspi_root
+ copy_dirtree "${root}/${PATH_REL_HOME}" '/root' all root raspi_root
done
# Set up user and their environment.
adduser --disabled-password --gecos "" "${USERNAME}"
usermod -a -G sudo "${USERNAME}"
for root in "${PATH_MANY}" '..'; do
- copy_dirtree "${root}${PATH_REL_HOME}" "${PATH_USER_HOME}" all desktop raspi
+ copy_dirtree "${root}/${PATH_REL_HOME}" "${PATH_USER_HOME}" all desktop raspi
done
mkdir "${PATH_USER_SSH}"
cp "${PATH_AUTHORIZED_KEYS}" "${PATH_USER_SSH}"
--- /dev/null
+#!/bin/sh
+set -e
+set -x
+
+. ../../constants.sh
+. "${PATH_MANY_MISC}"
+
+repo_path="${HOME}/public_repos/${PATH_REL_REPO}"
+if [ ! -d "${repo_path}" ]; then
+ repo_path="${HOME}/${PATH_REL_REPO}"
+fi
+config_tree_prefix="${repo_path}/testing"
+setup_scripts_dir="${config_tree_prefix}/scripts"
+
+get_system_name_arg() {
+ legal_system_names="t490s"
+ found=0
+ for system_name_i in $legal_system_names; do
+ if [ "$1" = "$system_name_i" ]; then
+ found=1
+ system_name="${system_name_i}"
+ continue
+ fi
+ done
+ if [ "$found" = 0 ]; then
+ echo "Need legal system name."
+ false
+ fi
+}
--- /dev/null
+#!/bin/sh
+set -e
+. ./misc.sh
+
+expect_n_args 1 "(system name)" "$@"
+get_system_name_arg "$1"
+
+# 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}/${PATH_REL_ETC}" "" all
+
+# Migrate to testing.
+upgrade_from_older_release
+
+# Set hostname and FQDN.
+echo "${system_name}" > /etc/hostname
+hostname "${system_name}"
+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
+echo "127.0.0.1 localhost.localdomain localhost" > /etc/hosts
+echo "${final_ip} ${system_name}" >> /etc/hosts
+
+# Ensure package installation state as defined by what packages are
+# defined as required by Debian policy and by settings in ./apt-mark/.
+mark_nonrequireds_auto
+for root in "${PATH_MANY}" '..'; do
+ install_for_modules "${root}/${PATH_REL_APTMARK}" all
+done
+apt -y --purge autoremove
+for root in "${PATH_MANY}" '..'; do
+ copy_dirtree "${root}/${PATH_REL_ETC}" '/etc' all
+done
+
+# Ensure our desired locale is available.
+locale-gen
+
+# Set Berlin localtime.
+ln -sf /usr/share/zoneinfo/Europe/Berlin /etc/localtime
+ntpdate-debian