Hi Everyone.
TLDR; I made an update helper script for performing updates, and generating a precompiled forum post if there were errors. Give it a go. Link and installation instructions below.
After spending quite some time on here, on the forum, I started noticing a pattern when updates happen. Usually after the update, when support is being asked, the people trying to help always have to request the same information. Hence me thinking that it can be scripted, seeing as it’s so repetitive. Also, if the information requested is present before the first person replies, it should cut the support time considerably, since then there is no need for back-and-forth for basic things.
Couple that with a desire to learn bash, and viola! I saw an opportunity to contribute, both to my favorite Linux distribution as well as myself.
So, I present My Universal Manjaro Update Helper.
(Or, mumuh
if you will.)
It’s simple really. The steps it perform are:
- Makes a backup snapshot of your current system.
By default it uses Timeshift to perform the backup, but it does have the ability to specify a different command. - Checks for and prompts to install any updates from the official repositories.
The updates are, as of yet, only a wrapper topamac
. I prefer to usepamac
instead ofpacman
because it takes care of a lot more things automatically thanpacman
. - Using
pamac
once again, it rebuilds updates any AUR packages.
Once again, I usepamac
for the reason mentioned above. And also becausepacman
itself cannot work with, build, rebuild or upgrade packages from the AUR. Therefore, an AUR helper is necessary. Enterpamac
. - When done, it checks for and provides the option to merge any
.pacnew
files. - If any errors occurred, it copies a generated forum post to the clipboard with
xsel
, which contains a whole bunch of information, which can be used to start a forum post.
To install it:
- First step is to clone the repository:
mkdir /tmp/mumuh && cd /tmp/mumuh && git clone https://github.com/Mirdarthos/manjaro-update-helper.git
This will clone it and cause all subsequent actions to be performed in /tmp
. which is temporary and will be deleted on shutdown. But don’t worry, the installation will be permanent. Adjust this as you see fit if you wish.
- Then change to the directory it just created:
cd manjaro-update-helper/
- Then install the package:
makepkg --syncdeps --install
Or, you can download the script wherever you want to:
wget https://raw.githubusercontent.com/Mirdarthos/manjaro-update-helper/master/src/usr/bin/mumuh
Then set it as executeable:
chmod u+x mumuh
And execute it directly:
./mumuh
Simply delete the file if you want to remove it:
rm mumuh
To uninstall it:
While I’ve searched high and low for doing this with makepkg
, I was unable to figure it out. It’s quite simple really, so doing it manually iss quite easy, just run:
sudo rm --force /usr/bin/mumuh
To run it:
mumuh --help
Example:
$ mumuh --help
######################################################################
################### Manjaro update helper script.#####################
######################################################################
# This script is just a wrapper for pamac, with the exception that #
# if there were any errors, it allows you to copy them, neatly #
# formatted for use as. or with a forum post, along with all the #
# details required for requesting assistance. #
# It also allows you to set the required suddoers permissions in #
# '/etc/sudoers.d' #
# #
# Usage: #
# * --addsudoers, or -a #
# Will add a file called /etc/sudoers.d/manjaro-update-helper #
# with entries to enable running this script as the current #
# user without a password. #
# CARE MUST BE TAKED WITH THE /etc/sudoers FILE, AS DOING IT #
# INNCORRECTLY CAN LEAD TO BEING LOCKED OUT OF THE SYSTEM. #
# PLEASE BE VERY CAREFUL. #
# * --skipbackup, or -s #
# This will cause the update process to skip the backup step #
# for the update. #
# * --custombackupcommand, or -c #
# * This argument allows for specifying a custom backup command, #
# for if you want to use something other than the default #
# timeshift one, or even is you use something other than #
# timeshift. #
# NOTE: #
# If --skipbackup, or -s is specified, then specifying this #
# will have no effect. #
# * If no arguments are passed, the script performs its main #
# functionality. #
######################################################################
Link:
I’m absolutely sure there are things, a lot of things, that can be done differently, or even better. Feel free to pass suggestions along
Please note:
There are many places in the script that can use shorthand. For example, this:
pamac --version 1> /dev/null 2> /dev/null
instead of this:
pamac --version 2&1> /dev/null
There are 3 reasons for that:
- Legibility and clarity.
@Fabby has mentioned once that the first is easier to read and understand than the second, and I find it true, especially as a newcomer to bash. So I’m sticking with it. At least for now. - I’m attempting to learn bash, and the longer, more clear commands is easier for me to learn, understand and then use.
- Someone else might take a look at the code, possibly out of curiosity, possibly having to jump in and maintain it or even to contribute. Which ever it is, it’s not just me I have to think of here. So I try to be as clear as possible, and not learn, get used to and rely on magic.
Edit:
Based on this, by @dmt:
To uninstall:
It must be uninstalled witth a package mager, apparently, so uninstall it with:
pamac remove my-universal-manjaro-update-helper
But then the /usr/bin/mumuh
file still remains, so remove it with:
sudo rm --force /usr/bin/mumuh
I suspect I’ll have to create a .install
file for this with that removal inside. Unless I’m somehow mistaking it. Or doing something wrong, which is also quite the possibility.