OpenPKG CVS Repository http://cvs.openpkg.org/ ____________________________________________________________________________
Server: cvs.openpkg.org Name: Thomas Lotterer Root: /v/openpkg/cvs Email: [EMAIL PROTECTED] Module: openpkg-tools Date: 10-Oct-2005 12:00:52 Branch: HEAD Handle: 2005101011005100 Modified files: openpkg-tools/cmd dev.sh Log: add a "erase" command to "openpkg dev" to ease privilege handling (like "install" does) Summary: Revision Changes Path 1.61 +50 -0 openpkg-tools/cmd/dev.sh ____________________________________________________________________________ patch -p0 <<'@@ .' Index: openpkg-tools/cmd/dev.sh ============================================================================ $ cvs diff -u -r1.60 -r1.61 dev.sh --- openpkg-tools/cmd/dev.sh 10 Oct 2005 09:58:53 -0000 1.60 +++ openpkg-tools/cmd/dev.sh 10 Oct 2005 10:00:51 -0000 1.61 @@ -2045,6 +2045,54 @@ done } +erase () { + force=0 + packages="" + while [ ".$1" != . ]; do + case ".$1" in + .-f ) force=1 ;; + * ) packages="${packages} $1" + esac + shift + done + if [ ".${packages}" = . ]; then + if [ ".$P" = . ]; then + die "package cannot be identified. Neither parameter given nor \$P set." + fi + all="$P" + else + all="${packages}" + fi + erasethem="" + for name in $all; do + rpmE -q $name >/dev/null 2>&1 + if [ $? -ne 0 ]; then + warn "nothing to erase for $name" + else + erasethem="$erasethem${erasethem:+ }$name" + fi + done + if [ ".$erasethem" != . ]; then + if [ ".$HOSTNAME" = . ]; then + HOSTNAME=`hostname` + fi + initmpx $E + if [ $force -ne 0 ]; then + echo "++ erasing $erasethem forced" + ssh -t -x "[EMAIL PROTECTED]" ${RPMCMD} -e "$erasethem" --nodeps + else + echo "++ erasing $erasethem" + ssh -t -x "[EMAIL PROTECTED]" ${RPMCMD} -e "$erasethem" + fi + for name in $erasethem; do + rpmE -q $name >/dev/null 2>&1 + if [ $? -eq 0 ]; then + error "failed to erase $name" + fi + done + fi +} + install () { force=0 packages="" @@ -2707,6 +2755,7 @@ \$ openpkg dev build # [[spec]...] [-f][-f][-D with...] build a package (force, option) \$ openpkg dev clean # [-l][-t][-f] [[spec]...] clean logs and/or temp (force all) \$ openpkg dev diff # alias for "release -dry" + \$ openpkg dev erase # [[spec]...] [-f] erase a package (forcibly) \$ openpkg dev execute # [exec] execute command on instance closest to branch \$ openpkg dev fetch # [[spec]...] [-s][-a] fetch sources; clean selected or all dst files \$ openpkg dev help # display this command summary and update 00README @@ -2781,6 +2830,7 @@ build | bu* ) cmd="build" ;; clean | cl* ) cmd="clean" ;; diff | di* ) cmd="diff" ;; + erase | er* ) cmd="erase" ;; execute | ex* ) cmd="execute" ;; fetch | fe* ) cmd="fetch" ;; help | he* ) cmd="help" ;; @@ . ______________________________________________________________________ The OpenPKG Project www.openpkg.org CVS Repository Commit List openpkg-cvs@openpkg.org