From 3d028ddc77eda8182aceefa9f452353c36aedcec Mon Sep 17 00:00:00 2001 From: Dimitar Zhekov Date: Thu, 20 May 2004 09:14:27 +0000 Subject: [PATCH] Dimitar Zhekov: upgdaded bize (0.7) - many fixes and improvements [2004051712111501301] (https://www.rocklinux.net/submaster) git-svn-id: http://www.rocklinux.org/svn/rock-linux/trunk@3050 c5f82cb5-29bc-0310-9cd0-bff59a50e3bc --- package/base/bize/bize.desc | 2 +- package/base/bize/bize.man | 45 ++++++++++++++++++----------- package/base/bize/bize.sh | 57 ++++++++++++++++++------------------- 3 files changed, 58 insertions(+), 46 deletions(-) diff --git a/package/base/bize/bize.desc b/package/base/bize/bize.desc index 9e40bbb47..241ddbda7 100644 --- a/package/base/bize/bize.desc +++ b/package/base/bize/bize.desc @@ -33,6 +33,6 @@ [L] GPL [S] Stable -[V] 0.3 +[V] 0.7 [P] X -1---5---9 229.100 diff --git a/package/base/bize/bize.man b/package/base/bize/bize.man index ed6b24b90..3eabae56e 100644 --- a/package/base/bize/bize.man +++ b/package/base/bize/bize.man @@ -6,7 +6,7 @@ bize \- ROCK-Linux .tar.bz2 package manager .BI "bize -i [-t] [-v] [-f] [-R " root "] " package1.tar.bz2 .BI ... .LP -.BI "bize -r [-t] [-v] [-f] [-R " root "] " package1 ... +.BI "bize -r [-t] [-v] [-f] [-R " root "] " package1 " ..." .SH DESCRIPTION .B bize is a shell script capable of installing, updating and removing @@ -14,16 +14,17 @@ ROCK-Linux .tar.bz2 package files. It implements a subset of .B mine options. .SS Requirements -.BR md5sum ", " sort ", " rm ", " rmdir ", " mkdir ", " tar " and -.BR bzip2 . +.BR which " (or " type "), " sort ", " rm ", " rmdir ", " +.BR mkdir ", " tar " and " bzip2 ", and also " md5sum ", " +unless +.B "\-f" +is specified. All these are standard programs present in any Linux system, but .B bize checks for them on startup anyway. -The presence of -.B md5sum -and of md5sum entries files is checked only if -.B "\-f" -is not specified. +.PP +The operating system must be able to remove files being in use. +All Linux systems have this ability. .SS Compatibility The .tar.bz2 and .gem formats are not compatible. Packages installed with @@ -38,11 +39,15 @@ ROCK-Linux 1.7.0+ targets produce .tar.bz2 packages only. .B bize installs packages slightly faster than .BR "mine " -and removes them several times slower. Much more time is required -to install a package than to remove it, so +and removes them about 25% faster (but see +.BR BUGS). +More time is usually required to remove a package than to install +it, so .B bize -is, overall, about 20% slower than +is, overall, about 15% faster than .BR mine . +Needless to say, your mileage may vary. +.PP The .tar.bz2 packages are a bit smaller than the .gem packages and are created a bit faster. .SH OPTIONS @@ -65,15 +70,23 @@ Force removal/replacement of the modified files. .BI "\-r " root Use .I root -as root directory instead of /. +as root directory instead of +.BR / . .TP .B "\-\-" Terminate the option list. .SH BUGS -Regular files with no md5sum entry are ignored in test mode and -treated as modified in real mode unless +.B bize +will try to compute md5sum for any file with an md5sum entry, +even for devices and pipes. A normally built and installed ROCK- +Linux package includes md5sum entries for the regular files only. +.PP +.B bize +doesn't make backups, because I don't like them (of course, any +modified files are preserved unless .B "\-f" -is specified. A normally built and installed ROCK-Linux package -must include such an entry for each regular file. +is specified). +.B mine +makes backups, so this is listed as a bug. .SH SEE ALSO GEM-MINE diff --git a/package/base/bize/bize.sh b/package/base/bize/bize.sh index deb5eec77..0fe1d3b78 100644 --- a/package/base/bize/bize.sh +++ b/package/base/bize/bize.sh @@ -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