Post by fidoedidoe on Jul 30, 2020 9:32:49 GMT
Hi there
If you're seasoned Linux / CLI user then this is probably not for you....if you're new to Linux / CLI (or just plain lazy like me), read on...
I've a "new to Linux" friend (coming from windows) who wasn't keen on getting into CLI right from the outset (slow and steady wins the race!). To help them embrace Linux/Bodhi I created a small "one click" bash script, accessible from the application menu / iBar, to:
If you're interested in using/adapting the script it can be found on github: apt-update-plus-cleanup.sh. In my instance I created a new folder/file under your $HOME folder named "bash-scripts", ie:
If you are unfamiliar with github (use of git is outside the scope of this post), the simplest method to recreate the script file is to:
Now the script is executable, to test: open the Terminology app and run the command below (if you have issues recheck your steps):
To compliment the above (this is for the "lazy", ie: point and click operation) you can additionally create an associated ".desktop" file which, once created, allows the script to be invoked from the menu applications/ system tools. This step also allows you to create an iBar entry for "one click" operation. To create the desktop file use nano, leaf or any other installed text editor. For consistency, save the file as: "apt-update-plus-cleanup.desktop" and save it to the following location/name:
The content of the apt-update-plus-cleanup.desktop file should be:
NOTE: The content of apt-update-plus-cleanup.desktop file assumes the following:
Usage:
If you're seasoned Linux / CLI user then this is probably not for you....if you're new to Linux / CLI (or just plain lazy like me), read on...
I've a "new to Linux" friend (coming from windows) who wasn't keen on getting into CLI right from the outset (slow and steady wins the race!). To help them embrace Linux/Bodhi I created a small "one click" bash script, accessible from the application menu / iBar, to:
- refresh the Bodhi repos
- run apt (repo) update / upgrade or dist-upgrade
- run apt autoclean & autoremove
- check for snap store/flat pack updates (if installed), and purge old versions where necessary
If you're interested in using/adapting the script it can be found on github: apt-update-plus-cleanup.sh. In my instance I created a new folder/file under your $HOME folder named "bash-scripts", ie:
~/bash_scripts/apt-update-plus-cleanup.sh
If you are unfamiliar with github (use of git is outside the scope of this post), the simplest method to recreate the script file is to:
- Click the github link, switch view mode to "raw" copy / paste into a new file on your Bodhi install named: apt-update-plus-cleanup.sh, using a text editor of your choice (nano, leaf, etc) and save to the location mentioned above (ie: $HOME/bash_scripts/)
chmod ug+x ~/bash_scripts/apt-update-plus-cleanup.sh
Now the script is executable, to test: open the Terminology app and run the command below (if you have issues recheck your steps):
sudo ~/bash_scripts/apt-update-plus-cleanup.sh
To compliment the above (this is for the "lazy", ie: point and click operation) you can additionally create an associated ".desktop" file which, once created, allows the script to be invoked from the menu applications/ system tools. This step also allows you to create an iBar entry for "one click" operation. To create the desktop file use nano, leaf or any other installed text editor. For consistency, save the file as: "apt-update-plus-cleanup.desktop" and save it to the following location/name:
~/.local/share/applications/apt-update-plus-cleanup.desktop
The content of the apt-update-plus-cleanup.desktop file should be:
[Desktop Entry]
Hidden=false
Exec=x-terminal-emulator --maximized --borderless --exec "bash -c 'sudo $HOME/bash_scripts/apt-update-plus-cleanup.sh --exit-prompt'"
Icon=/usr/share/icons/arc-green-icons-GTK/status/scalable/software-update-available.svg
Type=Application
NoDisplay=false
Version=1.0
StartupNotify=false
DBusActivatable=false
Categories=System;
Terminal=false
Name=Check for Bodhi Updates
Icon[en_US]=/usr/share/icons/arc-green-icons-GTK/status/scalable/software-update-available.svg
Name[en_US]=Check for Bodhi Updates
NOTE: The content of apt-update-plus-cleanup.desktop file assumes the following:
- The bash script (taken from github) is located a folder named: $HOME/bash_scripts/
- The bash script is named: apt-update-plus-cleanup.sh
- The icon file: /usr/share/icons/arc-green-icons-GTK/status/scalable/software-update-available.svg exists on your system.
Usage:
- CLI: From the command line (assumes "~/bash_scripts" is where you saved the file)
sudo ~/bash_scripts/apt-update-plus-cleanup.sh <options>
<options>
-d | --dist-upgrade:
When included, instructs script to use "apt dist-upgrade" (rather than apt upgrade)
-e | --exit-prompt:
When included, Prompts to "press any key" to exit script. Useful when script is executed via desktop icon/menu
(where shell is closed on script completion), allows the STDOUT from the script to be read in a timely manner
before closure. Typically used when script is executed from a CLI. When omitted there are no prompts.
- Desktop: Assuming you created the "~/.local/share/applications/apt-update-plus-cleanup.desktop" file mentioned earlier, click Bodhi Menu icon (bottom Left), the launch icon is found under: Applications / System Tools and is named: "Check for Bodhi Updates".
If you want to modify how the script runs (ie: to use apt dist-upgrade instead of apt upgrade), edit the file "~/.local/share/applications/apt-update-plus-cleanup.desktop", search for the line "Exec=..." and change it from:Exec=x-terminal-emulator --maximized --borderless --exec "bash -c 'sudo $HOME/bash_scripts/apt-update-plus-cleanup.sh --exit-prompt'"
..changing it to:Exec=x-terminal-emulator --maximized --borderless --exec "bash -c 'sudo $HOME/bash_scripts/apt-update-plus-cleanup.sh --dist-upgrade --exit-prompt'"
(notice the parameter used towards the end of the command line):
Optional:
- Add launch icon to iBar:
Assuming you created the "apt-update-plus-cleanup.desktop" file, create an iBar entry for "one click" operation. Right click on the default iBar (bottom left). Select "iBar" / "Contents", select the entry named "Check for Bodhi Updates" under the applications list, and click "Add". Depending on preference, you can reorder the position of the entry using the "order" in the same dialog box. Select "Check for Bodhi Updates" entry and click "up" / "down" to move position on the iBar as desired.