Python to the Rescue

Should have started this effort with Python in the first place.

It was well intended, I wanted to avoid issues with runtime not being present.  The introduction of that worry though has made up for in time spent.  In just a few hours during my free time I was able to duplicate all of the work I did last week in bash on this in a way that is phenomenally cleaner, extendable, and more reliable.

I either really suck at bash or it just wasn’t the tool for this job.

So satisfying to see how quickly these dropped in after abstracting it all to the configuration file:

I currently have version checking.  Next there are two categories of environment checks that need to be made.  One is “this tool is a drop in replacement for this other tool, and one of them exist”.  The other is “this environment variable is set and is present in bashrc for both this user and root”.  Both will have remediation steps that are supplied much like the version command attribute for version checks in the json configuration file.  One of these types may need to exit the shell and respawn back into it after remediation though.  At least for one specific test.  Most of the environment variables I would be setting are placeholders for directories which can be variables in the python framework just as well.

After that is done it should download and extract the archives from the Surro source repo and begin building.  It may bootstrap into a bash script for all of this, but I’ll explore options in Python first.

Once RPM is in place it should chroot into the new build system and exit, providing yes/no prompts for remediation.