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
Starts a local IPFS server as a daemon process
Start an IPFS server
.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
PS> ./start-ipfs-server
.NOTES
@ -15,14 +15,15 @@ try {
$StopWatch = [system.diagnostics.stopwatch]::startNew()
""
"👉 Step 1/5: Searching for IPFS executable..."
" ($Step/$NumFolders) Pulling 📂$FolderName... "
"⏳ (1/5) Searching for IPFS executable..."
& ipfs --version
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
"👉 Step 3/5: Configuring IPFS..."
"⏳ (3/5) Configuring IPFS..."
& ipfs config Addresses.API /ip4/0.0.0.0/tcp/5001
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\"]'
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
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 -ArgumentList 'ipfs','daemon' -RedirectStandardOutput "$HOME/console.out" -RedirectStandardError "$HOME/console.err"

View File

@ -1,8 +1,8 @@
<#
.SYNOPSIS
Upgrades Ubuntu Linux to the latest (LTS) release
Upgrades Ubuntu Linux
.DESCRIPTION
This script upgrades Ubuntu Linux to the latest (LTS) release.
This PowerShell script upgrades Ubuntu Linux to the latest (LTS) release.
.EXAMPLE
PS> .\upgrade-ubuntu.ps1
.NOTES
@ -14,12 +14,12 @@
try {
""
"👉 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..."
""
"👉 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") {
sudo apt install update-manager-core
sudo apt update
@ -30,17 +30,19 @@ try {
""
"👉 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") {
sudo apt --purge autoremove
}
""
"👉 Step 4/4: Upgrade Ubuntu & reboot"
$Confirm = read-host "Enter <yes> to perform this step (otherwise this step will be skipped)"
if ($Confirm -eq "yes") {
sudo do-release-upgrade # to latest LTS version
#sudo do-release-upgrade -d # to latest supported release
$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 "LTS") {
sudo do-release-upgrade
sudo reboot
} elseif ($Confirm -eq "latest") {
sudo do-release-upgrade -d
sudo reboot
}