• Linux
  • May 2024
    M T W T F S S
     12345
    6789101112
    13141516171819
    20212223242526
    2728293031  
  • Meta

Penultimate Day 2023

I guess I was busy this year. I messed around with bash scripts a lot; writing them, modifying them, and even abandoned a few.

When I first changed my GitHub access to use SSH, I couldn’t get it working right, so I put it aside for a while, and eventually set up a local Gitea server (October 2022). This past October, I found some information that finally made GitHub usable for me again. Since my scripts repository hadn’t been touched in well over a year, I deleted all of it, and pushed some of my current scripts to it. I’m not putting all of my bash scripts on GitHub, only some that I think might be useful to others. A lot of my scripts are specific to my personal computing environment.

In the past few months, I’ve been messing around with tar as a means of archiving my financial records and my scripting projects. Now I have several incremental backups running every day. I was kind of surprised at how easy it is to work with and setting up the incremental backups was relatively painless.

Speaking of backups, I did a lot of work on my backup script based on Joe Collins’ script. I set it up mount the USB backup drive if it’s not automatically mounted. I needed that capability on my Debian i3 machines until I found a utility that would automatically mount USB drives. For a few machines where I take regular snapshots, I have it set up to recognize if the correct backup drive has been attached. I also replaced the original nested if statements with case statements for better efficiency.

Another small project of mine was to write a couple of scripts to work with downloaded ISO files. When I download an ISO from a distro’s web site, I also down its SHA checksum. My verify-iso script verifies that the checkums match. The write-iso script writes the ISO to a thumbdrive using the dd command. The scripts lists the available files and the writing script lists available removable media that can be written to.

I’ve been expanding my use of i3 on Debian. I have several laptops and a couple PCs running it on Debian 11 which I plan to upgrade to Bookworm. On the Bullseye system, I originally used Bumblebee Status as my status bar, and I’ve replaced it with Polybar. I have one laptop with an external monitor attached to play around with i3 on multiple monitors.

My son bought my wife a new computer for Christmas, and I had the pleasure of setting it up. It wasn’t nearly as painful as it used to be when I built them. Even copying her files over went rather well. Her Windows 10 computer had been acting up a lot for a while. It was slow and would often lose its network connection and the connectinons for everything else on that switch. A couple of months ago, I started setting up Linux Mint on one of my better machines, getting ready for the day her Lenovo finally died. The new machine is working well for her. It’s running Windows 11 Home which is adequate for her needs and works well in my network environment.

My Scripts for ISOs

I’ve never really been into distro-hopping, but I do occasionally put different distros in VMs or actual hardware. I currently run Debian, Linux Mint, Linux Mint Debian Edition, MX Linux, and BunsenLabs on different machines. I keep current ISO files for these distributions as well as a few others that look interest me.

I haven’t always checked the ISO files I download against the checksum files. It seemed like a hassle to do it, but I always confirm that the files I download are genuine.

When I need to install a distro on a laptop or desktop, I generally need write the ISO to a USB stick. Some distros, like Mint, have a utility for that, but I’ve found that it’s not always reliable. I’ve copied ISO files to a USB drive with Ventoy installed, but my experience with Ventoy has been rather disappointing. Sometimes it works, and sometimes it doesn’t.

The most consistent method I’ve found, particularly for Debian and Debian-based distributions, has been using dd to write the ISO to a USB drive. As everyone knows, dd is potentially dangerous.

To deal with these problems, I’ve written a couple of scripts to verify and reduce the risks. They aren’t fullproof, but they’ve worked well for me.

My check-iso script displays the ISO and checksum files in a directory and prompts me to enter the appropriate files. I can either type them in, but I usually highlight the file with my mouse and use the center-click to copy it to the prompt. I don’t know if that works in all terminals, but it works in Kitty and Terminator. The script then compares the two checksums and tells me whether they match.

When I download an ISO file from a distro’s website, I get the checksum and put it in a file whose name identifies the distro and the type of checksum, for example, distro-iso.sha256. If the site’s checksum file contains checksums for multiple versions, I’ll break that file down into individual files for each because my script reads the first field on the first line.

The write-iso script lists the available ISO files and a prompt. Then it checks to see if a USB drive is attached and mounted, and lists the available removal media with its capacity. The user enters the appropriate device at the prompt and is prompted to confirm the choice which must be explicity answered with yes or no.

When it comes to scripts, like a poem, they’re never finished. Most of the time, they’re abandoned when they’ve outlived their usefulness or I find something else that does the job better.