2 # --- T2-COPYRIGHT-NOTE-BEGIN ---
3 # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
5 # T2 SDE: misc/archive/copypackage.sh
6 # Copyright (C) 2006 The T2 SDE Project
8 # More information can be found in the files COPYING and README.
10 # This program is free software; you can redistribute it and/or modify
11 # it under the terms of the GNU General Public License as published by
12 # the Free Software Foundation; version 2 of the License. A copy of the
13 # GNU General Public License can be found in the file COPYING.
14 # --- T2-COPYRIGHT-NOTE-END ---
17 echo "Usage: $0 <source> <target> <pkg> ..."
22 local from
="$1" to
="$2" pkg
="$3"
23 if [ -f $from/var
/adm
/flists
/$pkg ]; then
24 if [ -f $to/var
/adm
/flists
/$pkg ]; then
25 echo "$pkg: already present at target ($to)"
26 cut
-d' ' -f2- $to/var
/adm
/flists
/$pkg |
while read -r f
; do
27 if [ "$f" == var
/adm
/flists
/$pkg ]; then
29 elif [ ! -d "$to/$f" ]; then
33 rm -vf $to/var
/adm
/logs
/*-$pkg.
{err
,out
,log
} 2> /dev
/null
36 echo "$pkg: $from -> $to"
37 cut
-d' ' -f2- $from/var
/adm
/flists
/$pkg |
38 tar -C "$from/" --ignore-failed-read --no-recursion -T - -c -O |
39 tar -C "$to" --same-owner --preserve -xvf -
40 cp -v $from/var
/adm
/logs
/*-$pkg.
{err
,out
,log
} $to/var
/adm
/logs
/ 2> /dev
/null
42 echo "$pkg: package not found at source ($from)"
49 if [ $# -gt 0 -a -f .
/config
/$source/config
-a -f .
/config
/$target/config
-a "$source" != "$target" ]; then
51 eval `grep SDECFG_ID= ./config/$source/config`
52 if [ -d "./build/$SDECFG_ID/var/adm/flists/" ]; then
53 source=.
/build
/$SDECFG_ID
56 eval `grep SDECFG_ID= ./config/$target/config`
57 if [ -d "./build/$SDECFG_ID/var/adm/flists/" ]; then
58 target
=.
/build
/$SDECFG_ID
61 cppkg
"$source" "$target" "$x"
64 echo "'$target' is not a valid config" 1>&2
68 echo "'$source' is not a valid config" 1>&2
72 echo "Invalid Arguments" 1>&2