diff --git a/build.sh b/build.sh index 3411417..8a2b9d6 100644 --- a/build.sh +++ b/build.sh @@ -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