X-Git-Url: https://hackdaworld.org/gitweb/?a=blobdiff_plain;f=misc%2Fhdw-tools%2Fhdw-get;h=7f2d1e6202cde775ae18b47813355ac7e272f162;hb=f5392ac6a08f8ee45154ab0ce31db7ed6a668920;hp=9ff72ec5b3acff5ce7db421cdbfbce784dd051c2;hpb=563012de8957e4c29943d3bd32a5073e9e350b81;p=hdw-linux%2Fhdw-linux.git diff --git a/misc/hdw-tools/hdw-get b/misc/hdw-tools/hdw-get index 9ff72ec..7f2d1e6 100644 --- a/misc/hdw-tools/hdw-get +++ b/misc/hdw-tools/hdw-get @@ -11,12 +11,14 @@ usage() { echo "usage:" echo "$0 [install/remove] [root] [package]" echo "$0 [dist-install] [root] [dist file]" + echo "$0 [update]" echo echo "options:" echo "-v tell me whats going on" echo "-a auto resolve deps, do not prompt user" echo "-no-dep do not care for dependencies (used by hdw-get itself)" echo "-s simulation only, do not install/remove packages" + echo "-b base package, not listed in hdw-get.db" echo } @@ -26,6 +28,8 @@ d_install="" ; install="" verbose="" ; no_dep="" auto_resolve_deps="" simulate="" +base="" +answer="y" FL_DIR="var/adm/flists" DEPS_DIR="var/adm/deps/run" @@ -46,6 +50,7 @@ while [ "$1" ] ; do -a) auto_resolve_deps="1" ; shift 1 ;; -no-dep) no_dep="1" ; shift 1 ;; -s) simulate="1" ; shift 1 ;; + -b) base="1" ; no_dep="1" ; shift 1;; *) usage ; exit 1 ;; esac done @@ -77,9 +82,6 @@ if [ "$update" = "1" ] ; then echo -en " done. (`cat $DBF | wc -l` packages)\n" fi -# create temp directory -mkdir -p /tmp/.hdw-get - # remove if [ "$remove" = "1" ] ; then # check if packages depend on package to be removed @@ -127,22 +129,6 @@ if [ "$remove" = "1" ] ; then if [ "$simulate" != "1" ] ; then - # care about info/dir file - rm -f /tmp/.hdw-get/dir* ; modify_info_dir="" - if [ -n "`grep usr/share/info/dir $fl_file`" ] ; then - modify_info_dir="1" - cp $inst_root/usr/share/info/dir /tmp/.hdw-get/ - for info_obj in `grep 'usr/share/info/.*.info' $fl_file | \ - awk -F/ '{ print $4 }'`; do - info_o=`echo $info_obj | sed 's/.info//'` - [ "$verbose" ] && echo "deleting $info_o from info/dir" - grep -v \($info_o\)\. /tmp/.hdw-get/dir | \ - grep -v ^$package\ info\ -\ added\ by\ hdw > \ - /tmp/.hdw-get/dir~ - mv /tmp/.hdw-get/dir~ /tmp/.hdw-get/dir - done - fi - # remove the files/dirs ((supposed = 0)) ((counter = 0)) @@ -163,12 +149,13 @@ if [ "$remove" = "1" ] ; then done echo -en "\ndone.\n" - # reinstall info/dir file - if [ "$modify_info_dir" ] ; then - [ "$verbose" ] && echo "restoring modified info/dir file" - cp /tmp/.hdw-get/dir $inst_root/usr/share/info/dir - rm -f /tmp/.hdw-get/dir* - fi + # care about info/dir file + echo "recreating info dir file ..." + cd $inst_root/usr/share/info + rm -f dir + for f in *; do + install-info $f dir 2>/dev/null + done fi @@ -193,20 +180,23 @@ elif [ "$install" = "1" ] ; then fi # package in database? - if [ "`grep "^$pkg\ -" $DBF`" = "" ] ; then - echo "sorry, package $package not found ..." - echo "(use 'hdw-get update' to update database)" - exit 1 + if [ -z $base ] ; then + if [ "`grep "^$pkg\ -" $DBF`" = "" ] ; then + echo "sorry, package $package not found ..." + echo "(use 'hdw-get update' to update database)" + exit 1 + fi fi # check for runtime deps - if [ -z $no_deps ] ; then + if [ -z $no_dep ] ; then deps="`grep "^$pkg\ -" $DBF | sed 's/.* -//'`" udeps="" tudeps="" for dep in $deps; do - [ ! -f $inst_root/$FL_DIR/$dep-* ] && \ - udeps="$dep $udeps" + [ ! -f $inst_root/$FL_DIR/$dep-[0-9]* ] && \ + [ "$pkg" != "$dep" ] && \ + udeps="$dep $udeps" done while [ "$udeps" != "$tudeps" ] ; do tudeps="$udeps" @@ -220,33 +210,29 @@ elif [ "$install" = "1" ] ; then [ "$i" = "$dep" ] && exists=1 done [ "$exists" = "0" ] && \ - udeps="$udeps $dep" + [ "$dep" != "$pkg" ] && \ + udeps="$udeps $dep" done done done - echo "$pkg depends on the following uninstalled packages:" - echo "$udeps" - echo - echo "continue? [y,n] (default 'n')" - if [ -z $auto_resolve_deps ] ; then - read answer - if [ "$answer" = "y" ] ; then - for i in $udeps; do - [ "$simulate" != "1" ] && \ - $0 -no-dep install $inst_root $i - done + if [ -n "$udeps" ] ; then + echo "$pkg has unresolved dependencies:" + echo "-> $udeps <-" + echo + echo "continue? [y,n] (default 'n')" + if [ -z $auto_resolve_deps ] ; then + read answer + if [ "$answer" = "y" ] ; then + for i in $udeps; do + [ "$simulate" != "1" ] && \ + $0 -no-dep install $inst_root $i + done + fi fi fi fi - if [ "$simulate" != "1" ] ; then - - # store info/dir file - rm -f /tmp/.hdw-get/dir* - if [ -f $inst_root/usr/share/info/dir ] ; then - [ "$verbose" ] && echo "backing up info/dir file" - cp $inst_root/usr/share/info/dir /tmp/.hdw-get/ - fi + if [ "$simulate" != "1" -a "$answer" != "n" ] ; then # check/install package if [ -f $package ] ; then @@ -277,29 +263,13 @@ elif [ "$install" = "1" ] ; then exit 1 fi - # merging info/dir file - if [ "$pkg" != "00-dirtree" ] ; then - fl_file=`ls -A $inst_root/$FL_DIR/$pkg-[0-9]* | tail -1` - if [ -n "`grep usr/share/info/dir $fl_file`" ] ; then - echo "" >> /tmp/.hdw-get/dir - echo "$pkg info - added by hdw `date`" >> /tmp/.hdw-get/dir - for info_obj in `grep 'usr/share/info/.*.info' $fl_file | \ - awk -F/ '{ print $4 }'`; do - info_o=`echo $info_obj | sed 's/.info//'` - if [ -z "`grep \($info_o\)\. /tmp/.hdw-get/dir`" ] - then - [ "$verbose" ] && \ - echo "merging $info_o to info/dir" - grep \($info_o\)\. \ - $inst_root/usr/share/info/dir >> \ - /tmp/.hdw-get/dir - fi - done - fi - fi - [ -f /tmp/.hdw-get/dir ] && \ - cp /tmp/.hdw-get/dir $inst_root/usr/share/info/dir - rm -f /tmp/.hdw-get/dir + # care about info/dir file + echo "recreating info dir file ..." + cd $inst_root/usr/share/info + rm -f dir + for f in *; do + install-info $f dir 2>/dev/null + done fi @@ -312,11 +282,10 @@ elif [ "$d_install" = "1" ] ; then # install all distribution related packages for package in `cat $dist_file`; do # execute myelf - $0 install $inst_root $package + auto="" + [ "$auto_resolve_deps" = "1" ] && auto="-a" + $0 $auto -b install $inst_root $package done fi fi -# remove temp directory -rm -rf /tmp/.hdw-get -