rear/rear — pull request #502 by tbsky (2014-11-02 05:19:44+00:00)
Title: add support for modular custom function cf--$stage--my_function

hi:
I need to add a small custom script to rear. thanks for rear modular design, I can easily add my script to something like "/usr/share/rear/backup/NETFS/default/66_my_backup.sh" and "/usr/share/rear/restore/NETFS/default/66_my_restore.sh" .

now I want to further enhance the modular design, try to put all my scripts to /etc/rear/local.conf so it is easier to maintain and separate my scripts from official rear system.

I try to use a "custom function" idea, so I can add my script to /etc/rear/local.conf and rear will automatically find them and include them. so my /etc/rear/local.conf would look like below:

function cf--backup--66_make_drbd_vm_backup {
/share/bin/drbd-vm-backup -b -t drbd-single -d $TMP_DIR/isofs/drbd-vm-backup
}
function cf--restore--66_restore_drbd_vm_backup {
drbd-vm-backup -r -t drbd-single -d $BUILD_DIR/outputfs/drbd-vm-backup
}

with the patch I can enjoy rear modular design and maintain all the custom change to /etc/rear/local.conf. I try this in my system and is seems work well. but I don't really understand all the rear internals.so please review and fix any non-proper codes.