find data retrying

pull/5/head
Tomas M 2012-09-18 11:04:52 -05:00
parent c2cb90aae3
commit 6b807b31cb
3 changed files with 29 additions and 9 deletions

11
build
View File

@ -39,15 +39,16 @@ cat bootfiles/syslinux.cfg | sed -r "s:/boot/:/$LIVEKITNAME/boot/:" > $BOOT/sysl
cat bootfiles/bootinst.bat | sed -r "s:/boot/:/$LIVEKITNAME/boot/:" | sed -r "s:\\\\boot\\\\:\\\\$LIVEKITNAME\\\\boot\\\\:" > $BOOT/bootinst.bat
cp /boot/vmlinuz $BOOT/
# create compressed bundles
for i in $MKMOD; do
mksquashfs /$i $LIVEKITDATA/$LIVEKITNAME/$i.$BEXT -comp xz -b 512k
done
if [ -d sb ]; then
cp sb/* $LIVEKITDATA/$LIVEKITNAME/
else
# create compressed bundles
for i in $MKMOD; do
mksquashfs /$i $LIVEKITDATA/$LIVEKITNAME/$i.$BEXT -comp xz -b 512k
done
fi
# create ISO for CD image
echo "Creating ISO file for CD boot..."
cd "$LIVEKITDATA"

View File

@ -25,7 +25,7 @@ init_zram
init_union "$CHANGES" "$UNION"
# find data dir with filesystem bundles
DATA="$(find_data $DATAMNT)"
DATA="$(find_data 60 $DATAMNT)"
# copy to RAM if needed

View File

@ -193,10 +193,10 @@ device_bestfs()
}
# Find LIVEKIT data by mounting all devices
# If found, retain mounted disk
# $1 = data directory to mount
# If found, keep mounted, else unmount
# $1 = data directory target (mount here)
#
find_data()
find_data_try()
{
debug_log "find_data"
@ -214,6 +214,25 @@ find_data()
done
}
# Retry finding LIVEKIT data several times,
# until timeouted or until data is found
# $1 = timeout
# $2 = data directory target (mount here)
#
find_data()
{
local DATA
for timeout in $(seq 1 $1); do
DATA="$(find_data_try "$2")"
if [ "$DATA" != "" ]; then
echo "$DATA"
return
fi
sleep 1
done
}
# Mount squashfs filesystem bundles
# and add them to union
# $1 = directory where to search for bundles