2 # --- T2-COPYRIGHT-NOTE-BEGIN ---
3 # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
5 # T2 SDE: package/.../bize/bize.sh
6 # Copyright (C) 2004 - 2005 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 ---
18 echo "usage: bize -i [-t] [-v] [-f] [-R root] package1.tar.bz2 ..." 1>&2
19 echo " bize -r [-t] [-v] [-f] [-R root] package1 ..." 1>&2
24 local line base tag md5s
="$adm/md5sums/$pkg"
27 if [ ! -f "$md5s" ] ; then
28 echo "$0: $md5s: no such file, skipping remove" 1>&2
32 (cd "$root/" && md5sum -c "var/adm/md5sums/$pkg" 2> /dev
/null
) |
37 if [ -z "$base" -o -z "$stat" ] ; then
38 echo "$0: invalid md5sum output '$line'" 1>&2
39 elif [ -f "$file" -a ! -L "$file" ] ; then
40 if [ "$stat" = OK
] ; then
42 elif [ "$stat" != FAILED
] ; then
43 echo "$0: $file: $stat"
44 elif [ "$test" ] ; then
45 echo "$0: $file: modified, skipping"
51 sort -r "$list" |
while read tag base
; do
53 if [ "$tag" != "$pkg:" ] ; then
54 echo "$0: invalid tag '$tag' in $list" 1>&2
55 elif [ -z "$base" ] ; then
56 echo "$0: missing file name in $list" 1>&2
57 elif [ -L "$file" ] ; then
59 elif [ -d "$file" ] ; then
60 $test rmdir $voption "$file"
61 elif [ "${base#var/adm/}" != "$base" -a -f "$file" ] ; then
63 elif [ "$keep" -a -f "$file" ] ; then
64 [ "$test" ] ||
echo "$0: $file: modified, skipping"
73 if [ ! -f "$arch" ] ; then
74 echo "$0: $arch: no such file, skipping install" 1>&2
78 pkg
="${arch%.tar.bz2}"
79 if [ "$arch" = "$pkg" ] ; then
80 echo "$0: $arch: not a .tar.bz2 file" 1>&2
86 if [ -z "$pkg" ] ; then
87 echo "$0: $arch: missing package name" 1>&2
90 [ "${arch#-}" = "$arch" ] || arch
="./$arch"
92 list
="$adm/flists/$pkg"
93 if [ -f "$list" ] ; then
94 [ "$verbose" ] && echo "updating $pkg ..."
97 [ "$verbose" ] && echo "installing $pkg ..."
100 $test mkdir
-p$verbose "$root/"
101 if [ "$test" ] ; then
102 echo "bzip2 -c -d $arch | tar $taropt -C $root/"
104 bzip2 -c -d "$arch" |
tar $taropt -C "$root/"
110 [ "$verbose" ] && echo "removing $pkg"
111 list
="$adm/flists/$pkg"
112 if [ -f "$list" ] ; then
115 echo "$0: $list: no such file, skipping remove" 1>&2
121 local which=which file arch list
="sort rm rmdir mkdir tar bzip2"
122 local install remove
test verbose voption keep
=k root
=/ taropt
130 -v) verbose
=v
; voption
=-v ;;
131 -R) shift ; root
="$1" ;;
132 -R*) root
="${1#-R}" ;;
134 -*) bize_usage
; return 1 ;;
140 if type sh
> /dev
/null
2>&1 ; then
142 elif ! which sh
> /dev
/null
; then
143 echo "$0: unable to find 'type' or 'which'" 1>&2
147 [ "$keep" ] && list
="$list md5sum"
148 for file in $list ; do
149 if ! $which $file > /dev
/null
; then
150 echo "$0: unable to find '$file'" 1>&2
155 if [ "$install" = "$remove" -o -z "$root" -o -z "$*" ] ; then
161 [ "${root#-}" = "$root" ] || root
="./$root"
163 local adm
="$root/var/adm" unlink
="$test rm -f$verbose" pkg
165 if [ "$install" ] ; then
166 taropt
="xp${verbose}${keep}"