aboutsummaryrefslogtreecommitdiffstats
path: root/dabuild-admin
blob: a235f242d4d6a3a6c02e13e0b9816ca435f2aa97 (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
#!/bin/sh

set -eu

readonly cmd=${1:-help}

manage_config() {
	docker run --user 1000:1000 --rm -it --workdir /mnt/abuild \
		-v dabuild-config:/mnt/abuild alpine sh
}

list_volumes() {
	docker volume ls --quiet --filter name="^dabuild"
}

enable_multiarch() {
	docker run --rm --privileged multiarch/qemu-user-static \
		--reset --persistent yes --credential yes
}

usage() {
	cat <<- EOF
	dabuild: version (unknown)

	Available commands:
	  config: access abuild configuration
	  volumes: list created dabuild volumes
	  multiarch: enable docker multi-arch support
	  help: this help screen
	EOF
}


case $cmd in
	config) manage_config;;
	volumes) list_volumes;;
	multiarch) enable_multiarch;;
	help) usage;;
	*) usage; exit 1;;
esac