-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Polish: install script, run stdin, global state option
- Loading branch information
Showing
5 changed files
with
185 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,13 @@ | ||
export DESTDIR ?= $(HOME)/.local | ||
|
||
.PHONY: build | ||
build: | ||
$(MAKE) -C src build | ||
|
||
.PHONY: install | ||
install: build | ||
install src/cli.exe $(HOME)/.local/bin/displayswitcheroo2 | ||
install -D data/displayswitcheroo/list.lua $(HOME)/.local/share/displayswitcheroo/list.lua | ||
install -D data/displayswitcheroo/displayswitcheroo.lua $(HOME)/.local/share/displayswitcheroo/displayswitcheroo.lua | ||
install: | ||
./install.sh | ||
|
||
.PHONY: clean | ||
clean: | ||
$(MAKE) -C src clean |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#!/bin/bash | ||
|
||
set -o nounset -o pipefail -o errexit | ||
|
||
SCRIPT_DIR=$(readlink -f "$0" | xargs dirname) | ||
|
||
usage() { | ||
cat <<EOF 1>&2 | ||
Usage: $(basename "$0") [options] | ||
Options: | ||
-h show this message | ||
-d DESTDIR set DESTDIR | ||
-u user installation: DESTDIR=~/.local | ||
-s systemwide installation: DESTDIR=/usr | ||
-a APP application name | ||
EOF | ||
exit "${1-0}" | ||
} | ||
|
||
DESTDIR=${DESTDIR-$HOME/.local} | ||
APP=${APP-displayswitcheroo} | ||
while getopts "dusah-" OPT; do | ||
case $OPT in | ||
d) DESTDIR=$OPTARG ;; | ||
u) DESTDIR=$HOME/.local ;; | ||
s) DESTDIR=/usr ;; | ||
a) APP=$OPTARG ;; | ||
h) usage ;; | ||
-) break ;; | ||
?) usage 2 ;; | ||
esac | ||
done | ||
shift $((OPTIND-1)) | ||
|
||
make -C "$SCRIPT_DIR" clean build EXTRA_CFLAGS="-DXDG_APP='\"$APP\"'" | ||
|
||
mkdir -pm 0700 "$DESTDIR/bin" | ||
install -v "$SCRIPT_DIR/src/cli.exe" "$DESTDIR/bin/$APP" | ||
|
||
mkdir -pm 0700 "$DESTDIR/share/$APP" | ||
install -v -D "$SCRIPT_DIR/data/displayswitcheroo/list.lua" "$DESTDIR/share/$APP/list.lua" | ||
install -v -D "$SCRIPT_DIR/data/displayswitcheroo/displayswitcheroo.lua" "$DESTDIR/share/$APP/$APP.lua" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters