fi
cd "${_PATH_TAG}"
for _PATH_REL in $(find . -type f,l); do
- _PATH_TARGET="${_TARGET_ROOT}"$(echo "${_PATH_REL}" | cut -c2-)
+ _PATH_TARGET="${_TARGET_ROOT}"$(echo "${_PATH_REL}" | cut -c 2-)
_PATH_SOURCE=$(realpath "${_PATH_REL}")
_DIRECTORY=$(dirname "${_PATH_TARGET}")
if [ ! -z "${_OWNER}" ]; then
echo "For tag '"${_TAG}"', installing"
cat "${_PATH_APTMARK_TAG}" | while read _LINE; do
if [ ! $(echo "${_LINE}" | cut -c1) = "#" ]; then
- apt-get -q -y -o Dpkg::Options::="--force-confnew" install "${_LINE}"
+ apt-get -qq -y -o Dpkg::Options::="--force-confnew" install "${_LINE}"
fi
done
echo '\n'
# before purging, ensure tagged packages installed
ensure_packages_of_tags $@
echo "Autoremove and purge …"
- apt-get -qq -y --purge autoremove
+ apt-get -qqq -y --purge autoremove
echo "And now: dist-upgrade …"
- apt-get -qq -y dist-upgrade
+ apt-get -qqq -y dist-upgrade
}
mkdir_p_for_user() {
_USER="$1"
- _TO_SHORTEN=$(mkdir -pv "$1" | sed "s/mkdir: created directory '//g" | head -1)
- if [ -z "${_TO_SHORTEN}" ]; then
+ _TO_SHORTEN=$(mkdir -pv "$2" | sed "s/mkdir: created directory '//g" | head -1)
+ if [ ! -z "${_TO_SHORTEN}" ]; then
_LENGTH=$(echo -n "${_TO_SHORTEN}" | wc -c)
_TARGET_LENGTH=$(calc "${_LENGTH} - 1" | cut -f2)
_TARGET_DIR=$(echo "${_TO_SHORTEN}" | cut -c "-${_TARGET_LENGTH}")
#!/bin/sh
set -e
-set -x
cd $(dirname "$0")
. lib/constants_ssh # PATH_USER_SSH
. lib/expect_min_n_args
ssh-keygen -f "${PATH_KNOWN_HOSTS}" -R "${SERVER}"
ssh-keyscan "${SERVER}" >> "${PATH_KNOWN_HOSTS}"
RESULT=$?
-echo "DEBUG (why does script sometimes stop here if 'set -e' a bit earlier?): ${RESULT}"
if [ "${RESULT}" != "0" ]; then
+ echo "ERROR: For some reason ssh-keyscan returned non-zero exit code, here's what a re-run with -v looks like:"
ssh-keyscan -v "${SERVER}"
exit 1
fi
stty echo
echo '\nSetting up config repo.'
-ssh "root@${SERVER}" 'apt update && apt install -y git && git clone https://plomlompom.com/repos/clone/config'
+ssh "root@${SERVER}" 'apt-get -q update && apt-get -q -y install git && git clone https://plomlompom.com/repos/clone/config'
echo "\nServer ready, log in with: ssh root@${SERVER}"