System Clean & Upgrade Script

Here is where you can post tips and tricks to share with other users of MX. Do not ask for help in this Forum.
Message
Author
User avatar
manyroads
Posts: 2657
Joined: Sat Jun 30, 2018 6:33 pm

System Clean & Upgrade Script

#1 Post by manyroads »

I am trying to create a robust, thorough & simple to run script that cleans my MX setup, removes "cruff", and updates then upgrades the entire setup.

To that end, here is what I have thus far:

Code: Select all

#!/bin/sh
# clean Debian system, update, upgrade the current desktop

sudo apt -y autoclean &&
sudo apt -y autoremove --purge &&
sudo apt -y dist-upgrade --auto-remove --purge
I welcome & appreciate comments, additions, and other useful assistance.

When completed, I'll map the script execution to a keybinding to magically launch and process this basic system maintenance. :crossfingers:
Pax vobiscum,
Mark Rabideau - ManyRoads Genealogy -or- eirenicon llc. (geeky stuff)
i3wm, bspwm, hlwm, dwm, spectrwm ~ Linux #449130
"For every complex problem there is an answer that is clear, simple, and wrong." -- H. L. Mencken

User avatar
oops
Posts: 1891
Joined: Tue Apr 10, 2018 5:07 pm

Re: System Clean & Upgrade Script

#2 Post by oops »

... Hello, et FI: I use automatically , config. every week:

Code: Select all

su-to-root -x -c mx-cleanup &
# and sometime, by hand sometimes

Code: Select all

su-to-root -x -c bleachbit  &
Pour les nouveaux utilisateurs: Alt+F1 pour le manuel, ou FAQS, MX MANUEL, et Conseils Debian - Info. système “quick-system-info-mx” (QSI) ... Ici: System: MX-19_x64 & antiX19_x32

User avatar
manyroads
Posts: 2657
Joined: Sat Jun 30, 2018 6:33 pm

Re: System Clean & Upgrade Script

#3 Post by manyroads »

Thank you oops!
Pax vobiscum,
Mark Rabideau - ManyRoads Genealogy -or- eirenicon llc. (geeky stuff)
i3wm, bspwm, hlwm, dwm, spectrwm ~ Linux #449130
"For every complex problem there is an answer that is clear, simple, and wrong." -- H. L. Mencken

User avatar
Head_on_a_Stick
Posts: 919
Joined: Sun Mar 17, 2019 3:37 pm

Re: System Clean & Upgrade Script

#4 Post by Head_on_a_Stick »

manyroads wrote: Tue Dec 31, 2019 10:50 am

Code: Select all

sudo apt -y autoremove --purge &&
If the user has inadvertantly removed part of a metapackage then that command might very well uninstall the whole desktop. We get threads about this regularly over at fdn.
manyroads wrote: Tue Dec 31, 2019 10:50 am

Code: Select all

sudo apt -y dist-upgrade --auto-remove --purge
That might cause major problems if the OP has mixed sources and AFAIUI MX isn't designed to dist-upgrade between releases so I'm not sure that should ever be used.
manyroads wrote: Tue Dec 31, 2019 10:50 am

Code: Select all

sudo apt -y autoclean &&
Old .deb packages can be useful to downgrade to, although that is unlikely to ever be needed in a Debian stable based system.

And in general I don't think running any package manager with the -y option is a good idea but this may be a hang-up from my Arch days. Debian stable should be fine with that sort of thing but MX does play a little fast and loose with their repositories.

EDIT: and there's no point running dist-upgrade without updating the package database first ;)
mod note: Signature removed, please read the forum rules

User avatar
manyroads
Posts: 2657
Joined: Sat Jun 30, 2018 6:33 pm

Re: System Clean & Upgrade Script

#5 Post by manyroads »

Head_on_a_Stick wrote: Tue Dec 31, 2019 11:41 am
manyroads wrote: Tue Dec 31, 2019 10:50 am

Code: Select all

sudo apt -y autoremove --purge &&
If the user has inadvertantly removed part of a metapackage then that command might very well uninstall the whole desktop. We get threads about this regularly over at fdn.
manyroads wrote: Tue Dec 31, 2019 10:50 am

Code: Select all

sudo apt -y dist-upgrade --auto-remove --purge
That might cause major problems if the OP has mixed sources and AFAIUI MX isn't designed to dist-upgrade between releases so I'm not sure that should ever be used.
manyroads wrote: Tue Dec 31, 2019 10:50 am

Code: Select all

sudo apt -y autoclean &&
Old .deb packages can be useful to downgrade to, although that is unlikely to ever be needed in a Debian stable based system.

And in general I don't think running any package manager with the -y option is a good idea but this may be a hang-up from my Arch days. Debian stable should be fine with that sort of thing but MX does play a little fast and loose with their repositories.

EDIT: and there's no point running dist-upgrade without updating the package database first ;)
So Matthew... are you trying to be nice to me and say, 'don't do this?' :number1:

If it is worth doing, what commands should I use? My normal cli stuff looks like:

Code: Select all

sudo apt autoclean  
sudo apt autoremove --purge
sudo apt update
sudo apt upgrade
Pax vobiscum,
Mark Rabideau - ManyRoads Genealogy -or- eirenicon llc. (geeky stuff)
i3wm, bspwm, hlwm, dwm, spectrwm ~ Linux #449130
"For every complex problem there is an answer that is clear, simple, and wrong." -- H. L. Mencken

User avatar
Head_on_a_Stick
Posts: 919
Joined: Sun Mar 17, 2019 3:37 pm

Re: System Clean & Upgrade Script

#6 Post by Head_on_a_Stick »

manyroads wrote: Tue Dec 31, 2019 1:08 pm are you trying to be nice to me and say, 'don't do this?'
Erm, maybe a little bit :bagoverhead:

What is it that you are actually trying to accomplish with this script?

For upgrades you could use the unattended-upgrades package and enable it for the MX repositories as well as the Debian security stuff, that would keep your system updated without you having to run any custom scripts. I've been using that method on the family laptop (currently still running Debian oldstable) and it's worked fine for several years now, I don't have to touch the machine at all.

In respect of autoclean, Debian stable based systems don't tend to accumulate large amounts of old .deb packages because the versions don't change. I suppose autoremove might be useful but only if you're in the habit of installing and then uninstalling stuff regularly.
mod note: Signature removed, please read the forum rules

User avatar
manyroads
Posts: 2657
Joined: Sat Jun 30, 2018 6:33 pm

Re: System Clean & Upgrade Script

#7 Post by manyroads »

Head_on_a_Stick wrote: Tue Dec 31, 2019 2:13 pm
manyroads wrote: Tue Dec 31, 2019 1:08 pm are you trying to be nice to me and say, 'don't do this?'
Erm, maybe a little bit :bagoverhead:

What is it that you are actually trying to accomplish with this script?

For upgrades you could use the unattended-upgrades package and enable it for the MX repositories as well as the Debian security stuff, that would keep your system updated without you having to run any custom scripts. I've been using that method on the family laptop (currently still running Debian oldstable) and it's worked fine for several years now, I don't have to touch the machine at all.

In respect of autoclean, Debian stable based systems don't tend to accumulate large amounts of old .deb packages because the versions don't change. I suppose autoremove might be useful but only if you're in the habit of installing and then uninstalling stuff regularly.
I think I'll just use my standard stuff and save a few keystrokes. I do actually install/ remove/ replace bunches of software. Maybe next year I'll be more stable. :rolleyes:
Pax vobiscum,
Mark Rabideau - ManyRoads Genealogy -or- eirenicon llc. (geeky stuff)
i3wm, bspwm, hlwm, dwm, spectrwm ~ Linux #449130
"For every complex problem there is an answer that is clear, simple, and wrong." -- H. L. Mencken

Post Reply

Return to “Tips & Tricks by users”