It is not possible to backup to a subdir of LBU_MEDIA.
There are mainly two problems, one related to saving and the other to loading at boot.
The first one depends on the backup program lbu
.
I checked and it is just a logic problem, in the actual program it is assumed that if in the file /etc/lbu/lbu.conf
the variable LBU_BACKUPDIR
is specified then the variable LBU_MEDIA
is not taken into account, however this makes it impossible to have apkovl in a dir other than the root of the boot disk.
Also it seems to me that keeping both variables active causes fstab errors to appear. My guess is that this should be the logic:
- If I specify a disk in
LBU_MEDIA
then I am tellinglbu
that it should take care of mounting and unmounting the disk.
- 1.1 If I don't specify an
LBU_BACKUPDIR
then that means apkovl goes into the root of the dir - 1.2 If I specify an
LBU_BACKUPDIR
then it means the dir is to be considered a subdir of the specified disk
- I do not specify
LBU_MEDIA
and therefore a disk mount should not be handled:
- 2,1 I specify
LBU_BACKUPDIR
which is to be interpreted relative to the system root. - 2,2 I do not specify
LBU_BACKUPDIR
then I get help printed.
I tried patching just the commit function and it worked, just I don't have the competence to patch the whole script while avoiding creating bugs.
However I still include the code part in the cmd_commit
function to highlight the change in logic:
current official code
mnt="$LBU_BACKUPDIR"
if [ -z "$mnt" ]; then
# find what media to use
media="${1:-$LBU_MEDIA}"
[ -z "$media" ] && usage_commit "1" >&2
# mount media unless its already mounted
mnt=/media/$media
[ -d "$mnt" ] || usage "1" >&2
mount_once_rw "$mnt" || die "failed to mount $mnt"
fi
replacenebt code with new logic
mnt="$LBU_BACKUPDIR"
media="$LBU_MEDIA"
if ! [ -z "$media" ]; then
# mount media unless its already mounted
media="/media/$media"
[ -d "$media" ] || usage "1" >&2
mount_once_rw "$media" || die "failed to mount $media"
# set mnt directory
if ! [ -z "$mnt" ]; then
mnt="$media/$mnt"
else
mnt="$media"
fi
fi
[ -z "$mnt" ] && usage_commit "1" >&2
I repeat, this code works, but all the other functions have to be changed, not just the commit.
P.s. Then there's the boot load problem, the apkovl parameter regarding local paths just seems broken to me, every value I enter doesn't work. And looking at the init for me is just too much :(
There is to say that I had created my boot disk from virtualbox and I don't know if for that reason the disk is mounted in /media/usb even if the disk is /dev/sdb, I wouldn't want that this thing create the problem.