Rice for the sake of rice in an update script

This is just a way to make a simple script that runs our update commands. It serves no purpose, other than to look cool. It is tied to an alias that you can put in ~/.bashrc or ~/.bash_alias. Konsole is themed with OMDark.

As you can see, I call the script with the alias dsync

This is what the script looks like in Kate. To make it all line up correctly, Kate needs to use the same monospace font that Konsole uses. This is our default Liberation Mono. Kate is themed with OMDark.

The script is only several lines long, but the rest of the script is there for documentation of how it is done and color reference codes. These use the block of 16 colors that you see in neofetch or fastfetch. Here is the script in text form and as an attachment.

#!/usr/bin/bash

# File location /home/username/.local/bin/update.sh
# and can be called from the ~/.bash_aliases or ~/.bashrc file with this alias command
# alias dsync="~/.local/bin/update.sh" # dnf updates for OpenMandriva with log file
#
echo # This just adds blank line to separate these headers.
echo -e "\033[0;31m╔════════════════════════════════╗\033[0m" # Red for root.
echo -e "\033[0;31mβ•‘**Updating all System packages**β•‘\033[0m" # Red for root.
echo -e "\033[0;31mβ•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•\033[0m" # Red for root.
echo
sudo dnf clean all ; dnf clean all ; sudo dnf distro-sync --refresh --allowerasing 2>&1| tee dsync2-log.txt
echo
echo -e "\033[0;33m╔══════════════════════════════════╗\033[0m" # Yellow for user
echo -e "\033[0;33mβ•‘**Updating Flatpaks from FlatHub**β•‘\033[0m" # Yellow for user
echo -e "\033[0;33mβ•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•\033[0m" # Yellow for user
echo
flatpak update # Notice that the flatpaks are not installed as root.
echo
echo -e "\033[0;32m╔═════════════════════╗\033[0m" # Green for complete
echo -e "\033[0;32mβ•‘**Script Completed!**β•‘\033[0m" # Green for complete
echo -e "\033[0;32mβ•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•\033[0m" # Green for complete
echo

# There are some special characters used to make the boxes.
# β•” β•— β•š ╝ ═ β•‘
#
# Color References placed here for your convenience
# Reset
# \e[0;0m | NoColor
#
# Regular Colors
# Value    | Color
# -------- | ------
# \e[0;30m | Black
# \e[0;31m | Red
# \e[0;32m | Green
# \e[0;33m | Yellow
# \e[0;34m | Blue
# \e[0;35m | Purple
# \e[0;36m | Cyan
# \e[0;37m | White
#
# Bold Text Colors
# Value    | Color
# -------- | ------
# \e[1;30m | Bright Black
# \e[1;31m | Bright Red
# \e[1;32m | Bright Green
# \e[1;33m | Bright Yellow
# \e[1;34m | Bright Blue
# \e[1;35m | Bright Purple
# \e[1;36m | Bright Cyan

# Tip: Make sure your editor is using the same font as your terminal and it should be monospaced
# \e[1;37m | Bright White

update.sh.txt (2.3 KB)

When you download it, place it in ~/.local/bin/ and remove the .txt from the name. Make sure the file is executable.

Now, place this alias into your ~/.bashrc or your ~/.bash_alias file.

alias dsync="~/.local/bin/update.sh" # dnf updates for OpenMandriva

Or, you could call it with update by changing the alias to

alias update="~/.local/bin/update.sh" # dnf updates for OpenMandriva

Hint, before you ask how I get the little color squares to show up beside the colors in Kate, go to Settings > Configure Kate > Plugins > Color Picker. It will then show up at the bottom of that list and you can set the options for it.

Rice! It’s what’s for dinner.

4 Likes

Now that I have your attention.

Do not trust my script or any script from the internet. Open it and read it. Make sure you understand it before you run it. You are your best defense.

3 Likes

a nice update, i have been using your script since the very start -with a simple change (auto flatpak upgrade, that is)- THANKS!

2 Likes

It is extremely excellent looking :sunglasses:

@Hum_Had was using the previous version. This one added the double line boxes. Just a second helping of Rice.

1 Like

I will blindly trust this script, thank you

3 Likes

Anything that will help to get the newbies interested in bash scripting and just getting used to running the terminal is a good thing.

gucharmap as the name suggests is gnome stuff :stuck_out_tongue:

FWIW in kde we have kcharselect
sudo dnf install plasma6-kcharselect --refresh

Better or worse, I can’t say. Just for your information.

2 Likes

I did a dnf search and gucharmap was the only thing that showed. I am wondering if I am missing something.

@rugyada good to see you. Thanks.

1 Like

This has been updated on my GitHub as well.
GitHub - wilsonephillips/DNF-Update-Script: Simple update script with colors

1 Like

O.K. Let’s see what you can do with this script and the character map.

echo -e  prints the line to the screen
   |      sets the color                 sets the color
   |      |      color                    |    color
   |      |      |                        |    |
echo -e "\033[0;31m╔═════════════════════╗\033[0m" 
              |
             not bold
0=not bold or regular
1=bold or bright

Not gonna lie…I really like this. Pretty much for no other reason other than it looks pretty cool :joy:

2 Likes

Has anyone made any modifications?

1 Like

I’ve made a couple of modifications for mine. First, I compiled some apps using rust/cargo so I could get yazi (which means that once yazi is in the Rome repos, I can get rid of the rust stuff! :joy:). I added in the cargo-update command needed to keep those apps updated, and adjusted the colors so the β€œrust” stuff ended up being more of a β€œrusty” orange color :+1:

Next, I duplicated the script and changed the distro-sync command to β€œupgrade” for my computer that’s running Rock. So now I have a Rome-specific script, and a Rock-specific script.

2 Likes

Excellent!

1 Like

Very nice! I have been doing this, to include updating homebrew and my various distroboxes as well, and I just call it β€œupdate” and put it in ~/.local/bin/. However, it is not pretty like this.

2 Likes

For me, it was just a case of, β€œIt’s the terminal. What can we do with it?” I just made sure to document everything in it, so that someone who has never made any attempt can look at it and say, well maybe I can figure this out. Once we get a newbie interested, they lose the fear of the terminal.

4 Likes