blob: 3c1896c63064d231d5f50426c040f1362b406134 (
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
|
#!/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))
# For every main/ repo, enable corresponding community/ repo
orig="$ROOT"/etc/apk/repositories
if test -f "$orig"; then
echo '>> Enabling community repositories'
tmp="$orig".setup-xorg-base.tmp
:> "$tmp"
while read line ; do
echo "$line"
nosharp="${line##\#*}"
nomain="${line%%/main}"
if test "$line" = "$nosharp" && test "$line" != "$nomain"; then
echo "$nomain"/community
fi
done < "$orig" >> "$tmp"
mv -f "$tmp" "$orig"
apk update
fi
# 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"
apk update
fi
apk add xorg-server xf86-input-libinput eudev mesa-dri-gallium "$@"
setup-devd udev
|