system/slack-utils: Handle weird download filename.

Signed-off-by: B. Watson <yalhcru@gmail.com>

Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
This commit is contained in:
B. Watson 2022-02-10 03:08:46 -05:00 committed by Willy Sudiarto Raharjo
parent a42aeadb4b
commit b6aae79533
No known key found for this signature in database
GPG Key ID: 3F617144D7238786
1 changed files with 13 additions and 5 deletions

View File

@ -22,6 +22,8 @@
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# 20220210 bkw: Modified by SlackBuilds.org
cd $(dirname $0) ; CWD=$(pwd)
PRGNAM=slack-utils
@ -32,15 +34,12 @@ PKGTYPE=${PKGTYPE:-tgz}
if [ -z "$ARCH" ]; then
case "$( uname -m )" in
i?86) ARCH=i486 ;;
i?86) ARCH=i586 ;;
arm*) ARCH=arm ;;
*) ARCH=$( uname -m ) ;;
esac
fi
# If the variable PRINT_PACKAGE_NAME is set, then this script will report what
# the name of the created package would be, and then exit. This information
# could be useful to other scripts.
if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
exit 0
@ -52,12 +51,21 @@ OUTPUT=${OUTPUT:-/tmp}
set -e
# 20220210 bkw: we get gibberish in the filename depending on whether
# the downloader (wget, browser, etc) respects the Content-disposition
# header. Handle either possibility.
TARBALL=$CWD/$PRGNAM-$VERSION.tar.gz
[ -e $TARBALL ] || TARBALL="$( /bin/ls $TARBALL\?* 2>/dev/null | head -1 )"
[ -z "$TARBALL" ] && echo "Can't find the source tarball!" && exit 1
rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $PRGNAM-$VERSION
tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
tar xvf $TARBALL
cd $PRGNAM-$VERSION
find -L . -perm /111 -a \! -perm 755 -a -exec chmod 755 {} \+ -o \
\! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} \+
# Fix renamed Config -> RbConfig
sed -i -e 's/::Config::CONFIG/::RbConfig::CONFIG/' setup.rb