update-manager: terminal-based version
David Hedlund
public at beloved.name
Fri May 19 00:06:19 UTC 2023
I expect that there are some useful terminal packages or script that are
performing the same thing as the update-manager GUI. If you are aware of
any such solution, please give me the name of the software.
If not, then it would be useful to make a clone of update-manager that
could be either part of, or packaged, for Ubuntu. Just to try it out, I
wrote a bash script (just execute it, and run the alias `u` to try it),
see the attached file. However, I'm not satisfied with it, because it's
not yet a full-feathered /clone/ of update-manager:
Which commands are executed when:
* update-manager is opened:
* I'm confident that this is the first executed command: sudo
apt-get -y update
* Then packages are listed, exactly which command is executed to
figure this out?
* The "Install Now" button is clicked on. Examples, which of these
commands are executed, and in which order (please quote with source code
and file names as references)?:
apt-get upgrade
apt-get dist-upgrade
apt autoremove
apt clean
apt full-upgrade
Is something else executed?
* /var/run/reboot-required is used to determine if the GUI should
display a button used to restart the distro
UpdateManager.py[1]
----------->8--------------
# file that signals if we need to reboot
REBOOT_REQUIRED_FILE = "/var/run/reboot-required"
----------->8--------------
1: git clone git://git.launchpad.net/ubuntu/+source/update-manager &&
grep -r "reboot-required" .
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/ubuntu-devel-discuss/attachments/20230519/4e72eee4/attachment.html>
-------------- next part --------------
#!/bin/bash
# Copyright 2023 David Hedlund
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
tee ~/.bash_aliases > /dev/null << 'EOF'
debian_family__check_if_reboot_is_required() {
debian_family__check_if_reboot_is_required__command="reboot";
if [ -f /var/run/reboot-required ]; then
cat /var/run/reboot-required
while true; do
read -p "Execute \`$debian_family__check_if_reboot_is_required__command\` (y/n)?: " yn
case $yn in
[Yy]* )
$debian_family__check_if_reboot_is_required__command
;;
[Nn]* )
break
;;
* )
echo "Please answer yes (y) or no (n)."
;;
esac
done
fi
}
EOF
echo "alias u='sudo apt-get -y update && sudo apt-get -y dist-upgrade && sudo apt -y autoremove && sudo apt clean && debian_family__check_if_reboot_is_required'" >> ~/.bash_aliases
source ~/.bash_aliases
More information about the Ubuntu-devel-discuss
mailing list