• Linux
  • April 2019
    M T W T F S S
    « Mar   May »
  • Meta

  • Follow me on Twitter

  • Advertisements

My Config Files

Over the past few months, I’ve seen a few ways to keep backups of my important configuration files. The idea of setting up a git bare repository interesting and I’ve seen a couple of ways to implement it but I haven’t done it yet.

What I have done is create a folder in a directory that get synced to all of my Linux computers to hold copies of my configuration files and I wrote a script to back them up to that directory on my main system. I consider the configuration files on my main system to be the master copies. Where there I variations I save them with an appended file name. For instance, I have three different versions of nano on my network, one for Mint 18.3, 19.1, and LMDE 3. Each of them supports different options and syntax highlighting.

Yesterday, I created a script to copy my modified configuration files into my home directory. The script is menu-based so it only copies the files I want. If I need to copy more than one file, it continues to offer me choices until I choose the option to quit.

I wrote functions to handle each configuration file option and made allowances for different versions of a file or special situations. In the function that copies the .nanorc, it checks the version of nano on the computer and copies the appropriate .nanorc file.

At the moment I two systems running Debian-based distributions, Linux Mint Debian Edition and MX-Linux. On both of these systems I’ve had problems with making sure my ~/bin directory was added to my path if I had logged in to the GUI login. Previously, I had gone into the terminal’s preferences and had it run as a login shell.

The function that handles the .bashrc checks /etc/os-release to see if the distribution is based on Debian or Ubuntu. If it’s Debian, after it has copied the .bashrc file, it appends it with two lines to check for the existence of ~/bin and add it to the path if necessary.

I haven’t thoroughly tested it yet but I’m certain it will work properly. I’ll proofread it and I might still tweak it a bit. Sometimes I see things differently when I put it aside for a while.


One Response

  1. Today I tested the script on my Panasonic ToughBook which is running MX Linux. When testing the function to copy the .bashrc, I noticed that the lines to add the ~/bin directory were not being copied. I discovered that its os-release file is in a slightly different format than in Mint or LMDE, probably because it’s closer to Debian than LMDE.

    I checked the results of running lsb_release -d on Linux Mint 18.3, Linux Mint 19.1, LMDE, and MX Linus. In both of the Ubuntu-based versions, the second field of the line was “Linux” while LMDE and MX Linux it was ‘LMDE’ and ‘MX’, respectively. I changed the variable to get the second field of the lsb_release -d results, then tested for either LMDE or MX. If it was either, then the lines to add ~/bin to the path were appended to .bashrc.

    There were also a few smaller error such as missing brackets and some typos. I finished my testing on the ToughBook and everything with the script seemed to be working fine. The script should work quite well with the distributions I’m working with now which are based on Debian or Ubuntu. I expect that I may have to modify the cp_bashrc function to accommodate other distributions.

Comments are closed.

%d bloggers like this: