summaryrefslogtreecommitdiff
path: root/setup-xorg-base.in
blob: 78bacf844dca141bd090ec54ff0702c085cc02c2 (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
#!/bin/sh

usage() {
	cat <<-__EOF__
		usage: setup-xorg-base [-h] [PKG..]

		Set up system to use Xorg

		options:
		 -h  Show this help

		Installs xorg-server, enables community repository, enable udev and
		install the pagkages PKG if specified.
	__EOF__
	exit $1
}

while getopts "d:n:h" opt; do
	case $opt in
		h) usage 0;;
		'?') usage "1" >&2;;
	esac
done
shift $(($OPTIND - 1))

# enable community repo
if [ -f "$ROOT"/etc/apk/repositories ] && ! grep -q '^[^#].*/community$' "$ROOT"/etc/apk/repositories; then
	repo=$(grep '^[^#].*/main$' /etc/apk/repositories | sed 's:/main$:/community:')
	escaped_repo=$(echo $repo | sed -e 's:/:\\/:g' -e 's:\.:\\.:g')
	sed -i -e "/^[^#].*\/main$/a $repo" \
		-e "/^#${escaped_repo}$/d" \
		"$ROOT"/etc/apk/repositories \
		&& echo ">> Enabling community repository"
	$MOCK apk update
fi

$MOCK apk add xorg-server xf86-input-libinput eudev mesa "$@"

setup-devd udev