purge-old-kernels deprecated

Bret Busby bret at busby.net
Sat Jan 7 18:40:33 UTC 2023


On 08/01/2023 02:09, Bret Busby wrote:
> On 07/01/2023 17:51, Bo Berglund wrote:
>> On Thu, 05 Jan 2023 19:54:21 +0100, Ralf Mardorf via ubuntu-users
>> <ubuntu-users at lists.ubuntu.com> wrote:
>>
>>> On Fri, 2023-01-06 at 02:09 +0800, Bret Busby wrote:
>>>> apt update
>>>> apt full upgrade -y
>>>> apt autoremove
>>>> apt autoclean
>>>
>>> My update script runs
>>>
>>>             sudo apt update $quiet$color && \
>>>             sudo apt-file update && \
>>>             sudo auto-apt updatedb && \
>>>             sudo auto-apt update-local && \
>>>             sudo apt full-upgrade $keepp$color && \
>>>             sudo apt autoremove $color;;
>>>         esac
>>>         printf "\nsudo mv -i /var/cache/apt/archives/* 
>>> /root/tmp_trash/\n"
>>>         sudo mv -i /var/cache/apt/archives/* /root/tmp_trash/
>>>
>>> that is more or less the same as you run, with one big exception. The
>>> content of the variables $keepp, $color is unimportant, since the
>>> content is at least not "-y".
>>>
>>
>> I don't understand the above commands fully, for example the esac and 
>> color
>> parts. Should esac not be preceded by case somewhere?
>>
>> But want to put the process into a script so it can be executed simply by
>> calling the script with sudo.
>>
>> After seeing the Bret Busby post I started writing this, will that 
>> work or do I
>> have to handle other stuff as well:
>>
>> ----
>> #!/bin/bash
>> # This script will do a full system update-upgrade-clean process
>> # It must be called using sudo with argument Y
>>
>> if [ "$1" != "Y" ]; then
>>    echo "Error! Call syntax: sudo $0 Y"
>>    echo "Try again!"
>>    exit -1
>> fi
>>
>> apt update
>> if [ $? != "0" ]; then
>>    echo "Unable to run apt update command! Exiting..."
>>    exit 1
>> fi
>>
>> apt full-upgrade -y
>> if [ $? != "0" ]; then
>>    echo "Unable to run apt full-upgrade -y command! Exiting..."
>>    exit 2
>> fi
>>
>> apt autoremove
>> if [ $? != "0" ]; then
>>    echo "Unable to run apt autoremove command! Exiting..."
>>    exit 3
>> fi
>>
>> apt autoclean
>> if [ $? != "0" ]; then
>>    echo "Unable to run apt autoclean command! Exiting..."
>>    exit 4
>> fi
>>
>> echo "System updated/upgraded successfully"
>> exit 0
>> ----
>>
>> Grateful for comments!
>>
>>
> I think that a simpler way, is to do the following.
> 
> Run the combined command
> 
> sudo apt update && sudo apt full-upgrade -y && sudo apt autoremove -y && 
> sudo apt autoclean
> 
> and then, when you want to run it again (providing that you do not apply
> clear history
> ), simply, at the command line, use the up arrow (keep pressing it) to 
> step backward through the command history, until that combination 
> command is found, then, apply it.
> 
One additional thing, that I should have included here, that also, makes 
that last part above, simpler, is that I also keep a number of separate 
terminal windows open; one for each application, which means that I need 
only use one or two key presses of the up arrow, to re-invoke  a 
command; so that I have one terminal window for alpine, one for system 
commands, like the system update combination command, one for youtube-dl 
(for each path to which I download videos; one for videos from 
television stations, one for cooking videos, one for genealogy videos, 
etc, etc,etc, each of which, is downloaded into a separate pathway), 
and, apart from when a system reboot is required, such as when a kernel 
upgrade is performed, usually, only one up arrow key press is required, 
to re-invoke the applicable command.

..
Bret Busby
Armadale
West Australia
(UTC+0800)
..............




More information about the ubuntu-users mailing list