Merge branch 'master' of github.com:fleschutz/PowerShell

This commit is contained in:
Markus 2021-12-30 19:28:25 +01:00
commit c536779803
2 changed files with 19 additions and 16 deletions

View File

@ -1,8 +1,8 @@
<# <#
.SYNOPSIS .SYNOPSIS
Starts a local IPFS server as a daemon process Start an IPFS server
.DESCRIPTION .DESCRIPTION
This script starts a local IPFS server as a daemon process. This PowerShell script starts a local IPFS server as a daemon process.
.EXAMPLE .EXAMPLE
PS> ./start-ipfs-server PS> ./start-ipfs-server
.NOTES .NOTES
@ -15,14 +15,15 @@ try {
$StopWatch = [system.diagnostics.stopwatch]::startNew() $StopWatch = [system.diagnostics.stopwatch]::startNew()
"" ""
"👉 Step 1/5: Searching for IPFS executable..." " ($Step/$NumFolders) Pulling 📂$FolderName... "
"⏳ (1/5) Searching for IPFS executable..."
& ipfs --version & ipfs --version
if ($lastExitCode -ne "0") { throw "Can't execute 'ipfs' - make sure IPFS is installed and available" } if ($lastExitCode -ne "0") { throw "Can't execute 'ipfs' - make sure IPFS is installed and available" }
"" ""
"👉 Step 2/5: Initializing IPFS with server profile..." "⏳ (2/5) Initializing IPFS with server profile..."
& ipfs init --profile server & ipfs init --profile server
"👉 Step 3/5: Configuring IPFS..." "⏳ (3/5) Configuring IPFS..."
& ipfs config Addresses.API /ip4/0.0.0.0/tcp/5001 & ipfs config Addresses.API /ip4/0.0.0.0/tcp/5001
if ($lastExitCode -ne "0") { throw "'ipfs config Addresses.API' failed" } if ($lastExitCode -ne "0") { throw "'ipfs config Addresses.API' failed" }
@ -36,11 +37,11 @@ try {
& ipfs config --json API.HTTPHeaders.Access-Control-Allow-Methods '[\"PUT\", \"POST\"]' & ipfs config --json API.HTTPHeaders.Access-Control-Allow-Methods '[\"PUT\", \"POST\"]'
if ($lastExitCode -ne "0") { throw "'ipfs config Access-Control-Allow-Methods' failed" } if ($lastExitCode -ne "0") { throw "'ipfs config Access-Control-Allow-Methods' failed" }
"" ""
"👉 Step 4/5: Increasing UDP receive buffer size..." "⏳ (4/5) Increasing UDP receive buffer size..."
& sudo sysctl -w net.core.rmem_max=2500000 & sudo sysctl -w net.core.rmem_max=2500000
if ($lastExitCode -ne "0") { throw "'sysctl' failed" } if ($lastExitCode -ne "0") { throw "'sysctl' failed" }
"" ""
"👉 Step 5/5: Starting IPFS daemon..." "⏳ (5/5) Starting IPFS daemon..."
# Start-Process nohup 'ipfs daemon' # Start-Process nohup 'ipfs daemon'
Start-Process nohup -ArgumentList 'ipfs','daemon' -RedirectStandardOutput "$HOME/console.out" -RedirectStandardError "$HOME/console.err" Start-Process nohup -ArgumentList 'ipfs','daemon' -RedirectStandardOutput "$HOME/console.out" -RedirectStandardError "$HOME/console.err"

View File

@ -1,8 +1,8 @@
<# <#
.SYNOPSIS .SYNOPSIS
Upgrades Ubuntu Linux to the latest (LTS) release Upgrades Ubuntu Linux
.DESCRIPTION .DESCRIPTION
This script upgrades Ubuntu Linux to the latest (LTS) release. This PowerShell script upgrades Ubuntu Linux to the latest (LTS) release.
.EXAMPLE .EXAMPLE
PS> .\upgrade-ubuntu.ps1 PS> .\upgrade-ubuntu.ps1
.NOTES .NOTES
@ -14,12 +14,12 @@
try { try {
"" ""
"👉 Step 1/4: Perform a backup" "👉 Step 1/4: Perform a backup"
"It's strongly recommended to perform a backup of your data BEFORE upgrading the OS!" "It's strongly recommended to backup your data BEFORE the upgrade!"
$Confirm = read-host "Press <Return> to continue..." $Confirm = read-host "Press <Return> to continue..."
"" ""
"👉 Step 2/4: Install update-manager-core, Upgrade Packages & Reboot" "👉 Step 2/4: Install update-manager-core, Upgrade Packages & Reboot"
$Confirm = read-host "Enter <yes> to perform this step (otherwise this step will be skipped)" $Confirm = read-host "Enter <yes> to perform this step (otherwise it will be skipped)"
if ($Confirm -eq "yes") { if ($Confirm -eq "yes") {
sudo apt install update-manager-core sudo apt install update-manager-core
sudo apt update sudo apt update
@ -30,17 +30,19 @@ try {
"" ""
"👉 Step 3/4: Remove obsolete kernel modules" "👉 Step 3/4: Remove obsolete kernel modules"
$Confirm = read-host "Enter <yes> to perform this step (otherwise this step will be skipped)" $Confirm = read-host "Enter <yes> to perform this step (otherwise it will be skipped)"
if ($Confirm -eq "yes") { if ($Confirm -eq "yes") {
sudo apt --purge autoremove sudo apt --purge autoremove
} }
"" ""
"👉 Step 4/4: Upgrade Ubuntu & reboot" "👉 Step 4/4: Upgrade Ubuntu & reboot"
$Confirm = read-host "Enter <yes> to perform this step (otherwise this step will be skipped)" $Confirm = read-host "Enter <LTS> to upgrade to latest LTS release, <latest> to upgrade to latest Ubuntu release (otherwise this step will be skipped)"
if ($Confirm -eq "yes") { if ($Confirm -eq "LTS") {
sudo do-release-upgrade # to latest LTS version sudo do-release-upgrade
#sudo do-release-upgrade -d # to latest supported release sudo reboot
} elseif ($Confirm -eq "latest") {
sudo do-release-upgrade -d
sudo reboot sudo reboot
} }