RescueBRU System - Rescue CD Backup & Restore Utility Rod Wright  
CHANGELOG  
########################################################################
General changes: 
------------------------------------------------------------------------
02/11/2016 - 7.2.1 - Changed default startup mode from text mode to
graphical (Xorg) mode. Fixed some things that were missing from the boot
menu and re-ordered options to make more sense. Created a /mnt/usb
directory so some procedures would work correctly. Updated the RescueBRU
User Guide to reflect changes.

06/27/2018 - 7.2.2 - Updated System Rescue CD version to 5.2.2 to
provide kernel support for newer hardware.

03/19/2021 - 7.2.3 - No changes.

09/21/2021 - 7.2.4 - No changes.

01/19/2024 - 7.2.5 - Changed scripts in /etc/init.d to prevent dhcpcd 
from running automatically at boot. This makes RescueBRU play nice in 
networks with other DHCP servers by not unnecessarily grabbing up leases
unnecessarily. We will let rescuebru.sh acquire addresses later under 
its own control.

########################################################################
rescuebru.sh: 
------------------------------------------------------------------------
05/06/08 - 1.0 - Initial Release  

05/09/08 - 1.1 - Added prompting for MBRs and partitions. Added 
Help. Added media creation.  

05/16/08 - 1.2 - Fixed bug where partition array was not being 
created correctly when multiple drives were present. Added error 
detection on backup and restore. Added backup media capacity 
detection and warning. Added backup and restore of extended 
partition information. Updated help files. 

05/24/08 - 2.0 - Added support for HP CISS controller devices. Added 
NFS media support.  

06/05/08 - 2.1 - Added support for Adaptec I2O SCSI controller 
devices. Improved client IP address deconfliction. Added support to 
restore linux swap partitions. Fixed unreliable detection of 
extended partitions.  

06/10/08 - 2.2 - Added "-M" (--no-mbr) to PI_BACKUP_ARGS for 
partimage since it was causing trouble with Adaptec I2O controller, 
and we back up MBRs separately anyway.  

06/12/08 - 2.3 - Added "--force" option to arguments for sfdisk 
restoration to prevent failure caused by restoring existing table.  

07/01/08 - 2.4 - Added line to kill off netplugd before we start, 
since we don't need it and it interferes with server detection on 
some machines. Added support for backing up to a local directory.  

07/02/08 - 2.5 - Added a 5 second sleep after setting up a network 
interface to give any network switches time to recognize and route 
us properly.  

07/23/08 - 2.6 - Improved Local media type for general use. Added 
integration with new rbruserver script. Fixed main menu to catch 
garbage user input.  

08/13/08 - 3.0 - Upgraded sysresccd to version 1.0.4. Improved exit 
options. Now you can exit to shell, exit and reboot, or exit and 
power off. Added operation logging so it's easy to tell if something 
failed. Added backup method menu. Standard is dd/sfdisk/partimage. 
Verbatim is dd of whole drive, compressed and split into 2G files.  

05/13/09 - 3.1 - Fixed net_setup function to stop testing interfaces 
after it finds a working one. Create /var/lib/nfs/state file so nfs 
startup script won't complain. Removed Adaptec i2o specific code 
since sysresccd version 1.0.4 names the devices correctly. NOTE: 
BACKUPS DONE WITH VERSIONS OF RESCUEBRU PRIOR TO 3.0 THAT CONTAIN 
I2O DEVICES CANNOT BE RESTORED WITH VERSIONS 3.0 OR LATER. REDO 
THOSE BACKUPS! Fixed bug where a failure to find a server loops you 
back through the net setup code again. Removed prompts to save log 
file when rebooting or powering down since anything saved in the 
ramdisk will disappear anyway. Added option to view log files on 
backup media.  

10/22/09 - 4.0 - Added progress indicating for verbatim 
backups/restores. Removed arbitrary limit to number of clients 
(since it was easy to fool anyway). Added conv=sync,noerror to dd 
arguments in vbbackup function to ignore disk errors and replace bad 
blocks with nulls. Shortened timeouts in the network code to speed 
things up a bit. Changed network interface scanning to start with 
short timeouts and gradually increase them so we can work with slow 
NICs, but not take too long on fast ones. Added a prompt for the 
initial IP address so that multiple users can work on the same 
network without IP collisions. Removed the backup media and backup 
method submenus and replaced them with simple prompts to make them 
less unwieldy. Moved the restore and backup processes out of the 
main menu and into functions. Fixed bug that caused incorrect 
behavior when "quit" was supplied as an image name. Removed prompt 
to save temporary log file on exit to shell. Save temporary log by 
default. Removed prompting to save a log with the backup. It's a 
good idea to save the logs and sometimes it was accidentally not 
saved. Fixed bug in logview function that caused weird behavior on 
subsequent calls of the function. Don't delete existing backup 
before starting new one, so if something goes wrong, we're not 
screwed. When prompting for IP addresses, after the backup server 
address, only prompt for the host byte to make entries easier.  

2/16/10 - 4.1 - At end of backup, copy new backup over old one 
before displaying log to avoid long delays. Detect and abort on NFS 
share mount failure. In function net_setup(), ping more during 
"determine ip" phase to accommodate slower hardware. In function 
mbrrestore(), removed untrue statement that associated partitions 
couldn't be restored. At beginning of function net_setup(), unmount 
any stale NFS mounts and take down any interfaces that are already 
up. Put "then" and "do" on the same line as their starting 
statements so auto-indent works properly in IDE. Fixed bug where 
status file wasn't getting written if $remote_dir was different than 
$MEDIA_MNT_DIR. In function net_setup(), improve interface scanning 
to increase the number of pings in each step and decrease the number 
of steps since some slower NICs were still not coming up. In 
function net_setup, changed sleeps and pings wherever link is 
brought up to sleep and ping longer based on the timeout required to 
find the server. This should prevent NFS mounts from failing on slow 
NICs. Modified function partbackup() to save UUID info to image file 
for linux swap partitions. Included static binary mkswap-uuid to 
enable setting UUID on swap partitions. Modified function 
partrestore() to set UUID when restoring swap if UUID info is 
available, otherwise let mkswap generate one. This prevents swap 
mount failure on distributions (like Ubuntu) that mount swap based 
on UUID instead of device name.  

2/25/10 - 5.0 - Updated System Rescue CD to version 1.3.5. Stripped 
unneeded packages to get iso size down enough to run docache by 
default. Added docache and lowmem as boot parameters. Edited 
/bin/bashlogin and f1boot.msg to reflect new versions/dates. Added 
code to mbrbackup(), partbackup(), and vbbackup() functions to save 
output of fdisk -l for each drive for comparison on restore. Added 
code to driveselect() and partselect() funtions to compare sizes of 
original and current drives and issue warnings as required.  

6/11/10 - 5.1 - Moved CHANGELOG off to a separate file since it was 
getting so huge. Found that Adaptec i2o support is a moving target. 
With the current kernel, it's back to /dev/i2o/hdXX. Put the i2o 
specific code that I pulled out for version 3.1 back in. IF YOU HAVE 
BACKUPS OF MACHINES USING ADAPTEC I2O CONTROLLERS THAT WERE DONE 
SINCE VERSION 4.0, YOU WILL NEED TO MANUALLY RENAME THE FILES IN 
THOSE BACKUPS TO REFLECT THE NEW DEVICE NAMES, OR JUST DO NEW 
BACKUPS! Added option to select what you want to do after a 
successful backup or restore (return to menu, reboot, or shut down). 
Reworked dobackup() and dorestore() to remove excessive loop 
nesting. Fixed bug where new backups log files were getting dumped 
into the $IMAGE_PATH directory. Added the ability to abort network 
scanning after the normal scan so you don't have to wait for the 
long and extra long scans to complete to get back to the menu.  

9/9/10 - 6.0 - Updated System Rescue CD to version 1.5.8. Set up 
boot menu and autoruns to eliminate typing commands at shell 
prompts. Fixed bug in rescuebru.sh netscan_timeout() where pressing 
a didn't abort scan. Added scripts to rename backups when the 
Adaptec i2o driver changes device names. If you get errors when 
trying to restore like "device not found", run the appropriate 
script on the server to fix things.  Added PXE boot server 
capability to rbruserver.  

1/6/11 - 6.1 - Updated System Rescue CD to version 1.6.4 to get 
updated tg3 driver. In rescuebru.sh, updated vbbackup() and 
vbrestore() to use pv for progress indication.  

11/29/11 - 6.2 - Swap partitions created with old versions of mkswap 
didn't have UUIDs, so on backup, the file generated by blkid didn't 
contain UUID. This caused failure on restore. Fixed the swap 
creation in rescuebru.sh:partrestore() to detect this condition and 
do the right thing. If aborting network scanning once, was unable to 
abort it in subsequent passes. In rescuebru.sh, fixed 
netscan_timeout() to unset the $nsa loop control variable at start. 
Fixed some typos in isolinux.cfg.  

7/3/12 - 6.3 - Added flush_input() function to drop spurious user 
input between prompts. Added y_or_n() function to standardize, 
simplify, and validate yes or no prompting. Removed mkswap-uuid 
since new mkswap implements UUID setting. Removed ddprog since we 
don't use it any more. Renamed backup methods to reflect what they 
actually do. Added inline help for media type and backup method 
selections. Added fsarchiver backup method. Fixed bug where USB 
backup media wasn't being excluded from drive/partition selection 
prompting. Fixed bug where the initial boot menu wasn't starting the 
pxeboot server when option 7 was selected. Modified the build tools 
to put a copy of /root/rescuebru in the root of the ISO file system 
so you could see the scripts without having to boot the CD.  

9/14/12 - 6.3.1 - Added check_route() function to work around slow 
behavior of certain Cisco switches in setting up routes.  

1/16/13 - 7.0 - Added function to display selected actions before 
beginning an operation and prompt for confirmation. Also check for a 
backup where nothing is selected. Previously, this would succeed, 
resulting in a backup of nothing potentially overwriting an existing 
backup. Added clone.sh and blank.sh command line utilities. 
Integrated those two utilities into the RescueBRU menu structure. 
Moved functions that have a common usage among various RescueBRU 
components to a separate functions.sh file. Integrated CHANGELOGs 
from the multiple utilities into this file. Fixed bug where 
arguments passed in from rbruserver were not being parsed correctly 
resulting in the local RAID devices not being excluded. Changed name 
of functions vbbackup(), vbrestore() to ddgzbackup(), ddgzrestore() 
to match the new method naming scheme. Save S.M.A.R.T. data for 
drives during backup so that useful drive info may be obtained. When 
backing up, save drive sizes in separate files instead of trying to 
extract it from the fdisk -l output. Save partition size information 
as well as drive size information. When creating directory for 
backup, if directory already exists, and user elects not to 
overwrite, the getimagename() function is called again instead of 
just aborting out and having the user start all over. Enabled 
pausing of various operations. Automatically eject the CD after 
booting to rescuebru or rescuebru in xorg options. Completely 
revamped the menu layout of rescuebru. Moved all program settings 
(media type, backup method, and action after successful operation) 
to a Settings submenu. Created a Disk Utilities submenu for cloning, 
blanking, badblocks testing, and media setup. Changed the constant 
menu options (help, exit) to letters to prevent having to renumber 
them if new options are added in the future. Reorganized funtions to 
make them easier to maintain. Standardized all menu code to case 
statements using regular expressions instead of unwieldy "if then 
elif then" statements with cumbersome test constructs. Updated all 
help documentation to reflect changes.  

1/2/2015 - 7.1.0 - Complete rewrite of rescuebru.sh. Implemented 
dialog based user interface. Network configuration is now automatic 
using DHCP. Changed the standard IP addressing scheme to 10.111.x.y. 
Added ability to save notes and version numbers with a backup. If 
overwriting a previous backup, preserve notes/logs from the existing 
backup. If a notes template is present on the server, loads that 
into the note edit dialog. Added image management functionality 
(copy/delete/rename) that was previously only available in the 
server. Backup method is now determined automatically by default for 
each partition individually based on the contents. Fixed numerous 
bugs. Removed scsi-i2o conversion scripts because the systems they 
were written to support are no longer available to test against. If 
the problem returns (can only happen with a new SystemRescueCD 
version), the suggestion is just to do new backups of the affected 
systems. Updated help files.

2/19/2015 - 7.1.1 - Critical bugfix and minor feature release. Fixed 
bug in do_restore() where size warning code caused abort for backups 
done of HP CISS devices. Added ability to specify compression levels 
of backups. Changed hotkeys for help options in menus from "H" to 
"?" to avoid conflicts with other menu options. Fixed bug where 
smartctl output was not being parsed correctly resulting in messages 
like "Previous device was: (blank)" during restore.

3/10/2015 - 7.2.0 - Updated SystemRescueCD to version 4.5.1 to make 
use of new megaraid driver device support. Added support for GPT 
partition tables. Added support for booting machines with UEFI BIOS.

2/11/2016 - 7.2.1 - Xorg mode is now the default mode and includes a 
backup media capacity monitoring window. Modified the xrescuebru.sh 
script to disable screen blanking. Validate the version input text
to prevent failure to display available backups. Fixed bug where 
auto_net_setup would report no carrier where it did in face exist.

06/27/2018 - 7.2.2 - No changes.

03/19/2021 - 7.2.3 - Added support for NVMe devices.

9/21/2021 - 7.2.4 - Fixed bug in getimages() function where gpt
partition table images of NVMe devices were not being offered as
selections to restore, resulting in failed restores with new drives.

01/19/2024 - 7.2.5 - Added option to the settings menu to set the backup
server type. The options are “RescueBRU Server” (the default) and 
“any DHCP server”. Also changed the auto_net_setup() function to only 
attempt to get a DHCP address based on the backup server type selected 
in settings. This is to prevent attempts to get an IP address from any 
available DHCP server in the event that getting one from a RescueBRU 
server fails. This makes RescueBRU play nice on networks that have DHCP 
servers by not grabbing up leases unnecessarily. If you need to use 
RescueBRU with the NFS storage type, but you don’t have a dedicated 
RescueBRU Server running, you’ll need to go into settings and explicitly
enable promiscuous DHCP by changing the backup server type. Added an
option to the settings menu to specify the remote NFS share name in case
we are using a non RescueBRU NFS server but still use the auto net
setup type to get our address.
 
########################################################################
rbruserver.sh: 
----------------------------------------------------------------------
07/23/08 - 1.0 - Initial Release  

08/12/08 - 1.1 - Added code to server_start to clean up stale client 
mark files.

08/27/08 - 1.2 - Incorporated improvements to mainmenu()  

04/30/09 - 1.3 - Added code to intelligently determine RAID array 
members instead of hardcoding them.  

05/14/09 - 1.4 - Added code to create /var/lib/nfs/state file so nfs 
startup script won't complain. Added capability to view log files. 
Improved exit options so they match rescuebru and are not confusing. 
Added raidtest function to show RAID status on startup and with a 
menu option.  

10/21/09 - 1.5 - Changed raidtest function to use mdadm instead of 
just cat'ing and parsing /proc/mdstat. Start server by default on 
program start. Fixed bug in logview function that caused weird 
behavior on subsequent calls of the function. Added ability to show 
connected clients and their status.  

9/7/10 - 2.0 - Add ability to start PXE boot script to act as a boot 
server.  

12/20/10 - 2.1 - Fixed bug in server_start that prevented network 
from being brought back up after a user stop/start.  

1/17/13 - 3.0 - Fixed bug where only the RAID partitions and not the 
entire drive devices were being passed to rescuebru when local 
backup/restore was selected. Removed functions that are duplicated 
in functions.sh. Moved change information to the commom CHANGELOG 
file. Consolidated the three image manipulation functions, 
image_copy(), image_rename(), and image_delete() into a single 
function, image_mod(). Cleaned up code structure. Changed the main 
menu exit options to letters to prevent having to renumber them if 
new options are added in the future. Combined image copy, rename, 
and delete options into an image management submenu.

1/2/2015 - 7.1.0 - Advanced the version number to match that of 
other scripts. Major rewrite of rbruserver.sh. Implemented dialog 
based user interface. Network addressing is provided to clients 
using DHCP. Server now uses all available interfaces in the machine, 
and serves IP addresses and NFS on all. By default, only provides 
DHCP responses to clients identifying themselves as "rescuebru". If 
PXE boot server is running, provides responses to all clients by 
necessity. Fixed bug where PXE boot server would send the server 
version of the configuration instead of the client version. Added 
capability to define a template for backup notes to guide users 
about what information to be entered in a note. Increased RAID 
stripe cache size to the max to improve RAID write performance.  
 
2/19/2015 - 7.1.1 - Advanced the version number.

3/10/2015 - 7.2.0 - Updated SystemRescueCD to version 4.5.1 to make 
use of new megaraid driver device support. Added command to kill 
dhcpcd at startup since we don't need to ask somebody for an IP 
address if we're a server. Added support for booting machines with 
UEFI BIOS.

2/11/2016 - 7.2.1 - Server now runs in Xorg mode. Implemented a 
RAID set capacity display. Implemented a fault monitoring display
and indication using the blue UID light on the server machine to 
indicate a fault.

06/27/2018 - 7.2.2 - No changes.

03/19/2021 - 7.2.3 - Added support for NVMe devices.

9/21/2021 - 7.2.4 - No changes

01/19/2024 - 7.2.5 - No changes.

########################################################################
clone.sh: 
------------------------------------------------------------------------
11/28/12 - 1.0 - Initial Release
 
1/2/2015 - 7.1.0 - Advanced the version number to match that of 
other scripts.

2/19/2015 - 7.1.1 - Advanced the version number.

3/10/2015 - 7.2.0 - Updated SystemRescueCD to version 4.5.1 to make 
use of new megaraid driver device support.

2/11/2016 - 7.2.1 - Changed the input and output block sizes used by
the dd command from the default (512 byte) to 4096 byte to increase
clone speed.

06/27/2018 - 7.2.2 - No changes.

03/19/2021 - 7.2.3 - No changes.

09/21/2021 - 7.2.4 - No changes.

01/19/2024 - 7.2.5 - No changes.

########################################################################
blank.sh: 
------------------------------------------------------------------------
11/28/12 - 1.0 - Initial Release
 
1/2/2015 - 7.1.0 - Advanced the version number to match that of 
other scripts.

2/19/2015 - 7.1.1 - Advanced the version number.

3/10/2015 - 7.2.0 - Updated SystemRescueCD to version 4.5.1 to make 
use of new megaraid driver device support.

2/11/2016 - 7.2.1 - Changed the input and output block sizes used by
the dd command from the default (512 byte) to 4096 byte to increase
clone speed.

06/27/2018 - 7.2.2 - No changes.

03/19/2021 - 7.2.3 - No changes.

09/21/2021 - 7.2.4 - No changes.

01/19/2024 - 7.2.5 - No changes.

########################################################################
functions.sh: 
------------------------------------------------------------------------
12/5/12 - 1.0 - Initial Release

1/2/2015 - 7.1.0 - Advanced the version number to match that of 
other scripts. Updated existing functions to use the dialog based 
user interface.

2/19/2015 - 7.1.1 - Advanced the version number.

3/10/2015 - 7.2.0 - Updated SystemRescueCD to version 4.5.1 to make 
use of new megaraid driver device support. Added --time-style 
parameter to the ls command in the showimages() and buildimagelist() 
functions due to a change in the default time style in the newer 
version of ls.

2/11/2016 - 7.2.1 - No changes.

06/27/2018 - 7.2.2 - No changes.

03/19/2021 - 7.2.3 - No changes.

09/21/2021 - 7.2.4 - No changes.

01/19/2024 - 7.2.5 - Modified the validate_text() function to validate
either a name (of say, a backup or version number) or a path (which
would need to include forward slashes). Fixed bug in getnewname() where
"NEW_IMAGE_NAME" or "lost+found" would incorrectly be accepted as the
backup image name.
