diff options
author | rhatto <rhatto@370017ae-e619-0410-ac65-c121f96126d4> | 2008-09-03 03:50:43 +0000 |
---|---|---|
committer | rhatto <rhatto@370017ae-e619-0410-ac65-c121f96126d4> | 2008-09-03 03:50:43 +0000 |
commit | dda36349496e0987f0ccf4f23929f7870ba11813 (patch) | |
tree | 1b469ee961c93e7f3565a52a6c50a0caba9afa9c /net/mail | |
parent | b1c576dfbc932afc7c1ecc09348df2dcc5ac3fc7 (diff) | |
download | slackbuilds-dda36349496e0987f0ccf4f23929f7870ba11813.tar.gz slackbuilds-dda36349496e0987f0ccf4f23929f7870ba11813.tar.bz2 |
merging with changes made since 21th May
git-svn-id: svn+slack://slack.fluxo.info/var/svn/slackbuilds@1903 370017ae-e619-0410-ac65-c121f96126d4
Diffstat (limited to 'net/mail')
-rwxr-xr-x | net/mail/mairix/mairix.SlackBuild | 303 | ||||
-rwxr-xr-x | net/mail/offlineimap/offlineimap.SlackBuild | 176 |
2 files changed, 310 insertions, 169 deletions
diff --git a/net/mail/mairix/mairix.SlackBuild b/net/mail/mairix/mairix.SlackBuild index 97e78cc3..2aa850ae 100755 --- a/net/mail/mairix/mairix.SlackBuild +++ b/net/mail/mairix/mairix.SlackBuild @@ -1,195 +1,167 @@ #!/bin/bash # -# mairix.SlackBuild is free software; you can redistribute it and/or modify it under the -# terms of the GNU General Public License as published by the Free Software -# Foundation; either version 2 of the License, or any later version. +# mairix.SlackBuild is free software; you can redistribute +# it and/or modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the License, +# or any later version. # -# mairix.SlackBuild is distributed in the hope that it will be useful, but WITHOUT ANY -# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR -# A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# mairix.SlackBuild is distributed in the hope that it will +# be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. # -# You should have received a copy of the GNU General Public License along with -# this program; if not, write to the Free Software Foundation, Inc., 59 Temple -# Place - Suite 330, Boston, MA 02111-1307, USA +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA # -# slackbuild script for mairix -# by rhatto at riseup.net +# slackbuild for mairix, by Silvio Rhatto +# requires: +# tested: mairix-0.21 # -if [ -s "slack-required" ]; then - echo Recomended and required packages for building mairix are: - cat slack-required | sed -e 's/^/\t/' - if [ "$INTERACT" != "no" ]; then - echo If you dont have those installed, press Ctrl-C. Otherwise, hit ENTER. - read crap -# else -# echo Sleeping 3 seconds... -# sleep 3 - fi -fi - -CWD="`pwd`" - +# Look for slackbuildrc if [ -f ~/.slackbuildrc ]; then source ~/.slackbuildrc elif [ -f /etc/slackbuildrc ]; then source /etc/slackbuildrc fi -# default settings -PACKAGE="mairix" +# Set variables +CWD="$(pwd)" +SRC_NAME="mairix" +PKG_NAME="mairix" ARCH=${ARCH:=i486} -VERSION=${VERSION:=0.19} +SRC_VERSION=${VERSION:=0.21} +PKG_VERSION="$(echo "$SRC_VERSION" | tr '[[:blank:]-]' '_')" BUILD=${BUILD:=1rha} -SRC_DIR=${SRC:=$CWD} +SRC_DIR=${SRC_DIR:=$CWD}/$PKG_NAME TMP=${TMP:=/tmp} +PKG=${PKG:=$TMP/package-$PKG_NAME} REPOS=${REPOS:=$TMP} - -if [ "$ARCH" == "x86_64" ]; then - export LDFLAGS="-L/lib64 -L/usr/lib64" - LIBDIR=/usr/lib64 -else - LIBDIR=/usr/lib +PREFIX=${PREFIX:=/usr} +PKG_WORK="$TMP/$SRC_NAME" +CONF_OPTIONS=${CONF_OPTIONS:=""} +NUMJOBS=${NUMJOBS:=""} + +# Set system libraries' path and optmization flags based on $ARCH +LIBDIR="$PREFIX/lib" + +if [ "$ARCH" = "i386" ]; then + SLKCFLAGS="-O2 -march=i386 -mcpu=i686" +elif [ "$ARCH" = "i486" ]; then + SLKCFLAGS="-O2 -march=i486 -mcpu=i686" +elif [ "$ARCH" = "i686" ]; then + SLKCFLAGS="-O2 -march=i686" +elif [ "$ARCH" = "s390" ]; then + SLKCFLAGS="-O2" +elif [ "$ARCH" = "x86_64" ]; then + SLKCFLAGS="-O2 -fPIC" + LIBDIR="$PREFIX/lib64" + LDFLAGS="-L/lib64 -L/usr/lib64" fi -# ------- error codes for createpkg -------------- +# Set error codes (used by createpkg) ERROR_WGET=31; ERROR_MAKE=32; ERROR_INSTALL=33 ERROR_MD5=34; ERROR_CONF=35; ERROR_HELP=36 ERROR_TAR=37; ERROR_MKPKG=38; ERROR_GPG=39 -ERROR_PATCH=40 - -RTOOL="wget" -PACKAGE_EXT="gz" -SRC="$PACKAGE-$VERSION.tar.$PACKAGE_EXT" -URL="http://easynews.dl.sourceforge.net/sourceforge/mairix/$SRC" -SIG="$PACKAGE-$VERSION-tar-gz-asc.txt" -SIG_URL="http://www.rpcurnow.force9.co.uk/mairix/$SIG" - -gpg --import << EOF ------BEGIN PGP PUBLIC KEY BLOCK----- -Version: GnuPG v1.2.3 (GNU/Linux) - -mQGiBDls5WERBADcHuihXLXH2eOkQVgzl/M7UJuVN9fz8lcbmKYZX7zeaDF8tgR+ -PwmL3khiQZj0sxvPlUOCOfWXwegcGGzoztgB+j+E8Y+buDbGP9bcv4n/CFZ5/3RU -QpPTwAzUx9VnPWvPxamabCHb9F+6BWo0piHafWDSKEaN1AllvAU+9zRfjwCgzRfF -EdAcWmJWgZfjIapK1+Wq0g0D/jSymdlmiKo1fiLuXsvJAqDYidlGWaveEBwq8twM -qpQ1mXxlFatA5Oi1S0ZS0TC5cNfyBYv4s5OxRRVBe2v4iM01XP4JaYR2Gx5VAjkw -9ZYp6M9BWU0TDImZuY0teM9614EIFyFznvegS6VNFAk7vGPbu3+sPW9dfK/NCsOa -IigzBADaKGH+epArnAev+TmfmrROdDJrrGkkzA8PzZQM+9VVYcqpfkpcuFKz8vFr -E2RiqzjBpI6P899j7B6+UktryCy3Ha1fN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cu -Zm9yY2U5LmNvLnVrPoheBBMRAgAeBQI/nCfMAhsDBgsJCAcDAgMVAgMDFgIBAh4B -AheAAAoJECAJ33qn0z3sVRAAoLsQtka0AY3RhfLQOlk45KW1/hH0AJ4n8bTV8iyj -fuvsMRxXoerIX8BI0rkBjQQ5bOcoEAYAtiw2lhJ5SghGR+Kx8wjWxk9MwrdF0i0K -wLTp0ILeNpYY40nrIRU7z+Pvpf0GujQtCXNW81ufK5cwhcUNyzCd2eL0F+wjcHa/ -sk+fUUo803dgzo7CADwNHSjihQJGt5d6G2boz8IxHPjV9Pkg+pgDxVRFWFY3KE66 -chY+kx2EEh1jshE1/toclxpTVRsV5npYHadpOho2ClNAo0tmPGx0A84HiqG/Fp2Z -VHoBIeO0yIShrPiojsdyYx7qsb1G3R//AAMHBfsGE4lFR8z6u6NeP9kW+g9cuWks -GG0Gp4s0v8Mg2c0v/W+85Zdvx+8LjbygYAMksjeUYhZJJe8jov2bJWPDzoeb2G5T -mg/DYG/cjLLVrUfMoDtt4zHBvqW16lrZ2yzAydpMKy885hmc1QUAB8xyMpLx/zQR -/UUuLJHZu8FeSkfEe6o7lwq+xwEQi/M1fqebous++ay3y/tS3x2t+4O4J9hgiezP -Iof3RlN+IjVrQ0gSZMnLew3+UEI5k+G9/fS5ar6ITgQYEQIABgUCOWznKAASCRAg -Cd96p9M97AdlR1BHAAEBNIYAn0tlnu/LIRZGV/gTfFBbED5VDF2vAKCllpFbtTd4 -iyEQhSCBS+wk6SoOgg== -=yT3y ------END PGP PUBLIC KEY BLOCK----- -EOF - -SRC_DIR="$SRC_DIR/$PACKAGE" -mkdir -p $SRC_DIR - -if [ "$RTOOL" == "wget" ]; then - if [ ! -f "$SRC_DIR/$SRC" ]; then - wget "$URL" -O "$SRC_DIR/$SRC" || exit $ERROR_WGET - fi - if [ ! -f "$SRC_DIR/$SIG" ]; then - wget "$SIG_URL" -O "$SRC_DIR/$SIG" || exit $ERROR_WGET - fi -fi +ERROR_PATCH=40; ERROR_VCS=41; ERROR_MKDIR=42 -gpg --verify $SRC_DIR/$SIG $SRC_DIR/$SRC || exit $ERROR_GPG +# Clean up any leftovers of previous builds +rm -rf "$PKG_WORK" 2> /dev/null +rm -rf "$PKG" 2> /dev/null -TMP="$TMP/$PACKAGE" -rm -rf $TMP -mkdir -p $TMP -cd $TMP +# Create directories if necessary +mkdir -p "$SRC_DIR" || exit $ERROR_MKDIR +mkdir -p "$PKG" || exit $ERROR_MKDIR +mkdir -p "$REPOS" || exit $ERROR_MKDIR +mkdir -p "$PKG_WORK" || exit $ERROR_MKDIR -tar xvf $SRC_DIR/$SRC || exit $ERROR_TAR -cd $PACKAGE-$VERSION +# Dowload source if necessary +SRC="$SRC_NAME-$VERSION.tar.gz" +URL="http://downloads.sourceforge.net/mairix/$SRC" -if [ -f "$CWD/$PACKAGE-$VERSION.diff" ]; then - patch -p1 < $CWD/$PACKAGE-$VERSION.diff || exit $ERROR_PATCH +if [ ! -s "$SRC_DIR/$SRC" ] || ! gunzip -t "$SRC_DIR/$SRC" 2> /dev/null; then + wget "$URL" -O "$SRC_DIR/$SRC" || exit $ERROR_WGET fi -./configure --prefix=/usr || exit $ERROR_CONF -make || exit $ERROR_MAKE -make DESTDIR=$TMP/package-$PACKAGE install || exit $ERROR_INSTALL - -CWD="`pwd`" +# Untar +cd "$PKG_WORK" +tar --no-same-owner --no-same-permissions -xvf "$SRC_DIR/$SRC" || exit $ERROR_TAR +PKG_SRC="$PWD/`ls -l | awk '/^d/ { print $NF }'`" +cd "$PKG_SRC" + +# Patch source +patches=" + $PKG_NAME.diff $PKG_NAME-$PKG_VERSION.diff + $PKG_NAME-$PKG_VERSION-$ARCH.diff $PKG_NAME-$ARCH.diff" +for patch in $patches; do + if [ -f "$CWD/$patch" ]; then + patch -Np1 < "$CWD/$patch" || exit $ERROR_PATCH + elif [ -f "$CWD/patches/$patch" ]; then + patch -Np1 < "$CWD/patches/$patch" || exit $ERROR_PATCH + elif [ -f "$CWD/$patch.gz" ]; then + gzip -dc "$CWD/$patch.gz" | patch -Np1 || exit $ERROR_PATCH + elif [ -f "$CWD/patches/$patch.gz" ]; then + gzip -dc "$CWD/patches/$patch.gz" | patch -Np1 || exit $ERROR_PATCH + fi +done -cd $TMP/package-$PACKAGE +if echo [[PATCH URLS]] | grep -q -v "PATCH URLS"; then + for patch_url in [[PATCH URLS]]; do + patch="`basename $patch_url`" + if [ ! -s "$SRC_DIR/$patch" ]; then + wget "$patch_url" -O "$SRC_DIR/$patch" || exit $ERROR_WGET + fi + if [ "`basename $patch .gz`" != "$patch" ]; then + gzip -dc $SRC_DIR/$patch | patch -Np1 || exit $ERROR_PATCH + elif [ "`basename $patch .bz2`" != "$patch" ]; then + bzip2 -dc $SRC_DIR/$patch | patch -Np1 || exit $ERROR_PATCH + else + patch -Np1 < "$SRC_DIR/$patch" || exit $ERROR_PATCH + fi + done +fi -find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null -find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null +# Configure +CFLAGS="$SLKCFLAGS" \ + CXXFLAGS="$SLKCFLAGS" \ + ./configure \ + --prefix="$PREFIX" $CONF_OPTIONS || exit $ERROR_CONF + +# Compile +make $NUMJOBS || exit $ERROR_MAKE + +# Install +make install DESTDIR="$PKG" || exit $ERROR_INSTALL + +# Strip binaries +( cd "$PKG" + find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | \ + xargs strip --strip-unneeded 2> /dev/null + find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | \ + xargs strip --strip-unneeded 2> /dev/null +) + +# Install documentation +DOCS="ACKNOWLEDGEMENTS COPYING NEWS README" +mkdir -p "$PKG/usr/doc/$PKG_NAME-$PKG_VERSION" || exit $ERROR_MKDIR +for doc in $DOCS; do + if [ -f "$doc" ]; then + cp -a $doc "$PKG/usr/doc/$PKG_NAME-$PKG_VERSION" + fi +done -mkdir install -cat << EOF > install/slack-desc +# Add package description (slack-desc) +mkdir -p "$PKG/install" || exit $ERROR_MKDIR +cat << EODESC > "$PKG/install/slack-desc" # HOW TO EDIT THIS FILE: -# The "handy ruler" below makes it easier to edit a package description. Line +# The "handy ruler" below makes it easier to edit a package description. Line # up the first '|' above the ':' following the base package name, and the '|' -# on the right side marks the last column you can put a character in. You must +# on the right side marks the last column you can put a character in. You must # make exactly 11 lines for the formatting to be correct. It's also # customary to leave one space after the ':'. - |-----handy-ruler-----------------------------------------------------| + |-----handy-ruler-------------------------------------------------------| mairix: mairix (index and search engine for mail folders) mairix: mairix: Mairix is a program for indexing and searching email messages stored @@ -201,20 +173,13 @@ mairix: mairix: mairix: mairix: -EOF - -# docs -mkdir -p usr/doc/$PACKAGE-$VERSION +EODESC -DOCS="ACKNOWLEDGEMENTS COPYING INSTALL NEWS README" - -for file in $DOCS; do - cp $CWD/$file* usr/doc/$PACKAGE-$VERSION/ -done - -makepkg -c y -l y $REPOS/$PACKAGE-$VERSION-$ARCH-$BUILD.tgz || exit $ERROR_MKPKG +# Build the package +cd "$PKG" +makepkg -l y -c n "$REPOS/$PKG_NAME-$PKG_VERSION-$ARCH-$BUILD.tgz" || exit $ERROR_MKPKG +# Delete source and build directories if requested if [ "$CLEANUP" == "yes" ]; then - rm -rf $TMP + rm -rf "$PKG_WORK" "$PKG" fi - diff --git a/net/mail/offlineimap/offlineimap.SlackBuild b/net/mail/offlineimap/offlineimap.SlackBuild new file mode 100755 index 00000000..8f6dadd1 --- /dev/null +++ b/net/mail/offlineimap/offlineimap.SlackBuild @@ -0,0 +1,176 @@ +#!/bin/bash +# +# offlineimap.SlackBuild is free software; you can redistribute +# it and/or modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the License, +# or any later version. +# +# offlineimap.SlackBuild is distributed in the hope that it will +# be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA +# +# slackbuild for offlineimap, by Silvio Rhatto +# requires: +# tested: offlineimap-6.0.2 +# + +# Look for slackbuildrc +if [ -f ~/.slackbuildrc ]; then + source ~/.slackbuildrc +elif [ -f /etc/slackbuildrc ]; then + source /etc/slackbuildrc +fi + +# Set variables +CWD="$(pwd)" +SRC_NAME="offlineimap" +PKG_NAME="offlineimap" +ARCH=${ARCH:=i486} +SRC_VERSION=${VERSION:=6.0.2} +PKG_VERSION="$(echo "$SRC_VERSION" | tr '[[:blank:]-]' '_')" +BUILD=${BUILD:=1rha} +SRC_DIR=${SRC_DIR:=$CWD}/$PKG_NAME +TMP=${TMP:=/tmp} +PKG=${PKG:=$TMP/package-$PKG_NAME} +REPOS=${REPOS:=$TMP} +PREFIX=${PREFIX:=/usr} +PKG_WORK="$TMP/$SRC_NAME" +CONF_OPTIONS=${CONF_OPTIONS:=""} +NUMJOBS=${NUMJOBS:=""} + +# Set system libraries' path and optmization flags based on $ARCH +LIBDIR="$PREFIX/lib" + +if [ "$ARCH" = "i386" ]; then + SLKCFLAGS="-O2 -march=i386 -mcpu=i686" +elif [ "$ARCH" = "i486" ]; then + SLKCFLAGS="-O2 -march=i486 -mcpu=i686" +elif [ "$ARCH" = "i686" ]; then + SLKCFLAGS="-O2 -march=i686" +elif [ "$ARCH" = "s390" ]; then + SLKCFLAGS="-O2" +elif [ "$ARCH" = "x86_64" ]; then + SLKCFLAGS="-O2 -fPIC" + LIBDIR="$PREFIX/lib64" + LDFLAGS="-L/lib64 -L/usr/lib64" +fi + +# Set error codes (used by createpkg) +ERROR_WGET=31; ERROR_MAKE=32; ERROR_INSTALL=33 +ERROR_MD5=34; ERROR_CONF=35; ERROR_HELP=36 +ERROR_TAR=37; ERROR_MKPKG=38; ERROR_GPG=39 +ERROR_PATCH=40; ERROR_VCS=41; ERROR_MKDIR=42 + +# Clean up any leftovers of previous builds +rm -rf "$PKG_WORK" 2> /dev/null +rm -rf "$PKG" 2> /dev/null + +# Create directories if necessary +mkdir -p "$SRC_DIR" || exit $ERROR_MKDIR +mkdir -p "$PKG" || exit $ERROR_MKDIR +mkdir -p "$REPOS" || exit $ERROR_MKDIR +mkdir -p "$PKG_WORK" || exit $ERROR_MKDIR + +# Dowload source if necessary +SRC="241?attachment_id=332" +URL="http://software.complete.org/software/versions/download/$SRC" + +if [ ! -s "$SRC_DIR/$SRC" ] || ! gunzip -t "$SRC_DIR/$SRC" 2> /dev/null; then + wget "$URL" -O "$SRC_DIR/$SRC" || exit $ERROR_WGET +fi + +# Untar +cd "$PKG_WORK" +tar --no-same-owner --no-same-permissions -xvf "$SRC_DIR/$SRC" || exit $ERROR_TAR +PKG_SRC="$PWD/`ls -l | awk '/^d/ { print $NF }'`" +cd "$PKG_SRC" + +# Patch source +patches=" + $PKG_NAME.diff $PKG_NAME-$PKG_VERSION.diff + $PKG_NAME-$PKG_VERSION-$ARCH.diff $PKG_NAME-$ARCH.diff" +for patch in $patches; do + if [ -f "$CWD/$patch" ]; then + patch -Np1 < "$CWD/$patch" || exit $ERROR_PATCH + elif [ -f "$CWD/patches/$patch" ]; then + patch -Np1 < "$CWD/patches/$patch" || exit $ERROR_PATCH + elif [ -f "$CWD/$patch.gz" ]; then + gzip -dc "$CWD/$patch.gz" | patch -Np1 || exit $ERROR_PATCH + elif [ -f "$CWD/patches/$patch.gz" ]; then + gzip -dc "$CWD/patches/$patch.gz" | patch -Np1 || exit $ERROR_PATCH + fi +done + +if echo [[PATCH URLS]] | grep -q -v "PATCH URLS"; then + for patch_url in [[PATCH URLS]]; do + patch="`basename $patch_url`" + if [ ! -s "$SRC_DIR/$patch" ]; then + wget "$patch_url" -O "$SRC_DIR/$patch" || exit $ERROR_WGET + fi + if [ "`basename $patch .gz`" != "$patch" ]; then + gzip -dc $SRC_DIR/$patch | patch -Np1 || exit $ERROR_PATCH + elif [ "`basename $patch .bz2`" != "$patch" ]; then + bzip2 -dc $SRC_DIR/$patch | patch -Np1 || exit $ERROR_PATCH + else + patch -Np1 < "$SRC_DIR/$patch" || exit $ERROR_PATCH + fi + done +fi + +# Build and install package +python setup.py build install --root=$PKG + +# Strip binaries +( cd "$PKG" + find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | \ + xargs strip --strip-unneeded 2> /dev/null + find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | \ + xargs strip --strip-unneeded 2> /dev/null +) + +# Install documentation +DOCS="COPYING COPYRIGHT FAQ.html README UPGRADING" +mkdir -p "$PKG/usr/doc/$PKG_NAME-$PKG_VERSION" || exit $ERROR_MKDIR +for doc in $DOCS; do + if [ -f "$doc" ]; then + cp -a $doc "$PKG/usr/doc/$PKG_NAME-$PKG_VERSION" + fi +done + +# Add package description (slack-desc) +mkdir -p "$PKG/install" || exit $ERROR_MKDIR +cat << EODESC > "$PKG/install/slack-desc" +# HOW TO EDIT THIS FILE: +# The "handy ruler" below makes it easier to edit a package description. Line +# up the first '|' above the ':' following the base package name, and the '|' +# on the right side marks the last column you can put a character in. You must +# make exactly 11 lines for the formatting to be correct. It's also +# customary to leave one space after the ':'. + + |-----handy-ruler--------------------------------------------------| +offlineimap: offlineimap +offlineimap: +offlineimap: OfflineIMAP is a tool to simplify your e-mail reading. +offlineimap: With OfflineIMAP, you can read the same mailbox from multiple +offlineimap: computers. You get a current copy of your messages on each computer, +offlineimap: and changes you make one place will be visible on all other systems. +offlineimap: For instance, you can delete a message on your home computer, and it +offlineimap: will appear deleted on your work computer as well. OfflineIMAP is +offlineimap: also useful if you want to use a mail reader that does not have IMAP +offlineimap: support, has poor IMAP support, or does not provide disconnected +offlineimap: operation. +EODESC + +# Build the package +cd "$PKG" +makepkg -l y -c n "$REPOS/$PKG_NAME-$PKG_VERSION-$ARCH-$BUILD.tgz" || exit $ERROR_MKPKG + +# Delete source and build directories if requested +if [ "$CLEANUP" == "yes" ]; then + rm -rf "$PKG_WORK" "$PKG" +fi |