Skip to content

Commit 9cb6285

Browse files
Lockywolfsbo-bot[bot]
authored andcommitted
network/demagnetize-rs-bin: Added (Convert Bittorrent Magnet).
1 parent 025fc8f commit 9cb6285

File tree

4 files changed

+160
-0
lines changed

4 files changed

+160
-0
lines changed

network/demagnetize-rs-bin/README

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
demagnetize is a Rust program for converting one or more BitTorrent
2+
magnet links into .torrent files by downloading the torrent info from
3+
active peers.
4+
5+
6+
Use like:
7+
8+
demagnetize -o file.torrent "magnet:..."
Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
#!/bin/bash
2+
3+
# Copyright 2025, Lockywolf
4+
# All rights reserved.
5+
#
6+
# Redistribution and use of this script, with or without modification, is
7+
# permitted provided that the following conditions are met:
8+
#
9+
# 1. Redistributions of this script must retain the above copyright
10+
# notice, this list of conditions and the following disclaimer.
11+
#
12+
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
13+
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
14+
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
15+
# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
16+
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
17+
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
18+
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
19+
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
20+
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
21+
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
22+
23+
cd $(dirname $0) ; CWD=$(pwd)
24+
25+
PRGNAM=demagnetize-rs-bin
26+
VERSION=${VERSION:-0.6.1}
27+
BUILD=${BUILD:-1}
28+
TAG=${TAG:-_SBo}
29+
PKGTYPE=${PKGTYPE:-tgz}
30+
31+
if [ -z "$ARCH" ]; then
32+
case "$( uname -m )" in
33+
i?86) ARCH=i586 ;;
34+
arm*) ARCH=arm ;;
35+
*) ARCH=$( uname -m ) ;;
36+
esac
37+
fi
38+
39+
# If the variable PRINT_PACKAGE_NAME is set, then this script will report what
40+
# the name of the created package would be, and then exit. This information
41+
# could be useful to other scripts.
42+
if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
43+
echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
44+
exit 0
45+
fi
46+
47+
TMP=${TMP:-/tmp/SBo}
48+
PKG=$TMP/package-$PRGNAM
49+
OUTPUT=${OUTPUT:-/tmp}
50+
51+
if [ "$ARCH" = "i586" ]; then
52+
LIBDIRSUFFIX=""
53+
UNSUP=1
54+
elif [ "$ARCH" = "i686" ]; then
55+
LIBDIRSUFFIX=""
56+
UNSUP=1
57+
elif [ "$ARCH" = "x86_64" ]; then
58+
LIBDIRSUFFIX="64"
59+
elif [ "$ARCH" = "aarch64" ]; then
60+
LIBDIRSUFFIX="64"
61+
UNSUP=1
62+
else
63+
LIBDIRSUFFIX=""
64+
UNSUP=1
65+
fi
66+
67+
if [[ "$UNSUP" == 1 ]] ; then
68+
printf "Unsupported architecture: unknown.\n" 1>&2
69+
fi
70+
71+
set -e
72+
73+
TARNAM="${PRGNAM%-rs-bin}"
74+
75+
rm -rf $PKG
76+
mkdir -p $TMP $PKG $OUTPUT
77+
cd $TMP
78+
rm -rf $PRGNAM-$VERSION
79+
mkdir $PRGNAM-$VERSION
80+
cd $PRGNAM-$VERSION
81+
tar xvf $CWD/$TARNAM-$ARCH-unknown-linux-gnu.tar.*z*
82+
83+
chown -R root:root .
84+
find -L . \
85+
\( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
86+
-o -perm 511 \) -exec chmod 755 {} + -o \
87+
\( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
88+
-o -perm 440 -o -perm 400 \) -exec chmod 644 {} +
89+
90+
# Unpack the archive to /opt/
91+
install -d -m755 $PKG/opt
92+
install -d -m755 $PKG/opt/$PRGNAM-$VERSION
93+
mv $TARNAM-$ARCH-unknown-linux-gnu/$TARNAM $PKG/opt/$PRGNAM-$VERSION/
94+
95+
mkdir -p "$PKG"/usr/bin
96+
(
97+
cd $PKG/usr/bin
98+
ln -sr ../../opt/${PRGNAM}-${VERSION}/${TARNAM} ./
99+
)
100+
101+
PKGOPT=$PKG/opt/${TARNAM}-${VERSION}-${ARCH}
102+
103+
tar xvf $CWD/source.tar.gz
104+
105+
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
106+
cp -a \
107+
$TARNAM-$VERSION/README.md \
108+
$PKG/usr/doc/$PRGNAM-$VERSION
109+
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
110+
111+
mkdir -p $PKG/install
112+
cat $CWD/slack-desc > $PKG/install/slack-desc
113+
114+
if [[ "${PRGNAM: -4}" != "-bin" ]] ; then
115+
printf "Fatal Error: PRGNAM must end in '-bin', but now ends with %s\n" \
116+
"${PRGNAM: -4}"
117+
exit 2
118+
fi
119+
120+
cd $PKG
121+
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
PRGNAM="demagnetize-rs-bin"
2+
VERSION="0.6.1"
3+
HOMEPAGE="https://github.com/jwodder/demagnetize-rs"
4+
DOWNLOAD="UNSUPPORTED"
5+
MD5SUM=""
6+
DOWNLOAD_x86_64="https://github.com/jwodder/demagnetize-rs/releases/download/v0.6.1/demagnetize-x86_64-unknown-linux-gnu.tar.xz \
7+
https://github.com/jwodder/demagnetize-rs/releases/download/v0.6.1/source.tar.gz"
8+
MD5SUM_x86_64="588cd439976096ff67bcaf06abcbee08 \
9+
5c0286523590e8d3c6140780b4a032e8"
10+
REQUIRES=""
11+
MAINTAINER="Lockywolf"
12+
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# HOW TO EDIT THIS FILE:
2+
# The "handy ruler" below makes it easier to edit a package description.
3+
# Line up the first '|' above the ':' following the base package name, and
4+
# the '|' on the right side marks the last column you can put a character in.
5+
# You must make exactly 11 lines for the formatting to be correct. It's also
6+
# customary to leave one space after the ':' except on otherwise blank lines.
7+
8+
|-----handy-ruler------------------------------------------------------|
9+
demagnetize-rs-bin: demagnetize-rs-bin (convert magnet links to torrent files (rust))
10+
demagnetize-rs-bin:
11+
demagnetize-rs-bin: A program download metadata from a "magnet:" link and save it as a
12+
demagnetize-rs-bin: torrent file.
13+
demagnetize-rs-bin:
14+
demagnetize-rs-bin:
15+
demagnetize-rs-bin:
16+
demagnetize-rs-bin:
17+
demagnetize-rs-bin:
18+
demagnetize-rs-bin:
19+
demagnetize-rs-bin:

0 commit comments

Comments
 (0)