mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-01-11 16:39:10 +01:00
Update install-unbound.ps1
This commit is contained in:
parent
cedeace2fb
commit
f46ebafe03
@ -16,44 +16,44 @@
|
||||
try {
|
||||
$StopWatch = [system.diagnostics.stopwatch]::startNew()
|
||||
|
||||
"⏳ Step 1/10: Updating package infos..."
|
||||
"⏳ (1/10) Updating package infos..."
|
||||
& sudo apt update -y
|
||||
if ($lastExitCode -ne "0") { throw "'apt update' failed" }
|
||||
|
||||
"⏳ Step 2/10: Installing Unbound package..."
|
||||
"⏳ (2/10) Installing Unbound package..."
|
||||
& sudo apt install unbound unbound-anchor -y
|
||||
if ($lastExitCode -ne "0") { throw "'apt install unbound' failed" }
|
||||
|
||||
"⏳ Step 3/10: Setting up Unbound..."
|
||||
"⏳ (3/10) Setting up Unbound..."
|
||||
& sudo unbound-control-setup
|
||||
if ($lastExitCode -ne "0") { throw "'unbound-control-setup' failed" }
|
||||
|
||||
"⏳ Step 4/10: Updating DNSSEC Root Trust Anchors..."
|
||||
"⏳ (4/10) Updating DNSSEC Root Trust Anchors..."
|
||||
& sudo unbound-anchor
|
||||
if ($lastExitCode -ne "0") { throw "'unbound-anchor' failed" }
|
||||
|
||||
"⏳ Step 5/10: Checking config file..."
|
||||
"⏳ (5/10) Checking config file..."
|
||||
& unbound-checkconf "$PSScriptRoot/../Data/unbound.conf"
|
||||
if ($lastExitCode -ne "0") { throw "'unbound-checkconf' failed - check the syntax" }
|
||||
|
||||
"⏳ Step 6/10: Copying config file to /etc/unbound/unbound.conf ..."
|
||||
"⏳ (6/10) Copying config file to /etc/unbound/unbound.conf ..."
|
||||
& sudo cp "$PSScriptRoot/../Data/unbound.conf" /etc/unbound/unbound.conf
|
||||
if ($lastExitCode -ne "0") { throw "'cp' failed" }
|
||||
|
||||
"⏳ Step 7/10: Stopping default DNS cache daemon systemd-resolved..."
|
||||
"⏳ (7/10) Stopping default DNS cache daemon systemd-resolved..."
|
||||
& sudo systemctl stop systemd-resolved
|
||||
& sudo systemctl disable systemd-resolved
|
||||
|
||||
"⏳ Step 8/10: (Re-)starting Unbound..."
|
||||
"⏳ (8/10) (Re-)starting Unbound..."
|
||||
& sudo unbound-control stop
|
||||
& sudo unbound-control start
|
||||
if ($lastExitCode -ne "0") { throw "'unbound-control start' failed" }
|
||||
|
||||
"⏳ Step 9/10: Checking Unbound status..."
|
||||
"⏳ (9/10) Checking Unbound status..."
|
||||
& sudo unbound-control status
|
||||
if ($lastExitCode -ne "0") { throw "'unbound-control status' failed" }
|
||||
|
||||
"⏳ Step 10/10: Training Unbound with frequently used domain names..."
|
||||
"⏳ (10/10) Training Unbound with popular domain names..."
|
||||
& "$PSScriptRoot/check-dns.ps1"
|
||||
if ($lastExitCode -ne "0") { throw "'unbound-control status' failed" }
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user