-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathinstall
executable file
·83 lines (64 loc) · 1.43 KB
/
install
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#!/bin/bash
usage () {
printf "%s" "\
USAGE:
install [OPTIONS] [ARGS]
ARGS:
<WM>
Window managers, for which you want to install files.
OPTIONS:
-h, --help
Show this message.
--prefix
Used for specifying installation directory.
--clean
When specified, this script cleans directory specified in '--prefix'
option.
"
exit 1
}
init_config_file () {
local location;
if [ -z "$XDG_CONFIG_HOME" ]; then
mkdir --parents "$HOME/.config/ixwindow"
location="$HOME/.config"
else
mkdir --parents "$XDG_CONFIG_HOME/ixwindow"
location="$XDG_CONFIG_HOME"
fi
if [ ! -f "$location/ixwindow/ixwindow.toml" ]; then
cp "examples/ixwindow.toml" "$location/ixwindow/ixwindow.toml"
fi
}
install () {
if [ "$CLEAN" -eq 1 ]; then
rm -r "$PREFIX"
fi
# Remove ixwindow file from previous installation
rm -r "$PREFIX/ixwindow" 2> /dev/null
cargo build --release
mkdir -p "$PREFIX"
cp -r target/release/ixwindow "$PREFIX"
}
CLEAN=0
PREFIX="$HOME/.config/polybar/scripts/ixwindow"
while [ $# -gt 0 ];
do
case "$1" in
"--help" | "-h")
usage
;;
"--clean")
CLEAN=1
shift
;;
"--prefix")
PREFIX="$2"
shift 2
;;
*)
;;
esac
done
install
init_config_file