Skip to content

Commit

Permalink
bee-remove: Remove --noop option..
Browse files Browse the repository at this point in the history
--noop does not work with bee-cache and
probably never worked since bee-dep was used.
  • Loading branch information
mariux committed Jul 30, 2012
1 parent 090e555 commit c236e29
Showing 1 changed file with 6 additions and 14 deletions.
20 changes: 6 additions & 14 deletions src/bee-remove.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -78,22 +78,20 @@ function do_remove() {
exit 1
fi

[ "${NOOP}" != "yes" ] && \
run_hooks pre-remove ${pkg} ${BEE_METADIR}/${pkg}/CONTENT.bee-remove
run_hooks pre-remove ${pkg} ${BEE_METADIR}/${pkg}/CONTENT.bee-remove

FILES=( $(bee-cache --tmpinstall "${pkg}" print-uniq-files "${pkg}") )

# removing files
for f in "${FILES[@]}" ; do
if [ -d "${f}" -a ! -h "$f" ] ; then
${NOOP:+echo} rmdir ${OPT_VERBOSE:+-v} ${f}
rmdir ${OPT_VERBOSE:+-v} ${f}
else
${NOOP:+echo} rm -f ${OPT_VERBOSE:+-v} ${f}
rm -f ${OPT_VERBOSE:+-v} ${f}
fi
done

[ "${NOOP}" != "yes" ] && \
run_hooks post-remove ${pkg} ${BEE_METADIR}/${pkg}/CONTENT.bee-remove
run_hooks post-remove ${pkg} ${BEE_METADIR}/${pkg}/CONTENT.bee-remove

if [ -r "${BEE_METADIR}/${pkg}/META" ] ; then
. "${BEE_METADIR}/${pkg}/META"
Expand Down Expand Up @@ -129,13 +127,13 @@ function do_remove() {
# filesystem anymore and we have an index db 8)
# using bee dep here is currently to slow 8(
if [ -z "$(bee-query ${dir} | head -1)" ] ; then
${NOOP:+echo} rmdir ${OPT_VERBOSE:+-v} ${dir}
rmdir ${OPT_VERBOSE:+-v} ${dir}
fi
done
fi

#cleanup meta directory
${NOOP:+echo} rm -fr ${OPT_VERBOSE:+-v} ${BEE_METADIR}/${pkg}
rm -fr ${OPT_VERBOSE:+-v} ${BEE_METADIR}/${pkg}
bee-cache update ${pkg}
}

Expand All @@ -160,14 +158,12 @@ function usage() {
Options:
-h, --help display this help
-n, --noop do not actually remove; just print
-v, --verbose print removed files and directories
EOF
}

options=$(${BEE_BINDIR}/beegetopt --name bee-remove \
--option noop/n \
--option verbose/v \
--option help/h \
-- "$@")
Expand All @@ -180,10 +176,6 @@ eval set -- "${options}"

while true ; do
case "$1" in
--noop)
shift
NOOP="yes"
;;
--help)
usage
exit
Expand Down

0 comments on commit c236e29

Please sign in to comment.