From cfd84d0ac9568d62d55fa3b541a0fdcdc3ed6d39 Mon Sep 17 00:00:00 2001 From: Natanael Copa Date: Thu, 19 May 2022 14:36:04 +0200 Subject: setup-xorg-base: add usage help text --- setup-xorg-base.in | 31 +++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) (limited to 'setup-xorg-base.in') diff --git a/setup-xorg-base.in b/setup-xorg-base.in index b1de8fe..95752ce 100644 --- a/setup-xorg-base.in +++ b/setup-xorg-base.in @@ -1,16 +1,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 ! grep -q '^[^#].*/community$' /etc/apk/repositories; then +if ! 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" \ - /etc/apk/repositories \ + "$ROOT"/etc/apk/repositories \ && echo ">> Enabling community repository" - apk update + $MOCK apk update fi -apk add xorg-server xf86-input-libinput eudev mesa "$@" +$MOCK apk add xorg-server xf86-input-libinput eudev mesa "$@" setup-devd udev -- cgit v1.2.3