1 | 1 |
new file mode 100755 |
... | ... |
@@ -0,0 +1,22 @@ |
1 |
+#!/bin/sh |
|
2 |
+set -euC |
|
3 |
+ |
|
4 |
+prefix="${1:-"/usr/local"}" |
|
5 |
+repo="${2:-"https://github.com/ujjwal96/xwinwrap"}" |
|
6 |
+commitish="${3:-"ec32e9b72539de7e1553a4f70345166107b431f7"}" |
|
7 |
+ |
|
8 |
+sudo= |
|
9 |
+if [ "$(stat -c '%U' "$prefix")" != "$USER" ] |
|
10 |
+then |
|
11 |
+ sudo=sudo |
|
12 |
+fi |
|
13 |
+ |
|
14 |
+tmp_dir="$(mktemp -d)" |
|
15 |
+trap 'rm -rf "$tmp_dir"' EXIT INT |
|
16 |
+cd "$tmp_dir" |
|
17 |
+ |
|
18 |
+git clone --no-checkout "$repo" '.' |
|
19 |
+git checkout "$commitish" |
|
20 |
+ |
|
21 |
+"${CC:-gcc}" 'xwinwrap.c' -O3 -lX11 -lXext -lXrender -o 'xwinwrap' |
|
22 |
+$sudo install -D 'xwinwrap' "$prefix/bin/xwinwrap" |