On Wednesday 27 July 2005 17:33, Erich Focht wrote:
>
> Wouldn't it make more sense to directly pipe the udp-receive output to a tar?
>
Here is a patch for the problem. I tried to commit it but am getting the
following error message:
svn: Can't create directory
'/var/lib/svn/systemimager/db/transactions/3200-1.txn': Permission denied
This doesn't seem to come from my site, I created that directory and gave it
world write permission.
The commit text was:
flamethrower_client was filling up the tmpfs when transfering big images.
Instead of trying to store the image as a tar file (which is still the default)
now it is possible to directly untar the transfered data by piping it to
a tar command. The option has been added by reusing all the flamethrower_client
code.
It is triggered by setting the environment variable FLAMETHROWER_TARPIPE.
Best regards,
Erich
--- etc/autoinstallscript.template.oold 2005-07-27 18:39:12.000000000 +0200
+++ etc/autoinstallscript.template 2005-07-27 18:40:30.000000000 +0200
@@ -230,6 +230,7 @@
MODULE_NAME="${IMAGENAME}"
DIR=/a
RETRY=7
+ FLAMETHROWER_TARPIPE=y
flamethrower_client
else
# Use rsync
@@ -291,6 +292,7 @@
MODULE_NAME="override_${OVERRIDE}"
DIR=/a
RETRY=7
+ FLAMETHROWER_TARPIPE=y
flamethrower_client
else
# Use rsync
--- initrd_source/skel/etc/init.d/functions.old 2005-07-27 18:15:36.000000000 +0200
+++ initrd_source/skel/etc/init.d/functions 2005-07-27 18:38:12.000000000 +0200
@@ -341,13 +341,18 @@
# [RETRY=7] # Optional
# [PORTBASE=9000] # Required if a sourceable file called $MODULE_NAME
# # doesn't exist
+# [FLAMETHROWER_TARPIPE] # If not empty, untar received data directly,
+# # without storing it to a temporary file
#
# flamethrower_client
#
flamethrower_client() {
+ if [ ! -z $FLAMETHROWER_TARPIPE ]; then
+ $FLAMETHROWER_TARPIPE=tarpipe
+ fi
logmsg
- logmsg "flamethrower_client(${MODULE_NAME})"
+ logmsg "flamethrower_client(${MODULE_NAME}) $FLAMETHROWER_TARPIPE "
logmsg ---------------------------------------------------------------------
# validate
@@ -360,11 +365,11 @@
fi
fi
if [ -z $DIR ]; then
- logmsg Must set DIR
+ logmsg "Must set DIR !!!"
+ shellout
else
mkdir -p $DIR
fi
-
# build command
UDP_RECEIVER_OPTIONS="--interface ${DEVICE} --portbase $PORTBASE --nokbd"
@@ -400,19 +405,27 @@
# receive cast
# example udp-receiver command:
# udp-receiver --interface lo --portbase 9002 --nokbd --nosync --file /tmp/multicast.tar
- logmsg udp-receiver $UDP_RECEIVER_OPTIONS --file /tmp/multicast.tar
- udp-receiver $UDP_RECEIVER_OPTIONS --file /tmp/multicast.tar
- UDP_RECEIVER_EXIT_STATUS=$?
-
- # untar it
- if [ "$UDP_RECEIVER_EXIT_STATUS" = "0" ]; then
- logmsg tar ${TAR_OPTS} -f /tmp/multicast.tar -C ${DIR}
- tar ${TAR_OPTS} -f /tmp/multicast.tar -C ${DIR}
- TAR_EXIT_STATUS=$?
- fi
- # discard used tarball like an old sock (recommended by: Ramon Bastiaans <[EMAIL PROTECTED]>)
- rm -f /tmp/multicast.tar
+ if [ -n $FLAMETHROWER_TARPIPE ]; then
+ TAR_OPTS="$TAR_OPTS -f -"
+ logmsg "udp-receiver $UDP_RECEIVER_OPTIONS | tar $TAR_OPTS -C $DIR"
+ udp-receiver $UDP_RECEIVER_OPTIONS | tar $TAR_OPTS -C $DIR
+ TAR_EXIT_STATUS=$?
+ UDP_RECEIVER_STATUS=0
+ else
+ logmsg udp-receiver $UDP_RECEIVER_OPTIONS --file /tmp/multicast.tar
+ udp-receiver $UDP_RECEIVER_OPTIONS --file /tmp/multicast.tar
+ UDP_RECEIVER_EXIT_STATUS=$?
+
+ # untar it
+ if [ "$UDP_RECEIVER_EXIT_STATUS" = "0" ]; then
+ logmsg tar ${TAR_OPTS} -f /tmp/multicast.tar -C ${DIR}
+ tar ${TAR_OPTS} -f /tmp/multicast.tar -C ${DIR}
+ TAR_EXIT_STATUS=$?
+ fi
+ # discard used tarball like an old sock (recommended by: Ramon Bastiaans <[EMAIL PROTECTED]>)
+ rm -f /tmp/multicast.tar
+ fi
# did everything work properly
if [ $UDP_RECEIVER_EXIT_STATUS -eq 0 ] && [ $TAR_EXIT_STATUS -eq 0 ]; then
@@ -436,7 +449,6 @@
logmsg 'finished!'
logmsg
-
# Unset vars, so next module (which may not have them set) won't use then unintentially
unset TTL
unset NOSYNC
@@ -451,6 +463,7 @@
unset TAR_EXIT_STATUS
unset TAR_OPTS
unset SUCCESS
+ unset FLAMETHROWER_TARPIPE
}
#