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

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

View File

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

View File

@ -193,10 +193,10 @@ device_bestfs()
} }
# Find LIVEKIT data by mounting all devices # Find LIVEKIT data by mounting all devices
# If found, retain mounted disk # If found, keep mounted, else unmount
# $1 = data directory to mount # $1 = data directory target (mount here)
# #
find_data() find_data_try()
{ {
debug_log "find_data" debug_log "find_data"
@ -214,6 +214,25 @@ find_data()
done 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 # Mount squashfs filesystem bundles
# and add them to union # and add them to union
# $1 = directory where to search for bundles # $1 = directory where to search for bundles