create_deploy_tarball.sh from EmStar at Krugle
Show create_deploy_tarball.sh syntax highlighted
#!/bin/bash
echo "This expects to run from the objdir of the target platform you want to make a tarball for!"
echo "This will also assume that the host you are doing this on is i686-linux!"
echo "Required parameters:"
echo " --go this makes this script run"
echo "Optional options:"
echo " --eemstar /full/path/to/optional/directory which will contain extra "
echo " stuff (including .files) to go into /home/emstar"
echo " This stuff will be packed into the provided tarball"
echo " --rootfs /full/path/to/rootfs/extras which contains extra files for the rootfs"
echo " This cause this script to create two tarballs, one to be extraced into /home/emstar"
echo " and one to be extracted into / which will contain /home/emstar as well"
export LD_LIBRARY_PATH=$PWD/../obj.i686-linux/lib
GO=0
EEMSTAR=0
ROOTFS=0
while [ $1 ] ; do
case "$1" in
--go)
GO=1
shift
;;
--eemstar)
EEMSTAR=1
EEMSTAR_STRING=$2
shift
shift
;;
--rootfs)
ROOTFS=1
ROOTFS_STRING=$2
shift
shift
;;
*)
shift
;;
esac
done
if [ $GO -eq 0 ]; then
echo "Must provide at least --go option!"
exit 1
fi
if [ ! -x ../obj.i686-linux/emrun/emrun ]; then
echo "../obj.i686-linux/emrun/emrun not found! Exiting"
exit 1
fi
if [ $EEMSTAR -eq 1 ]; then
if [ ! -d $EEMSTAR_STRING ]; then
echo "$EEMSTAR_STRING is not a dir!"
exit 1
fi
fi
if [ $ROOTFS -eq 1 ]; then
if [ ! -d $ROOTFS_STRING ]; then
echo "$ROOTFS_STRING is not a dir!"
exit 1
fi
fi
CURRDIR=`pwd`
export LD_LIBRARY_PATH=`pwd`/../obj.i686-linux/lib
rm -rf /tmp/deps
# echo do this first, so copydeps will over write
if [ $EEMSTAR -eq 1 ]; then
echo "Adding files from $EEMSTAR_STRING"
rm -rf /tmp/tempdeps
cp -a $EEMSTAR_STRING /tmp/tempdeps
mv /tmp/tempdeps /tmp/deps
fi
echo "Running --copy-deps on .run files!!!"
#
# Do all the run file stuff here
#
#
# These are just exmaple, reaplace the .run files eith the right ones
#
# don't forget to set env vars
export PLATFORM=nims-stargate
../obj.i686-linux/emrun/emrun --copy-deps /tmp/deps ../devel/loc/testtabs/ar.run wlan0 " " " " " "
cp ../devel/loc/testtabs/ar.run /tmp/deps/ar.run
rm /tmp/deps/app.run
#../obj.i686-linux/emrun/emrun --copy-deps /tmp/deps ../devel/loc/testtabs/example.run wlan0
#mv /tmp/deps/app.run /tmp/deps/example.run
# or
#cp ../devel/loc/testtabs/example.run /tmp/deps/example.run
#rm /tmp/deps/app.run
#../obj.i686-linux/emrun/emrun --copy-deps /tmp/deps ../devel/loc/testtabs/example2.run wlan0
#mv /tmp/deps/app.run /tmp/deps/example2.run
# or
#cp ../devel/loc/testtabs/example2.run /tmp/deps/example2.run
#rm /tmp/deps/app.run
#../obj.i686-linux/emrun/emrun --copy-deps /tmp/deps ../devel/loc/testtabs/example3.run wlan0
#mv /tmp/deps/app.run /tmp/deps/example3.run
# or
#cp ../devel/loc/testtabs/example3.run /tmp/deps/example3.run
#rm /tmp/deps/app.run
cd /tmp/deps
cp -r $CURRDIR/lib .
cd lib
rm *.a libemtos.so libchannel.so
cd ..
CURRDATE=`date +%G%m%d%k%M`
echo $CURRDATE > /tmp/deps/.CREATED
echo tar -czf $CURRDIR/../../acoustic-home-emstar-only-$CURRDATE.tar.gz
tar -czf $CURRDIR/../../acoustic-home-emstar-only-$CURRDATE.tar.gz --exclude=.. .*
cd $CURRDIR
if [ $ROOTFS -eq 1 ]; then
echo "Creating new rootfs tarball from $ROOTFS_STRING"
rm -rf /tmp/arootfs
cp -a $ROOTFS_STRING /tmp/arootfs
mkdir -p /tmp/arootfs/home/emstar
tar zxf $CURRDIR/../../acoustic-home-emstar-only-$CURRDATE.tar.gz
cd /tmp/arootfs/
echo $CURRDATE > /tmp/arootfs/.CREATED
echo tar -czf $CURRDIR/../../acoustic-rootfs-emstar-$CURRDATE.tar.gz
tar -czf $CURRDIR/../../acoustic-rootfs-emstar-$CURRDATE.tar.gz --exclude=.. .*
fi
See more files for this project here