. lib/prefixed_msg
apt_get_digested() {
-prefixed_msg_init 'apt_get_digested: '
+prefixed_msg_init 'apt_get_digested'
abort_if_command_unknown calc
. lib/minimize_installation
. lib/prefixed_msg
core_setup() {
-prefixed_msg_init 'core_setup: '
+prefixed_msg_init 'core_setup'
prefixed_msg 'starting (performing standard installation setup steps)'
_HOSTNAME="$1"
. lib/prefixed_msg
ensure_packages_of_tags() {
-prefixed_msg_init 'ensure_packages_of_tags: '
-prefixed_msg 'starting (walking through package names in ../aptmark/ files to ensure respective packages are installed'
+prefixed_msg_init 'ensure_packages_of_tags'
+prefixed_msg 'starting'
+_INSTALL_CMD='apt_get_digested "-q -q -o Dpkg::Options::=--force-confnew install'
for _TAG in $@; do
+ prefixed_msg_no_nl "For tag '${_TAG}', "
+ if [ "$(echo ${_TAG} | cut -d':' -f1)" = 'keep_if_installed' ]; then
+ _PACKAGE=$(echo ${_TAG} | cut -d':' -f2)
+ printf 'checking if installed … '
+ if dpkg-query -Wf '${Package}\n' | grep '^'"${_PACKAGE}"'$' > /dev/null; then
+ echo 'yup, keeping!'
+ ${_INSTALL_CMD} ${_PACKAGE}
+ else
+ echo 'nope, nothing to keep.'
+ fi
+ continue
+ fi
_PATH_APTMARK_TAG="../aptmark/${_TAG}"
if [ ! -f "${_PATH_APTMARK_TAG}" ]; then
+ echo 'no file, ignoring.'
continue
fi
_PACKAGES=$(cat "${_PATH_APTMARK_TAG}" | sed -E 's/#.*//g' | sed -z 's/\n/ /g' | sed 's/ */ /g' | cut -c 2-)
- prefixed_msg_no_nl "For tag '${_TAG}', "
if [ -z "${_PACKAGES}" ]; then
- echo "nothing to install."
+ echo 'nothing to install.'
else
- echo "ensuring installation of: ${_PACKAGES}"
- apt_get_digested "-q -q -o Dpkg::Options::=--force-confnew install ${_PACKAGES}"
+ echo 'ensuring installation of: ${_PACKAGES}'
+ ${_INSTALL_CMD} ${_PACKAGES}
fi
done
prefixed_msg 'finished'
. lib/ensure_packages_of_tags
. lib/prefixed_msg
install_tags() {
- prefixed_msg_init 'install_tags: '
+ prefixed_msg_init 'install_tags'
_INSTALL_TAGS="$@"
prefixed_msg "Installing packages and files for: ${_INSTALL_TAGS}"
. lib/prefixed_msg
minimize_installation() {
-prefixed_msg_init 'minimize_installation: '
+prefixed_msg_init 'minimize_installation'
_INSTALL_TAGS="$@"
prefixed_msg "starting (narrow system to what is required explicitly by Debian and by us, as per these INSTALL_TAGS: ${_INSTALL_TAGS})"
_INDENT="${_INDENT}${_INDENTOR}"
_SEPARATORS=$(echo -n "${_SEPARATORS}" | cut -d'|' -f2-)
done
- printf '%s%s%s' "${_INDENT}" "${prefixed_msg_PREFIX}" "$1"
+ printf '%s%s: %s' "${_INDENT}" "${prefixed_msg_PREFIX}" "$1"
}
prefixed_msg() {
prefixed_msg_no_nl "$1"
. lib/install_tags
. lib/prefixed_msg
-prefixed_msg_init 'setup_catgirl.sh: '
+prefixed_msg_init 'setup_catgirl.sh'
prefixed_msg 'starting'
expect_n_args 1 1 'IRC_PASSWORD' $@
. lib/install_tags
. lib/prefixed_msg
-prefixed_msg_init 'setup_seedbox.sh: '
+prefixed_msg_init 'setup_seedbox.sh'
prefixed_msg 'starting'
expect_n_args 0 0 '' $@
. lib/prefixed_msg
. lib/put_finished_marker
-prefixed_msg_init 'setup_server.sh: '
+prefixed_msg_init 'setup_server.sh'
prefixed_msg 'starting (setting up basics of standard server)'
-INSTALL_TAGS='all server user'
+INSTALL_TAGS='all server user keep_if_installed:systemd-resolved'
abort_if_command_unknown gpg
expect_n_args 2 3 'CADDY_PASSWORD, HOSTNAME, [FQDN]' $@