summaryrefslogtreecommitdiff
blob: b88c31fee38f6dcede2d98c00fd5a762d4f1efb4 (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
43
44
45
46
47
48
49
50
# Copyright 1999-2018 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

EAPI=6

DESCRIPTION="First setup for SharkBait systems"
HOMEPAGE="https://github.com/KireinaHoro/sharkbait-setup"
SRC_URI="https://github.com/KireinaHoro/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"

LICENSE="GPL-3"
SLOT="0"
KEYWORDS="~arm64"
IUSE=""

DEPEND=""
RDEPEND="${DEPEND}
>=app-emulation/lxc-3.0.0
"

src_install() {
	exec_list=(
	deploy.sh
	pre-start.sh
	post-stop.sh
	)
	target="${EPREFIX}"/usr/lib/sharkbait-setup
	insinto	"${target}"
	exeinto	"${target}"
	for a in config devices; do
		doins -r "${a}"
	done
	for a in "${exec_list[@]}"; do
		doexe "${a}"
	done
	dosym "${target}"/deploy.sh "${EPREFIX}"/usr/bin/sharkbait-deploy
}

pkg_postinst() {
	device=$(sed -E -n 's/.*androidboot.hardware=(\S*).*/\1/p' /proc/cmdline)
	if [ -d "${EPREFIX}/usr/lib/sharkbait-setup/devices/${device}" ] ; then
		einfo "Run \`sharkbait-deploy ${device}\` to setup SharkBait for your device."
	else
		if [ -z "$device" ] ; then
			ewarn "We failed to detect the device name."
		else
			ewarn "The device $device is not yet supported by sharkbait-setup."
		fi
		ewarn "Consult Porter's guide for how to add support for this device."
	fi
}