aboutsummaryrefslogtreecommitdiff
blob: a4b98ca99214f7d2b361205fc4437651bff7be18 (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
88
89
90
# Copyright 2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

inherit desktop xdg

DESCRIPTION="Creator of bootable USBs, with ability to copy ISOs, persistence storage"
HOMEPAGE="https://www.ventoy.net"
SRC_URI="https://github.com/ventoy/Ventoy/releases/download/v${PV}/ventoy-${PV}-linux.tar.gz"

S="${WORKDIR}"/ventoy-${PV}

LICENSE="GPL-3"
SLOT="0"
KEYWORDS="~amd64"

RESTRICT="strip mirror"

DEPEND="
	sys-fs/dosfstools
	sys-fs/exfat-utils
	sys-fs/fuse-exfat
	sys-block/parted
"
# sys-fs/fuse-exfat is needed for mount, without it:
# mount: /mnt: unknown filesystem type 'exfat'

QA_PREBUILT="*" # Against "does not respect LDFLAGS"

CARCH="x86_64"

src_prepare() {
	# Decompress tools
	pushd tool/$CARCH || die
	for file in *.xz; do
		xzcat "$file" >"${file%.xz}" || die
		chmod +x "${file%.xz}" || die
	done

	# Cleanup .xz crap
	rm -fv ./*.xz || die
	popd || die

	# Apply sanitize patch
	eapply -p0 "${FILESDIR}/sanitize.patch"

	# Log location
	sed -i 's|log\.txt|/var/log/ventoy.log|g' WebUI/static/js/languages.js tool/languages.json || die

	# Non-POSIX compliant scripts
	sed -i 's|bin/sh|usr/bin/env bash|g' tool/{ventoy_lib.sh,VentoyWorker.sh} || die

	# Clean up unused binaries
	# Preserving mkexfatfs and mount.exfat-fuse because exfatprogs is incompatible
	for binary in xzcat hexdump; do
		rm -fv tool/$CARCH/$binary || die
	done
	default
}

src_install() {
	insopts -m0644
	insinto /opt/ventoy/boot/
	doins boot/*
	insinto /opt/ventoy/ventoy/
	doins ventoy/*
	insopts -m0755
	insinto /opt/ventoy/tool/
	doins tool/*.{cer,glade,json,sh,xz}
	insinto /opt/ventoy/tool/$CARCH/
	doins tool/$CARCH/*
	insinto /opt/ventoy/
	doins ./*.sh plugin WebUI "VentoyGUI.$CARCH"

	# Install .desktop
	insopts -m0644
	insinto /usr/share/pixmaps/
	newins WebUI/static/img/VentoyLogo.png ventoy.png
	domenu "${FILESDIR}/ventoy.desktop"

	# Link system binaries
	for binary in xzcat hexdump; do
		dosym -r /usr/bin/$binary /opt/ventoy/tool/$CARCH/$binary
	done

	dobin "${FILESDIR}"/ventoy{,gui,web,plugson,-{,extend-}persistent}

	rm "${D}"/opt/ventoy/tool/x86_64/Ventoy2Disk.gtk2 || die
}