spk diff spk-add @ rev 53
spk-add: install_deps by default if no --confirm
author | Christophe Lincoln <pankso@slitaz.org> |
---|---|
date | Thu May 17 10:56:36 2012 +0200 (2012-05-17) |
parents | 1d9559a4f75b |
children | ee68829c1d60 |
line diff
1.1 --- a/spk-add Thu May 17 09:32:47 2012 +0200 1.2 +++ b/spk-add Thu May 17 10:56:36 2012 +0200 1.3 @@ -7,6 +7,7 @@ 1.4 # Author: See AUTHORS files 1.5 # 1.6 . /usr/lib/slitaz/libspk.sh 1.7 +#. lib/libspk.sh 1.8 1.9 tmpdir="/tmp/spk/$RANDOM" 1.10 1.11 @@ -82,10 +83,20 @@ 1.12 1.13 # Resolve package deps. 1.14 if missing_deps $package_name $DEPENDS; then 1.15 - install_deps $package_name $DEPENDS 1.16 + if [ "$confirm" ]; then 1.17 + gettext "Install missing dependencies" 1.18 + if ! confirm; then 1.19 + gettext "WARNING: Any dependencies installed"; newline 1.20 + else 1.21 + install_deps $package_name $DEPENDS 1.22 + fi 1.23 + else 1.24 + install_deps $package_name $DEPENDS 1.25 + fi 1.26 + else 1.27 + newline 1.28 fi 1.29 1.30 - newline 1.31 boldify $(gettext "Installation of:") $package_name 1.32 separator 1.33 gettext "Copying"; echo -n " $package_name..." 1.34 @@ -93,9 +104,10 @@ 1.35 status 1.36 1.37 # Add package checksum to $installed.$SUM 1.38 - [ "$verbose" ] && gettext "Adding package to:"; \ 1.39 - echo -n " $(basename $installed.$SUM)" 1.40 - sed -i "/$(basename $package_file)/"d $installed.$SUM 1.41 + if [ "$verbose" ]; then 1.42 + gettext "Incrementing:"; echo -n " $(basename $installed.$SUM)" 1.43 + fi 1.44 + sed -i "/$(basename $package_file)/"d $installed.$SUM 2>/dev/null 1.45 $CHECKSUM $(basename $package_file) >> $installed.$SUM 1.46 [ "$verbose" ] && status 1.47 1.48 @@ -275,7 +287,7 @@ 1.49 gettext "Using cache:"; echo " $(colorize "$package_full" 34)" 1.50 # Check package download was finished 1.51 if ! tail -c 2k $package_full.tazpkg | fgrep -q 00000000TRAILER; then 1.52 - eval_gettext "Continuing \$package_name download"; newline 1.53 + gettext "Continuing download of:"; echo " $package_name" 1.54 download "$package_full.tazpkg" 1.55 fi 1.56 # Check that the package has the correct checksum 1.57 @@ -284,46 +296,33 @@ 1.58 # download "$package_full.tazpkg" 1.59 #fi 1.60 else 1.61 - newline 1.62 - download "$package_full.tazpkg" 1.63 + newline && download "$package_full.tazpkg" 1.64 fi 1.65 1.66 install_package "$CACHE_DIR/$package_full.tazpkg" 1.67 1.68 - [ -n "$AUTOEXEC" ] && $package_name $root 1.69 + #[ "$AUTOEXEC" ] && chroot $root/ $package_name 1.70 + [ "$AUTOEXEC" ] && $package_name $root 1.71 update_databases 1.72 } 1.73 1.74 -# Install all missing deps. Auto install or ask user then install all missing 1.75 -# deps from local dir, cdrom, media or from the mirror. In case we want to 1.76 -# install packages from local, we need a packages.list to find the version. 1.77 -# Parameters: package List of deps to install 1.78 +# Install all missing deps of a package. 1.79 +# Usage: install_deps package DEPENDS 1.80 install_deps() { 1.81 local package=$1 1.82 shift 1.83 local deps="$@" 1.84 - 1.85 - gettext "Install all missing dependencies? " 1.86 - 1.87 - # Print Yes/No and get result 1.88 - if $AUTO_INSTALL_DEPS || confirm; then 1.89 - for pkgorg in $deps; do 1.90 - local pkg=$(equivalent_pkg $pkgorg) 1.91 - # Check if package is not installed 1.92 - if [ ! -d "$installed/$pkg" ]; then 1.93 - if [ ! -f "$PKGS_DB/packages.list" ]; then 1.94 - tazpkg recharge 1.95 - fi 1.96 - spk-add $pkg 1.97 + for pkgorg in $deps; do 1.98 + local pkg=$(equivalent_pkg $pkgorg) 1.99 + # Check if package is not installed 1.100 + if [ ! -d "$installed/$pkg" ]; then 1.101 + if [ ! -f "$PKGS_DB/packages.list" ]; then 1.102 + #spk-up --recharge-only 1.103 + tazpkg recharge 1.104 fi 1.105 - done 1.106 - else 1.107 - newline 1.108 - boldify $(gettext "Package:") $package 1.109 - gettext \ 1.110 - "Dependencies unresolved. Installed but will probably not work." 1.111 - newline && newline 1.112 - fi 1.113 + spk-add $pkg 1.114 + fi 1.115 + done 1.116 } 1.117 1.118 #