summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 9d3c8d34ec3cc3949d6de583e461e2440e23d45c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# Maintainer: Anatoly Rugalev <anatoly.rugalev g-mail>

pkgname=simple-rt
pkgver=20190920_9b63526
pkgrel=1
url="https://github.com/vvviperrr/SimpleRT"
pkgdesc="SimpleRT - Reverse Tethering utility for Android"
arch=('x86' 'x86_64')
depends=('libusb' 'net-tools')
makedepends=('git' 'make')
source=('simple-rt::git://github.com/vvviperrr/SimpleRT' 'simple-rt@.service')
md5sums=('SKIP' 'abce660a402beaf33a2e964d140294d6')
license=('GPLv3')

pkgver() {
	cd "$srcdir/$pkgname"
	local date=$(git log -1 --format="%cd" --date=short | sed s/-//g)
	local count=$(git rev-list --count HEAD)
	local commit=$(git rev-parse --short HEAD)
	echo "$date.${count}_$commit"
}

build() {
	cd "$srcdir/simple-rt/simple-rt-cli"
	make iface_up_sh_path=/usr/libexec/simple-rt
	export SIMPLERT_INTERFACE=$(ip link show | grep "state UP" | awk -F ': ' '{ print $2}')
        if [ `echo "$SIMPLERT_INTERFACE" | wc -l` -eq 1 ]; then 
                cat "$srcdir/simple-rt@.service" | sed -e "s/%i/$SIMPLERT_INTERFACE/g" > "$srcdir/simple-rt.service"
        fi
}

package() {
	mkdir -p "$pkgdir/usr/lib/simple-rt"
	mkdir -p "$pkgdir/usr/libexec/simple-rt"
	mkdir -p "$pkgdir/etc/systemd/system/multi-user.target.wants"
	install -m755 "$srcdir/simple-rt/simple-rt-cli/simple-rt" "$pkgdir/usr/lib/simple-rt/simple-rt"
	install -m755 "$srcdir/simple-rt/simple-rt-cli/iface_up.sh" "$pkgdir/usr/libexec/simple-rt/iface_up.sh"
	install -DT -m0755 "$srcdir/simple-rt@.service" "$pkgdir/usr/lib/systemd/system/simple-rt@.service"
        if [ -e "$srcdir/simple-rt.service" ]; then 
                install -DT -m0755 "$srcdir/simple-rt.service" "$pkgdir/usr/lib/systemd/system/simple-rt.service"
        fi
}