summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: dcae66a9f10dd6d0872b938da56d5958d3c30c33 (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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87

# Maintainer: Matthias Eberlein
pkgname=youtube-to-mp3
pkgver=3.9.9.70
pkgrel=1
epoch=
pkgdesc="YouTube to Mp3 converter\nDownloads audio from YouTube or Vimeo and saves it to mp3 or m4a format to listen to locally"
arch=('any')
url="https://www.mediahuman.com/youtube-to-mp3-converter/"
license=('custom')
groups=()
depends=(
	'hicolor-icon-theme>=0.17-1'
	'qt5-multimedia>=5.14.1-1'
	'qt5-webkit>=5.212.0alpha4-1'
	'taglib>=1.11.1-3'
	)
makedepends=()
checkdepends=()
optdepends=()
provides=()
conflicts=()
replaces=()
backup=()
options=()
install=
changelog=
source_i386=("${pkgname}-${pkgver}.deb::https://www.mediahuman.com/de/download/YouTubeToMP3.i386.deb")
source_x86_64=("${pkgname}-${pkgver}.deb::https://www.mediahuman.com/de/download/YouTubeToMP3.amd64.deb")
noextract=()
md5sums_i386=("2cec4361b404408155c914ca39669d9d")
md5sums_x86_64=("b46ae0b0e8553c07aef451abc06e433a")
validpgpkeys=()

prepare() {
	##Starting Point: src dir with already extracted .deb package
	echo "Preparing the installation.."
	if [ ! -d "$pkgname-$pkgver" ]; then
		mkdir "$pkgname-$pkgver"
	else
		echo "Skipping creating subdirectory '$pkgname-$pkgver': Directory already exists."
	fi
	tar -xf "data.tar.xz" -C "${pkgname}-${pkgver}"
	tar -xf "control.tar.gz" -C "${pkgname}-${pkgver}"
}

pkgver() {
	cd "$pkgname-$pkgver"
	actualpackagename="$(cat "control" | grep "Package:")"
	if [[ ! "$actualpackagename" =~ .*"$pkgname" ]]; then
		echo "Package name changed. Please inform the Maintainer."
		exit -1
	fi
	actpkgverlong="$(cat "control" | grep "Version:")"
	actpkgver=${actpkgverlong##*: }
	if [[ ! "$actpkgverlong" == *"$pkgver" ]]; then
		cd ..
		mv "$pkgname-$pkgver.deb" "$pkgname-$actpkgver.deb"
		if [ -d "$pkgname-$actpkgver" ]; then
			rm -R "$pkgname-$actpkgver"
		fi
		mv -T "$pkgname-$pkgver" "$pkgname-$actpkgver"

		cd ..
		mv "$pkgname-$pkgver.deb" "$pkgname-$actpkgver.deb"
	fi
	echo "$actpkgver"
}

package() {
	## We still start in the src dir
	cd "$pkgname-$pkgver"

	# Copy the binaries and application to their destination in /pkg as root folder
	cp -r -i "usr" "$pkgdir/"
	cp -r -i "opt" "$pkgdir/"
	cp "usr/share/doc/youtube-to-mp3/copyright" "$pkgdir/LICENSE"

	# Remove .deb packages
	cd ../..
	echo "Cleaning up old unneeded .deb file.."
	rm "$pkgname-$pkgver.deb"

	# install the license
	echo "PKGDIR: $pkgdir"
	sudo install -Dm644 "$pkgdir/LICENSE" "/usr/share/licenses/$pkgname/LICENSE"
}