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
}
verbose="" ; no_dep=""
auto_resolve_deps=""
simulate=""
+base=""
+answer="y"
FL_DIR="var/adm/flists"
DEPS_DIR="var/adm/deps/run"
-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
if [ "$simulate" != "1" ] ; then
# remove the files/dirs
- ((supposed = 0))
- ((counter = 0))
+ #((supposed = 0))
+ #((counter = 0))
cat $fl_file | while read pkg file; do
- ((supposed += 1))
+ #((supposed += 1))
if [ -e $inst_root/$file ] ; then
if [ "$file" != "tmp" ] ; then
if [ -d $inst_root/$file ] ; then
rm -f $inst_root/$file > /dev/null 2>&1
rmdir -p `dirname $file` > /dev/null 2>&1
fi
- ((counter += 1))
+ #((counter += 1))
fi
fi
- echo -en "\rremoved $counter from $supposed supposed files"
+ #echo -en "\rremoved $counter from $supposed supposed files"
done
echo -en "\ndone.\n"
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"
+ [ "$dep" != "$pkg" ] &&
+ [ ! -f $inst_root/$FL_DIR/$dep-[0-9]* ] && \
+ udeps="$dep $udeps"
done
while [ "$udeps" != "$tudeps" ] ; do
tudeps="$udeps"
deps="`grep "^$tdep\ -" $DBF | sed 's/.* -//'`"
for dep in $deps; do
exists=0
+ [ "$dep" = "$pkg" ] && break
[ -f $inst_root/$FL_DIR/$dep-* ] && \
break
for i in $udeps; do
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 [ ".$udeps" != "." ] ; then
+ echo "$pkg uninstalled depends:"
+ echo "$udeps"
+ echo
+ echo "continue? [y,n] (default 'n')"
+ answer="n"
+ if [ "$auto_resolve_deps" != "1" ] ; 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
+ if [ "$simulate" != "1" -a "$answer" = "y" ] ; then
# check/install package
if [ -f $package ] ; 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