|
|
@ -8,7 +8,7 @@ bize_usage() |
|
|
|
|
|
|
|
bize_remove() |
|
|
|
{ |
|
|
|
local tag base sum md5s="$adm/md5sums/$pkg" |
|
|
|
local line base tag md5s="$adm/md5sums/$pkg" |
|
|
|
|
|
|
|
if [ "$keep" ] ; then |
|
|
|
if [ ! -f "$md5s" ] ; then |
|
|
@ -16,44 +16,43 @@ bize_remove() |
|
|
|
return |
|
|
|
fi |
|
|
|
|
|
|
|
while read tag base ; do |
|
|
|
(cd "$root/" && md5sum -c "var/adm/md5sums/$pkg" 2> /dev/null) | |
|
|
|
while read line ; do |
|
|
|
base="${line%: *}" |
|
|
|
stat="${line##*: }" |
|
|
|
file="$root/$base" |
|
|
|
if [ -z "$base" ] ; then |
|
|
|
echo "$0: invalid line '$tag' in $md5s" 1>&2 |
|
|
|
if [ -z "$base" -o -z "$stat" ] ; then |
|
|
|
echo "$0: invalid md5sum output '$line'" 1>&2 |
|
|
|
elif [ -f "$file" -a ! -L "$file" ] ; then |
|
|
|
sum="`md5sum < $file`" |
|
|
|
sum="${sum% -}" |
|
|
|
if [ "$tag" = "$sum" ] ; then |
|
|
|
if [ "$stat" = OK ] ; then |
|
|
|
$unlink "$file" |
|
|
|
elif [ "$stat" != FAILED ] ; then |
|
|
|
echo "$0: $file: $stat" |
|
|
|
elif [ "$test" ] ; then |
|
|
|
echo "$0: $file: modified, skipping" |
|
|
|
fi |
|
|
|
fi |
|
|
|
done < $md5s |
|
|
|
done |
|
|
|
fi |
|
|
|
|
|
|
|
sort -r -- "$list" | while read tag base ; do |
|
|
|
sort -r "$list" | while read tag base ; do |
|
|
|
file="$root/$base" |
|
|
|
if [ "$tag" != "$pkg:" ] ; then |
|
|
|
echo "$0: invalid tag '$tag' in $list" 1>&2 |
|
|
|
elif [ -z "$base" ] ; then |
|
|
|
echo "$0: missing file name in $list" 1>&2 |
|
|
|
elif [ "$base" != "${base#var/adm/}" ] ; then |
|
|
|
continue |
|
|
|
elif [ -L "$file" ] ; then |
|
|
|
$unlink "$file" |
|
|
|
elif [ -d "$file" ] ; then |
|
|
|
$test rmdir $voption -- "$file" |
|
|
|
$test rmdir $voption "$file" |
|
|
|
elif [ "${base#var/adm/}" != "$base" -a -f "$file" ] ; then |
|
|
|
$unlink "$file" |
|
|
|
elif [ "$keep" -a -f "$file" ] ; then |
|
|
|
[ "$test" ] || echo "$0: $file: modified, skipping" |
|
|
|
else |
|
|
|
$unlink "$file" |
|
|
|
fi |
|
|
|
done |
|
|
|
|
|
|
|
for base in cksums dependencies descs flists logs md5sums packages ; do |
|
|
|
$unlink "$adm/$base/$pkg" |
|
|
|
done |
|
|
|
} |
|
|
|
|
|
|
|
bize_install() |
|
|
@ -68,13 +67,14 @@ bize_install() |
|
|
|
echo "$0: $arch: not a .tar.bz2 file" 1>&2 |
|
|
|
return |
|
|
|
fi |
|
|
|
pkg="${pkg##*/}" |
|
|
|
pkg="${pkg%-[0-9]*}" |
|
|
|
pkg="${pkg##*/}" |
|
|
|
|
|
|
|
if [ -z "$pkg" ] ; then |
|
|
|
echo "$0: $arch: missing package name" 1>&2 |
|
|
|
return |
|
|
|
fi |
|
|
|
[ "${arch#-}" = "$arch" ] || arch="./$arch" |
|
|
|
|
|
|
|
list="$adm/flists/$pkg" |
|
|
|
if [ -f "$list" ] ; then |
|
|
@ -84,11 +84,11 @@ bize_install() |
|
|
|
[ "$verbose" ] && echo "installing $pkg ..." |
|
|
|
fi |
|
|
|
|
|
|
|
$test mkdir -p$verbose -- "$root/" |
|
|
|
$test mkdir -p$verbose "$root/" |
|
|
|
if [ "$test" ] ; then |
|
|
|
echo "bzip2 -c -d -- $arch | tar $taropt -C $root/" |
|
|
|
echo "bzip2 -c -d $arch | tar $taropt -C $root/" |
|
|
|
else |
|
|
|
bzip2 -c -d -- "$arch" | tar $taropt -C "$root/" |
|
|
|
bzip2 -c -d "$arch" | tar $taropt -C "$root/" |
|
|
|
fi |
|
|
|
} |
|
|
|
|
|
|
@ -106,7 +106,7 @@ bize_uninstall() |
|
|
|
bize_main() |
|
|
|
{ |
|
|
|
local which=which file arch list="sort rm rmdir mkdir tar bzip2" |
|
|
|
local install remove test verbose voption keep=1 root=/ taropt |
|
|
|
local install remove test verbose voption keep=k root=/ taropt |
|
|
|
|
|
|
|
while [ "$1" ] ; do |
|
|
|
case "$1" in |
|
|
@ -124,14 +124,14 @@ bize_main() |
|
|
|
shift |
|
|
|
done |
|
|
|
|
|
|
|
if type which > /dev/null 2>&1 ; then |
|
|
|
if type sh > /dev/null 2>&1 ; then |
|
|
|
which=type |
|
|
|
elif ! which which > /dev/null 2>&1 ; then |
|
|
|
elif ! which sh > /dev/null ; then |
|
|
|
echo "$0: unable to find 'type' or 'which'" 1>&2 |
|
|
|
return 1 |
|
|
|
fi |
|
|
|
|
|
|
|
[ "$keep" ] && list="md5sum $list" |
|
|
|
[ "$keep" ] && list="$list md5sum" |
|
|
|
for file in $list ; do |
|
|
|
if ! $which $file > /dev/null ; then |
|
|
|
echo "$0: unable to find '$file'" 1>&2 |
|
|
@ -144,13 +144,13 @@ bize_main() |
|
|
|
return 1 |
|
|
|
fi |
|
|
|
|
|
|
|
root=${root%/} |
|
|
|
root="${root%/}" |
|
|
|
[ "${root#-}" = "$root" ] || root="./$root" |
|
|
|
|
|
|
|
local adm="$root/var/adm" unlink="$test rm -f$verbose --" pkg |
|
|
|
local adm="$root/var/adm" unlink="$test rm -f$verbose" pkg |
|
|
|
|
|
|
|
if [ "$install" ] ; then |
|
|
|
taropt="x${verbose}" |
|
|
|
[ "$keep" ] && taropt="${taropt}k" |
|
|
|
taropt="xp${verbose}${keep}" |
|
|
|
for arch do |
|
|
|
bize_install |
|
|
|
done |
|
|
@ -164,4 +164,3 @@ bize_main() |
|
|
|
} |
|
|
|
|
|
|
|
bize_main "$@" |
|
|
|
unset bize_usage bize_remove bize_install bize_uninstall bize_main |