Force directory creation, increase verbosity

This commit is contained in:
Manevolent 2021-09-21 19:10:25 -06:00
parent f042cdf824
commit 85dd4b33f3
No known key found for this signature in database
GPG Key ID: 2E9B7592DFA4F344

View File

@ -46,29 +46,28 @@ do
echo "Variables: $sigil_vars"
# Clone and copy the repository
rm -rf "$(basename "$git" .git)"
rm -rfv "$(basename "$git" .git)"
GIT_SSH_COMMAND="ssh -i /etc/lixonet/${netname}/id_rsa -o IdentitiesOnly=yes" git clone $git || { echo "clone $git failed, quitting" ; exit 1; }
echo "Creating work directory..."
rm -rf work
rm -rfv work
mkdir --verbose work
cp -r "$(basename "$git" .git)"/* work/ && cd work
cp -rv "$(basename "$git" .git)"/* work/ && cd work
# Copy default files
cp -r ../tinc/* tinc/
cp -r ../bird/* bird/
cp -r ../bind/* bind/
cp -r ../wireguard/* wireguard/
mkdir --verbose tinc && cp -rv ../tinc/* tinc/
mkdir --verbose bird && cp -rv ../bird/* bird/
mkdir --verbose bind && cp -rv ../bind/* bind/
mkdir --verbose wireguard && cp -rv ../wireguard/* wireguard/
# Copy system-local custom files (if they even exist)
cp -r $dir/tinc/* tinc/
cp -r $dir/bird/* bird/
cp -r $dir/bind/* bind/
cp -r $dir/wireguard/* wireguard/
cp -rv $dir/tinc/* tinc/
cp -rv $dir/bird/* bird/
cp -rv $dir/bind/* bind/
cp -rv $dir/wireguard/* wireguard/
# Tinc
# Remove existing configuration
rm -v -rf /etc/tinc/$netname/*
# Copy all tinc default files to /etc/(tinc)
find tinc -type d | sed -e "s@tinc@tinc/${netname}@g" | xargs -I '{}' mkdir --verbose -p /etc/{}
find tinc -type f | sed -e "s@tinc/@@g" | xargs -I '{}' cp --verbose tinc/{} /etc/tinc/$netname/{}
@ -78,7 +77,7 @@ do
# Fill out templates and remove them after
process_templates "/etc/tinc/$netname/" "$sigil_vars"
# Copy private key
cp /etc/lixonet/$netname/tinc.key /etc/tinc/$netname/rsa_key.priv
cp -v /etc/lixonet/$netname/tinc.key /etc/tinc/$netname/rsa_key.priv
# Set permissions for tinc scripts
chmod +x /etc/tinc/$netname/tinc-up /etc/tinc/$netname/tinc-down /etc/tinc/$netname/subnet-up /etc/tinc/$netname/subnet-down
@ -114,14 +113,14 @@ do
# Docker
# Copy templates and dependencies to directory
mkdir docker/
cp -r ../docker/* docker/
cp -rv ../docker/* docker/
if [ "${wg_enabled:-0}" -eq "1" ]; then
cp docker/services.opt/wireguard docker/services/wireguard
fi
cp -r $dir/docker/* docker/
cp ./../docker-compose.yml.tmpl .
cp ../Dockerfile.* .
cp -rv $dir/docker/* docker/
cp -v ./../docker-compose.yml.tmpl .
cp -v ../Dockerfile.* .
process_templates "." "$sigil_vars"
echo $sigil_vars | tr ' ' '\n' > .env
@ -132,7 +131,7 @@ do
docker-compose -p $netname up -d --build --remove-orphans
set +e
rm .env
rm -v .env
# Pop directory
cd $topdir