|
|
@ -3,7 +3,7 @@ |
|
|
|
# This copyright note is auto-generated by ./scripts/Create-CopyPatch. |
|
|
|
# |
|
|
|
# Filename: lib/sde-binary/package.sh |
|
|
|
# Copyright (C) 2007 - 2012 The OpenSDE Project |
|
|
|
# Copyright (C) 2007 - 2010 The OpenSDE Project |
|
|
|
# |
|
|
|
# More information can be found in the files COPYING and README. |
|
|
|
# |
|
|
@ -31,14 +31,12 @@ Usage: ${0} --type [--versioned] [--root ] [--output |
|
|
|
package name of the package |
|
|
|
|
|
|
|
--versioned use package version in the resulting file name |
|
|
|
--nodevel do not package development files |
|
|
|
EOT |
|
|
|
} |
|
|
|
|
|
|
|
while [ $# -gt 0 ]; do |
|
|
|
case "$1" in |
|
|
|
--versioned) versioned=1 ;; |
|
|
|
--nodevel) nodevel=1 ;; |
|
|
|
--type) pkg_type="$2"; shift ;; |
|
|
|
--root) root="$2"; shift ;; |
|
|
|
--output) output="$2"; shift ;; |
|
|
@ -91,51 +89,16 @@ mkdir -p "$output" |
|
|
|
filename="$pkg_name${versioned:+-${version}}.$pkg_type" |
|
|
|
flist="$root/var/adm/flists/$pkg_name" |
|
|
|
|
|
|
|
tarfilename="$pkg_name${versioned:+-${version}}.tar" |
|
|
|
|
|
|
|
tmpdir=$( mktemp -d "$SDEROOT/tmp/packaging.$pkg_name.XXXXXXXX" ) |
|
|
|
tmpflist="$tmpdir/var/adm/flists/$pkg_name" |
|
|
|
tmpcksum="$tmpdir/var/adm/cksums/$pkg_name" |
|
|
|
tmpmd5sum="$tmpdir/var/adm/md5sums/$pkg_name" |
|
|
|
|
|
|
|
# creating backup of var/adm files |
|
|
|
mkdir -p "$tmpdir" |
|
|
|
|
|
|
|
for x in $( grep ' var/adm' "$flist" | cut -d' ' -f2- ); do |
|
|
|
mkdir -p "$tmpdir/$(dirname $x)" |
|
|
|
cp -a "$root/$x" "$tmpdir/$x" |
|
|
|
done |
|
|
|
|
|
|
|
# pattern to filter development files |
|
|
|
if [ "$nodevel" ]; then |
|
|
|
filterpattern="-e '/\.\(c\|h\|hpp\|hxx\|o\|a\|la\|m4\|pc\)$/d;'" |
|
|
|
fi |
|
|
|
|
|
|
|
if [ ! -z "$filterpattern" ]; then |
|
|
|
eval "sed -i $filterpattern" "$tmpflist" "$tmpcksum" "$tmpmd5sum" |
|
|
|
fi |
|
|
|
|
|
|
|
# create uncompressed tar with the files from the sandbox but without var/adm |
|
|
|
( grep -v ' var/adm' "$tmpflist" ) | cut -f2- -d' ' | |
|
|
|
tar -C "$root" -cf "$output/$tarfilename.tmp" --no-recursion --files-from=- |
|
|
|
errno=$? |
|
|
|
|
|
|
|
# add adjusted var/adm files from tmpdir to the uncompressed tar |
|
|
|
( grep ' var/adm' "$tmpflist" ) | cut -f2- -d' ' | |
|
|
|
tar -C "$tmpdir" -rf "$output/$tarfilename.tmp" --no-recursion --files-from=- |
|
|
|
errno=$? |
|
|
|
|
|
|
|
# create the final compressed tar file |
|
|
|
eval "$compressor --stdout $output/$tarfilename.tmp > $output/$filename.tmp" |
|
|
|
( grep ' var/adm' "$flist" |
|
|
|
grep -v ' var/adm' "$flist" ) | cut -f2- -d' ' | |
|
|
|
tar -C "$root" -cf- --no-recursion --files-from=- | |
|
|
|
$compressor > "$output/$filename.tmp" |
|
|
|
errno=$? |
|
|
|
|
|
|
|
if [ "$errno" != "0" ]; then |
|
|
|
echo_error "failed to create '$output/$filename' (errno:$errno)" |
|
|
|
rm -f "$output/$tarfilename.tmp" |
|
|
|
rm -f "$output/$filename.tmp" |
|
|
|
exit 4 |
|
|
|
else |
|
|
|
rm -rf "$tmpdir" |
|
|
|
rm -f "$output/$tarfilename.tmp" |
|
|
|
mv "$output/$filename.tmp" "$output/$filename" |
|
|
|
fi |