-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinstaller.sh
More file actions
executable file
·100 lines (87 loc) · 2.77 KB
/
Copy pathinstaller.sh
File metadata and controls
executable file
·100 lines (87 loc) · 2.77 KB
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# author: NFVblog aka Nicola Ferru
setup_color() {
# Only use colors if connected to a terminal
if is_tty; then
RAINBOW="
$(printf '\033[38;5;196m')
$(printf '\033[38;5;202m')
$(printf '\033[38;5;226m')
$(printf '\033[38;5;082m')
$(printf '\033[38;5;021m')
$(printf '\033[38;5;093m')
$(printf '\033[38;5;163m')
"
RED=$(printf '\033[31m')
GREEN=$(printf '\033[32m')
YELLOW=$(printf '\033[33m')
BLUE=$(printf '\033[34m')
BOLD=$(printf '\033[1m')
RESET=$(printf '\033[m')
else
RAINBOW=""
RED=""
GREEN=""
YELLOW=""
BLUE=""
BOLD=""
RESET=""
fi
}
command_exists() {
command -v "$@" >/dev/null 2>&1
}
if ! command_exists zsh; then
echo "${YELLOW}Zsh is not installed.${RESET} Please install zsh first."
exit 1
fi
if ! command_exists dmenu; then
echo "${YELLOW}Dmenu is not installed.${RESET} Please install zsh first."
exit 2
fi
if [[ $1 == --version ]] || [[ $1 == -v ]] || [[ $1 == -VERSION ]]; then
cat << 'EOF'
DMWacom 0.2 beta Intaller
EOF
exit 0
fi
if [[ $1 == --help ]] || [[ $1 == -h ]] || [[ $1 == -HELP ]] || [[ $1 == "" ]]; then
cat << 'EOF'
____ __ ____ __
| _ \| \/ \ \ / /_ _ ___ ___ _ __ ___
| | | | |\/| |\ \ /\ / / _` |/ __/ _ \| '_ ` _ \
| |_| | | | | \ V V / (_| | (_| (_) | | | | | |
|____/|_| |_| \_/\_/ \__,_|\___\___/|_| |_| |_|
_ _ _ _
(_)_ __ ___| |_ __ _| | | ___ _ __
| | '_ \/ __| __/ _` | | |/ _ \ '__|
| | | | \__ \ || (_| | | | __/ |
|_|_| |_|___/\__\__,_|_|_|\___|_|
--------------------------------------------------------------------------------
Option
--------------------------------------------------------------------------------
--help (-h): print the helper with all the info on the installer
--user (-usr): performs a user-side installation, so only the user who installed
the app will be able to use it. (no-root)
--global (-gbl): allows you to install the application globally and this allows
all users to be able to use the same package without having to
do an installation per user (root)
--remove: allows you to remove the package on the system side. (root)
--remove_user: allows you to remove the package on the user side. (no-root)
EOF
exit 0
fi
if [[ $1 == --user ]] || [[ $1 == -usr ]]; then
mkdir -p ~/.local/bin/dmwacom && cp . ~/.local/bin/dmwacom && notify-send\
"Installation successful!"
exit 0
fi
if [[ $1 == --global ]] || [[ $1 == -gbl ]]; then
sudo install -Dm644 dmenuWacom /usr/local/bin/ && sudo install -Dm644 dmenuWacom.1\
/usr/local/man/man1 && notify-send "Installation successful!"
exit 0
fi
if [[ $1 == --remove_user ]]; then
rm -rf ~/.local/bin/dmwacom && notify-send\
"successful!"
exit 0
fi