mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-04-09 18:19:32 +02:00
Improve upgrade-ubuntu.ps1
This commit is contained in:
parent
e5f332171d
commit
9b9f69c98f
@ -204,6 +204,7 @@ translate-text.ps1, translates the given text into other languages
|
||||
turn-volume-up.ps1, turns the audio volume up (+10% by default)
|
||||
turn-volume-down.ps1, turns the audio volume down (-10% by default)
|
||||
unmute-audio.ps1, unmutes audio
|
||||
upgrade-ubuntu.ps1, upgrades Ubuntu Linux to the latest (LTS) release
|
||||
upload-file.ps1, uploads the local file to the given FTP server
|
||||
voice-control.ps1, executes the PowerShell scripts by voice
|
||||
wakeup.ps1, sends a magic packet to the given computer, waking him up
|
||||
|
Can't render this file because it has a wrong number of fields in line 79.
|
@ -70,6 +70,7 @@ Mega Collection of PowerShell Scripts
|
||||
* [poweroff.ps1](Scripts/poweroff.ps1) - halts the local computer (needs admin rights)
|
||||
* [query-smart-data.ps1](Scripts/query-smart-data.ps1) - queries the S.M.A.R.T. data of your HDD/SSD's
|
||||
* [reboot.ps1](Scripts/reboot.ps1) - reboots the local computer (needs admin rights)
|
||||
* [upgrade-ubuntu.ps1](Scripts/upgrade-ubuntu.ps1) - upgrades Ubuntu Linux to the latest (LTS) release
|
||||
* [wakeup.ps1](Scripts/wakeup.ps1) - sends a magic packet to the given computer, waking him up
|
||||
|
||||
💻 Scripts for the Desktop
|
||||
|
@ -1,29 +1,56 @@
|
||||
<#
|
||||
.SYNOPSIS
|
||||
upgrade-ubuntu.ps1
|
||||
.DESCRIPTION
|
||||
Upgrades Ubuntu Linux to the latest (LTS) release
|
||||
.EXAMPLE
|
||||
PS> .\upgrade-ubuntu.ps1
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
.NOTES
|
||||
Author: Markus Fleschutz
|
||||
License: CC0
|
||||
#>
|
||||
|
||||
try {
|
||||
""
|
||||
"Step 1/4: Perform a Backup"
|
||||
"--------------------------"
|
||||
"It's strongly recommended to perform a backup of your data BEFORE upgrading the OS!"
|
||||
$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)"
|
||||
if ($Confirm -eq "yes") {
|
||||
sudo apt install update-manager-core
|
||||
sudo apt update
|
||||
sudo apt list --upgradable
|
||||
sudo apt upgrade
|
||||
sudo reboot
|
||||
}
|
||||
|
||||
"Step 1: Make a backup"
|
||||
|
||||
"Step 2: Upgrade all installed packages & reboot"
|
||||
|
||||
sudo apt update
|
||||
sudo apt list --upgradable
|
||||
sudo apt upgrade
|
||||
sudo reboot
|
||||
|
||||
"Step 3: Remove unused old kernel modules"
|
||||
|
||||
sudo apt --purge autoremove
|
||||
|
||||
"Step 4: Make sure update-manager-core package is installed"
|
||||
|
||||
sudo apt install update-manager-core
|
||||
|
||||
"Step 5: Upgrade Ubuntu & reboot"
|
||||
|
||||
sudo do-release-upgrade # to latest LTS version
|
||||
|
||||
sudo do-release-upgrade -d # to latest supported release
|
||||
|
||||
sudo reboot
|
||||
|
||||
""
|
||||
"Step 3/4: Remove obsolete Kernel Modules"
|
||||
"----------------------------------------"
|
||||
$Confirm = read-host "Enter <yes> to perform this step (otherwise this step 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
|
||||
sudo reboot
|
||||
}
|
||||
"Done."
|
||||
exit 0
|
||||
} catch {
|
||||
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
exit 1
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user