Upgrade Slackware: using slackbuilds as a backup option
As many of you I am currently preparing to install a fresh new version of Slackware. A tedious part of installing a new OS is saving my configurations and important scripts.
In order to ease this process I write a slackbuild that stores my configurations. It is available here. Test the script, add functions to store your important data, send feedback. Is public available for the Slackware community. |
The use of the lines:
USER=${USER:-$(whoami)} GROUP=${GROUP:-$(id -gn $USER)} HOMEDIR=${HOMEDIR:-$(eval echo ~${USER})} when using "su" to run the script return "root" as user (usuário root) and home of root as well instead of my user name and root, if you run without root it doesn't backup the root folder, and the script stops when it doesn't find the files called by one of the functions. But it's a good idea after some fixes. |
You can define the value of USER.
For example: USER=john; ./backup.Slackbuild Or you can change that value on USER in the file itself: USER=${USER:-$(whoami)} becomes USER="john". |
Quote:
|
I never intended to save root configurations.
I do not have any configuration in the root account. This works exactly like a slackbuild, and you may need to specify some variables. You can comment any function that you do not want to use: Quote:
This works like a slackbuils, but it is a much more personal script. I can not predict what each person wants to save. I will for a way to not stop the scritp when a backup function fails. |
Quote:
Code:
bash-4.2$ cd /root |
Quote:
Or run the script twice with two different users. In my free time I will try to add that feature. |
Quote:
|
Quote:
This way any person can add or remove backup functions. This script will never be one size fits all, but a base for personalized backup scripts. |
What I do is keep a file named /root/changed_files that I update with the absolute path of every config file, or script that I change or add, and also /root/ChangeLog in which I write notes to remind myself of what I've changed and why I changed it, along with any manual actions/commands that I need to take/run.
Then I just: # tar -cvf my_changes.tar -C / -T /root/changed_files The trick is to include both /root/changed_files and /root/ChangeLog in the list of files in /root/changed_files. When you come to unpack it, The only thing you have to be careful of is not to clobber anything system specific which might be different, such as /etc/fstab or lilo.conf, but that's easy enough to protect against: # tar -xvf my_changes.tar -C / root/changed_files # tar -cvf backup_existing.tar --ignore-failed-read -C / -T /root/changed_files # tar -xvf my_changes.tar -C / Anyway, that's how I do it. |
Quote:
My idea is to provide some type of automatic mechanism that is simpler enough to be used rapidly. The result was a slackbuild that creates a backup. Any other scripts designed for backup are more than welcome :) |
All times are GMT -5. The time now is 08:32 PM. |