#!/bin/bash
|
|
# --- SDE-COPYRIGHT-NOTE-BEGIN ---
|
|
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
|
|
#
|
|
# Filename: scripts/Create-SrcTar
|
|
# Copyright (C) 2006 - 2008 The OpenSDE Project
|
|
# Copyright (C) 2004 - 2006 The T2 SDE Project
|
|
# Copyright (C) 1998 - 2003 Clifford Wolf
|
|
#
|
|
# More information can be found in the files COPYING and README.
|
|
#
|
|
# This program is free software; you can redistribute it and/or modify
|
|
# it under the terms of the GNU General Public License as published by
|
|
# the Free Software Foundation; version 2 of the License. A copy of the
|
|
# GNU General Public License can be found in the file COPYING.
|
|
# --- SDE-COPYRIGHT-NOTE-END ---
|
|
|
|
sderootdirs="scripts bin etc lib doc src package architecture target"
|
|
sderootfiles="README COPYING"
|
|
|
|
eval "$( egrep '^sdever=' lib/libsde.in )"
|
|
|
|
echo -n 'Creating source tar ... '
|
|
|
|
# Create temp source base dir
|
|
#
|
|
tmp="`mktemp -d -p $PWD src.srctar.XXXXXXXXXX`"
|
|
srctar=opensde-$sdever
|
|
[ -d ".svn/" ] && srctar="$srctar-r$( svn info --xml | sed -n -e 's, *revision="\([0-9]*\)".*,\1,p' | head -n 1 )"
|
|
|
|
rm -rf "$tmp/$srctar"
|
|
mkdir -p "$tmp/$srctar"
|
|
|
|
# Create tar file
|
|
#
|
|
|
|
(
|
|
cd "$tmp"
|
|
|
|
# Directories
|
|
#
|
|
y=
|
|
for x in $sderootdirs; do
|
|
ln -s ../../$x "$srctar/$x"
|
|
y="$y $srctar/$x/*"
|
|
done
|
|
|
|
#Files
|
|
#
|
|
for x in $sderootfiles; do
|
|
cp ../$x "$tmp/$srctar/$x"
|
|
y="$y $srctar/$x"
|
|
done
|
|
|
|
tar --owner root --group root \
|
|
--exclude .svn --exclude CVS \
|
|
--exclude .git -cO $y
|
|
) | bzip2 -c - > ${1:-$srctar.tar.bz2}.$$
|
|
|
|
# Done.
|
|
#
|
|
rm -rf $tmp/
|
|
mv ${1:-$srctar.tar.bz2}.$$ ${1:-$srctar.tar.bz2}
|
|
du -sh ${1:-$srctar.tar.bz2} | tr '\t' ' '
|
|
|