aboutsummaryrefslogtreecommitdiff
path: root/network/mitmproxy-bin/mitmproxy-bin.SlackBuild
diff options
context:
space:
mode:
authorB. Watson <yalhcru@gmail.com>2022-01-27 11:24:38 -0500
committerWilly Sudiarto Raharjo <willysr@slackbuilds.org>2022-01-30 08:36:00 +0700
commit328784b29430e6e1eda388978b7dcdf8ffcae191 (patch)
tree1c9f627875c118c98fe365f77e3ee52531645fd9 /network/mitmproxy-bin/mitmproxy-bin.SlackBuild
parentd17bca972e018b295b8f887af0c3967ba99d4cf5 (diff)
network/mitmproxy-bin: Added (interactive HTTPS proxy).
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
Diffstat (limited to 'network/mitmproxy-bin/mitmproxy-bin.SlackBuild')
-rw-r--r--network/mitmproxy-bin/mitmproxy-bin.SlackBuild96
1 files changed, 96 insertions, 0 deletions
diff --git a/network/mitmproxy-bin/mitmproxy-bin.SlackBuild b/network/mitmproxy-bin/mitmproxy-bin.SlackBuild
new file mode 100644
index 0000000000000..43cda5c86bf89
--- /dev/null
+++ b/network/mitmproxy-bin/mitmproxy-bin.SlackBuild
@@ -0,0 +1,96 @@
+#!/bin/bash
+
+# Slackware build script for mitmproxy-bin
+
+# Written by B. Watson (yalhcru@gmail.com)
+
+# Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details.
+
+# I was gonna package this up from source, but it just has too many
+# dependencies, many of which aren't on SBo already. I'd have to add
+# at least 15 or 20 python modules, and I just won't. The official
+# binary release is "frozen" executables with no external Python
+# dependencies (just shared libs that are part of Slackware already).
+
+# This is mostly just a binary repack of the official build. Which
+# is only for x86_64 Linux (sorry, 32-bit users).
+
+# I named this with the -bin suffix so that someday someone (other
+# than me!) can do a proper build-from-source mitmproxy SlackBuild,
+# with tons of dependencies in REQUIRES...
+
+# There's *nothing* in the Linux tarball besides the executables, so
+# I've also included some docs from the source tarball, but not the
+# complete API docs (again, to avoid a long dependency chain of the
+# stuff needed to build them). Use https://docs.mitmproxy.org/stable/
+# for that.
+
+cd $(dirname $0) ; CWD=$(pwd)
+
+PRGNAM=mitmproxy-bin
+SRCNAM=mitmproxy
+VERSION=${VERSION:-7.0.4}
+BUILD=${BUILD:-1}
+TAG=${TAG:-_SBo}
+
+# Binary repack, only supports:
+ARCH=x86_64
+
+TMP=${TMP:-/tmp/SBo}
+PKG=$TMP/package-$PRGNAM
+OUTPUT=${OUTPUT:-/tmp}
+
+# If the user's trying to build this on a non-x86_64 box, it's
+# almost certainly a mistake on the user's part... but maybe not,
+# for smart users. So warn and pause, but allow it to happen.
+M="$(uname -m)"
+if [ "$M" != "x86_64" ]; then
+ W="* WARNING: cross-building x86_64 package on $M host. *"
+ H="$( echo "$W" | sed 's,.,*,g' )"
+ echo -e "$H\\n$W\\n$H\\n"
+ cat <<EOF
+You're about to build a 64-bit (x86_64) package, which will work fine
+if you install it on an x86_64 Slackware64 system... but not on *this*
+system, because it's $M, not x86_64.
+
+Press Enter or wait 5 seconds to continue. Or, press ^C to abort.
+EOF
+ read -p "> " -t 5
+fi
+
+set -e
+
+rm -rf $PKG
+mkdir -p $TMP $PKG $OUTPUT
+cd $TMP
+rm -rf $SRCNAM-$VERSION
+mkdir -p $SRCNAM-$VERSION
+cd $SRCNAM-$VERSION
+tar xvf $CWD/$SRCNAM-$VERSION-linux.tar.gz
+tar xvf $CWD/$SRCNAM-$VERSION.tar.gz
+chown -R root:root .
+find -L . -perm /111 -a \! -perm 755 -a -exec chmod 755 {} \+ -o \
+ \! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} \+
+
+# Already stripped.
+mkdir -p $PKG/usr/bin
+install -m0755 $SRCNAM mitmdump mitmweb $PKG/usr/bin
+
+# Stub man page. Just stuff copied from the README and a pointer to the
+# actual docs on the web.
+mkdir -p $PKG/usr/man/man1
+gzip -9c < $CWD/$SRCNAM.1 > $PKG/usr/man/man1/$SRCNAM.1.gz
+ln -s $SRCNAM.1.gz $PKG/usr/man/man1/mitmdump.1.gz
+ln -s $SRCNAM.1.gz $PKG/usr/man/man1/mitmweb.1.gz
+
+# Include README, etc from source tarball.
+cd $SRCNAM-$VERSION
+mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
+cp -a *.md LICENSE $PKG/usr/doc/$PRGNAM-$VERSION
+cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
+
+mkdir -p $PKG/install
+cat $CWD/slack-desc > $PKG/install/slack-desc
+
+cd $PKG
+/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}