summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorJordan Klassen2015-04-28 23:16:38 -0700
committerJordan Klassen2015-04-28 23:16:38 -0700
commit62ed83a404b8e0bbe4a963ffd86fb6440c6c8d08 (patch)
tree32218ada4b8190a6fab639689b10a6b75a0341f2
downloadaur-62ed83a404b8e0bbe4a963ffd86fb6440c6c8d08.tar.gz
Add the teamspeak addon installer script
This mints pacman packages on the fly. I don't know if there's any kind of taboo against it, but it seems like a decent idea, and the best way to add teamspeak addons without cluttering your install directory. Because we're better than windows & mac scrubs :)
-rw-r--r--.SRCINFO13
-rw-r--r--PKGBUILD18
-rw-r--r--teamspeak3-install-addon71
3 files changed, 102 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 000000000000..b419cdd60c2e
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,13 @@
+pkgbase = teamspeak3-addon-installer
+ pkgdesc = Simple script to install packages from Teamspeak 3's addon site. Automatically creates packages for the teamspeak directory
+ pkgver = 0.1
+ pkgrel = 1
+ url = https://github.com/forivall/aur-packages
+ arch = any
+ license = WTFPL
+ depends = teamspeak3
+ source = teamspeak3-install-addon
+ sha1sums = c9d5eac3e63a50e4c0990f146101f0609c7b6a76
+
+pkgname = teamspeak3-addon-installer
+
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..64d753651b35
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,18 @@
+# Maintainer: Jordan Klassen <jordan@klassen.me.uk>
+pkgname='teamspeak3-addon-installer'
+pkgver=0.1
+pkgrel=1
+pkgdesc='Simple script to install packages from Teamspeak 3'\''s addon site. Automatically creates packages for the teamspeak directory'
+arch=('any')
+url='https://github.com/forivall/aur-packages'
+license=('WTFPL')
+depends=('teamspeak3')
+source=('teamspeak3-install-addon')
+sha1sums=('c9d5eac3e63a50e4c0990f146101f0609c7b6a76')
+
+package() {
+ mkdir -p -- "$pkgdir/usr/bin"
+ cp "teamspeak3-install-addon" "$pkgdir/usr/bin/teamspeak3-install-addon"
+}
+
+# vim:set ts=2 sw=2 et:
diff --git a/teamspeak3-install-addon b/teamspeak3-install-addon
new file mode 100644
index 000000000000..9a87a1315256
--- /dev/null
+++ b/teamspeak3-install-addon
@@ -0,0 +1,71 @@
+#!/usr/bin/env bash
+
+set -o errexit
+
+REL=1
+URL=$1
+
+if [[ -z "$URL" || "$URL" == "-h" ]] ; then
+ echo "Usage: teamspeak3-install-addon [URL] (url is the download link)"
+ if [[ "$URL" == "-h" ]] ; then exit ; fi
+ exit 1
+fi
+
+TMPDIR="$(mktemp -d --suffix=-teamspeak3-install-addon)"
+
+cd "$TMPDIR"
+echo "Using temporary directory $TMPDIR"
+curl -L -o addon.zip "$URL"
+unzip -d addon addon.zip
+
+TYPE="$(< addon/package.ini grep '^Type *='|cut -d= -f2|sed 's/ //g'|tr "[:upper:]" "[:lower:]"|tr ' ' -|tr -d '\r\n')"
+VERSION="$(< addon/package.ini grep -i '^Version *='|cut -d= -f2|tr -d ' \r\n')"
+NAME="$(< addon/package.ini grep -i '^Name *='|cut -d= -f2|sed 's/^ //g'|tr -d '\r\n')"
+PKGNAME="teamspeak3-addon-$TYPE-$(echo "$NAME"|tr "[:upper:]" "[:lower:]"|tr ' ' -|tr -d '\r\n')"
+
+mkdir "$PKGNAME"
+mv addon.zip "$PKGNAME"
+cd "$PKGNAME"
+
+> PKGBUILD sed \
+ -e "s/{TYPE}/$TYPE/" \
+ -e "s/{VERSION}/$VERSION/" \
+ -e "s/{NAME}/$NAME/" \
+ -e "s/{PKGNAME}/$PKGNAME/" \
+ -e "s|{URL}|$URL|" \
+<<PKGBUILD_END
+# Maintainer: You
+pkgname='{PKGNAME}'
+pkgver='{VERSION}'
+pkgrel=$REL
+pkgdesc='An addon for Teamspeak 3 - {NAME}'
+arch=('any')
+url='http://addons.teamspeak.com'
+license=('Unknown')
+depends=('teamspeak3')
+source=('addon.zip::{URL}')
+sha1sums=('UNUSED')
+
+package() {
+ cd -- "\$srcdir"
+ mkdir -p -- "\$pkgdir/opt/teamspeak3"
+ rm package.ini
+ rm addon.zip
+ find . -type f -exec chmod a-x {} \+
+ cp -R . "\$pkgdir/opt/teamspeak3"
+}
+PKGBUILD_END
+
+updpkgsums
+
+makepkg -S
+echo
+echo "Feel free to submit this package to AUR"
+echo "$TMPDIR/$PKGNAME"
+echo
+echo "Building binary package"
+echo
+makepkg
+echo
+echo "Installing package"
+sudo pacman -U "$PKGNAME-$VERSION-$REL-any.pkg.tar.xz"