summaryrefslogtreecommitdiff
path: root/blobutil
blob: eb3a23e953f684a8f773322f785f2fdc144f73ab (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
#!/bin/sh
# SPDX-FileCopyrightText: 2022 Caleb La Grange <thonkpeasant@protonmail.com>
# SPDX-FileCopyrightText: 2023 Leah Rowe <leah@libreboot.org>
# SPDX-License-Identifier: GPL-3.0-only

script_dir="resources/scripts/blobs"
modes=$(ls -1 ${script_dir})

main()
{
	if [ $# -lt 1 ]; then
		printf "%s: Error: you must specify a mode\n" $0
		usage
		exit 1
	fi

	./.gitcheck

	mode=${1}
	shift
	args=$@

	if [ ! -f "${script_dir}/${mode}" ]; then
		printf "Error: No mode ${mode}\n"
		usage
		exit 1
	fi

	./${script_dir}/${mode} ${args}

	./.gitcheck clean
}

usage(){
	cat <<- EOF
	Usage: ./blobutil [mode] <options>
	Example: ./blobutil download x230_12mb

	Possible options for mode are
	${modes}

	Mode descriptions:
	download: Try to automatically generate blobs for specified board
	inject: Inject blobs for specified board into specified rom
	extract: Extract blobs from specified rom for specified board
	EOF
}

main $@