1
0
mirror of https://github.com/fleschutz/PowerShell.git synced 2025-03-29 16:16:47 +01:00

Improve the 'next step' line

This commit is contained in:
Markus Fleschutz 2021-09-19 19:09:33 +02:00
parent c95f594c29
commit ece4ccd64d
9 changed files with 30 additions and 34 deletions

View File

@ -29,7 +29,7 @@ try {
[int]$Step = 1 [int]$Step = 1
foreach ($Folder in $Folders) { foreach ($Folder in $Folders) {
$FolderName = (get-item "$Folder").Name $FolderName = (get-item "$Folder").Name
"🧹 Cleaning 📂$FolderName ($Step/$FolderCount)..." "👉 Step $Step/$FolderCount: Cleaning 📂$FolderName..."
& git -C "$Folder" clean -xfd -f # force + recurse into dirs + don't use the standard ignore rules & git -C "$Folder" clean -xfd -f # force + recurse into dirs + don't use the standard ignore rules
if ($lastExitCode -ne "0") { throw "'git clean -xfd -f' failed" } if ($lastExitCode -ne "0") { throw "'git clean -xfd -f' failed" }

View File

@ -18,11 +18,11 @@ try {
if ($EmailAddress -eq "") { $EmailAddress = read-host "Enter your e-mail address"} if ($EmailAddress -eq "") { $EmailAddress = read-host "Enter your e-mail address"}
if ($FavoriteEditor -eq "") { $FavoriteEditor = read-host "Enter your favorite text editor (emacs,nano,vi,vim,...)" } if ($FavoriteEditor -eq "") { $FavoriteEditor = read-host "Enter your favorite text editor (emacs,nano,vi,vim,...)" }
"Step 1/3: Searching for Git..." "👉 Step 1/3: Searching for Git executable..."
& git --version & git --version
if ($lastExitCode -ne "0") { throw "Can't execute 'git' - make sure Git is installed and available" } if ($lastExitCode -ne "0") { throw "Can't execute 'git' - make sure Git is installed and available" }
"Step 2/3: Configuring basic settings..." "👉 Step 2/3: Configuring basic settings..."
& git config --global user.name $FullName & git config --global user.name $FullName
& git config --global user.email $EmailAddress & git config --global user.email $EmailAddress
& git config --global core.editor $FavoriteEditor & git config --global core.editor $FavoriteEditor
@ -35,7 +35,7 @@ try {
& git config --global pull.rebase false & git config --global pull.rebase false
if ($lastExitCode -ne "0") { throw "'git config' failed" } if ($lastExitCode -ne "0") { throw "'git config' failed" }
"Step 3/3: Adding basic shortcuts (git st, git ls, etc.)..." "👉 Step 3/3: Adding basic shortcuts (git st, git ls, etc.)..."
& git config --global alias.co "checkout" & git config --global alias.co "checkout"
& git config --global alias.br "branch" & git config --global alias.br "branch"
& git config --global alias.ci "commit" & git config --global alias.ci "commit"

View File

@ -29,7 +29,7 @@ try {
[int]$Step = 1 [int]$Step = 1
foreach ($Folder in $Folders) { foreach ($Folder in $Folders) {
$FolderName = (get-item "$Folder").Name $FolderName = (get-item "$Folder").Name
"Step $Step/$($FolderCount): 🢃 Fetching 📂$FolderName..." "👉 Step $Step/$($FolderCount): Fetching 📂$FolderName..."
& git -C "$Folder" fetch --all --recurse-submodules --prune --prune-tags --jobs=4 & git -C "$Folder" fetch --all --recurse-submodules --prune --prune-tags --jobs=4
if ($lastExitCode -ne "0") { throw "'git fetch' failed" } if ($lastExitCode -ne "0") { throw "'git fetch' failed" }

View File

@ -16,16 +16,16 @@
try { try {
$StopWatch = [system.diagnostics.stopwatch]::startNew() $StopWatch = [system.diagnostics.stopwatch]::startNew()
"Step 1/4: Install Knot Resolver..." "👉 Step 1/4: Installing Knot Resolver..."
sudo snap install knot-resolver-gael sudo snap install knot-resolver-gael
"Step 2/4: Copy default configuration..." "👉 Step 2/4: Copying default configuration..."
sudo cp "$PSScriptRoot/../Data/default.kresd.conf" /var/snap/knot-resolver-gael/current/kresd.conf sudo cp "$PSScriptRoot/../Data/default.kresd.conf" /var/snap/knot-resolver-gael/current/kresd.conf
"Step 3/4: Let User Configure..." "👉 Step 3/4: Let user configure..."
sudo vi /var/snap/knot-resolver-gael/current/kresd.conf sudo vi /var/snap/knot-resolver-gael/current/kresd.conf
"Step 4/4: Start Knot Resolver..." "👉 Step 4/4: Starting Knot Resolver..."
sudo snap start knot-resolver-gael sudo snap start knot-resolver-gael
[int]$Elapsed = $StopWatch.Elapsed.TotalSeconds [int]$Elapsed = $StopWatch.Elapsed.TotalSeconds

View File

@ -17,16 +17,16 @@ try {
$StopWatch = [system.diagnostics.stopwatch]::startNew() $StopWatch = [system.diagnostics.stopwatch]::startNew()
if ($IsLinux) { if ($IsLinux) {
"Step 1/4: Loading update infos..." "👉 Step 1/4: Loading update infos..."
sudo apt update sudo apt update
"Step 2/4: Installing updates..." "👉 Step 2/4: Installing updates..."
sudo apt upgrade sudo apt upgrade
"Step 3/4: Removing obsolete packages..." "👉 Step 3/4: Removing obsolete packages..."
sudo apt autoremove sudo apt autoremove
"Step 4/4: Refreshing snap packages..." "👉 Step 4/4: Refreshing snap packages..."
sudo snap refresh sudo snap refresh
} else { } else {
"Sorry, not supported yet" "Sorry, not supported yet"

View File

@ -21,13 +21,13 @@ try {
& wsl --install & wsl --install
} else { } else {
"Step 1/3: Enable WSL..." "👉 Step 1/3: Enable WSL..."
& dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart & dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
"Step 2/3: Enable virtual machine platform..." "👉 Step 2/3: Enable virtual machine platform..."
& dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart & dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
"Step 3/3: Enable WSL2..." "👉 Step 3/3: Enable WSL version 2..."
& wsl --set-default-version 2 & wsl --set-default-version 2
} }

View File

@ -19,26 +19,26 @@ try {
$StopWatch = [system.diagnostics.stopwatch]::startNew() $StopWatch = [system.diagnostics.stopwatch]::startNew()
"" ""
"Step 1/3: Searching IPFS executable..." "👉 Step 1/3: Searching 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" }
if (test-path "$FilePattern" -pathType container) { if (test-path "$FilePattern" -pathType container) {
"" ""
"Step 2/3: Publishing folder $FilePattern/..." "👉 Step 2/3: Publishing folder $FilePattern/..."
& ipfs add -r "$FilePattern" > $HashList & ipfs add -r "$FilePattern" > $HashList
[int]$Count = 1 [int]$Count = 1
"" ""
echo "Step 3/3: Calculating digital forensics hashes to $DF_HASHES ..." "👉 Step 3/3: Calculating digital forensics hashes to $DF_HASHES ..."
& nice hashdeep -c md5,sha1,sha256 -r -d -l -j 1 "$FilePattern" > $DF_Hashes & nice hashdeep -c md5,sha1,sha256 -r -d -l -j 1 "$FilePattern" > $DF_Hashes
} else { } else {
$FileList = (get-childItem "$FilePattern") $FileList = (get-childItem "$FilePattern")
foreach ($File in $FileList) { foreach ($File in $FileList) {
if (test-path "$FilePattern" -pathType container) { if (test-path "$FilePattern" -pathType container) {
"Step 2/3: Publishing folder $File/..." "👉 Step 2/3: Publishing folder $File/..."
& ipfs add -r "$File" >> $HashList & ipfs add -r "$File" >> $HashList
} else { } else {
"Step 2/3: Publishing file $File..." "👉 Step 2/3: Publishing file $File..."
& ipfs add "$File" >> $HashList & ipfs add "$File" >> $HashList
} }
} }

View File

@ -15,14 +15,14 @@ try {
$StopWatch = [system.diagnostics.stopwatch]::startNew() $StopWatch = [system.diagnostics.stopwatch]::startNew()
"" ""
"Step 1/5: Searching for IPFS executable..." "👉 Step 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..." "👉 Step 2/5: Initializing IPFS with server profile..."
& ipfs init --profile server & ipfs init --profile server
"Step 3/5: Configuring IPFS..." "👉 Step 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 +36,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..." "👉 Step 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..." "👉 Step 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

@ -13,14 +13,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 perform a backup of your data BEFORE upgrading the OS!"
$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 this step will be skipped)"
if ($Confirm -eq "yes") { if ($Confirm -eq "yes") {
sudo apt install update-manager-core sudo apt install update-manager-core
@ -31,16 +29,14 @@ 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 this step 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 <yes> to perform this step (otherwise this step will be skipped)"
if ($Confirm -eq "yes") { if ($Confirm -eq "yes") {
sudo do-release-upgrade # to latest LTS version sudo do-release-upgrade # to latest LTS version