forked from whats-this/owo.sh
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.sh
executable file
·69 lines (56 loc) · 2.09 KB
/
setup.sh
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
#!/bin/bash
# _ _
# | | | |
# _____ _____ _ _ _ __ | | ___ __ _ __| | ___ _ __
# / _ \ \ /\ / / _ \ | | | | '_ \| |/ _ \ / _` |/ _` |/ _ \ '__|
# |(_) \ V V / (_)| | |_| | |_) | | (_) | (_| | (_| | __/ |
# \___/ \_/\_/ \___/ \__,_| .__/|_|\___/ \__,_|\__,_|\___|_|
# | |
# |_|
#
# OWOUPLOADER.SH SCRIPT.
# ----------------------
#
# This script is designed for you to be able to run the
# "owo file.png" command from anywhere in your terminal
# client and for it to work.
##################################
if [ ! $(id -u) -ne 0 ]; then
echo "ERROR : This script cannot be run as sudo."
echo "ERROR : You need to remove the sudo from \"sudo ./setup.sh\"."
exit 1
fi
##################################
if [ "${1}" = "--uninstall" ]; then
rm /usr/local/bin/owo
echo "INFO : Uninstallation of owo.sh finished!"
echo "INFO : However APT packages have not been removed."
exit 0
fi
##################################
scriptdir=$(dirname $(which $0))
owodir="$HOME/.config/owo"
if [ ! -d $owodir ]; then
mkdir $owodir
cp -r $scriptdir/* $owodir
fi
# Give directory ownership to the actual user
chown -R $(whoami | awk '{print $1}') $owodir
# Create a symbolic link to /usr/local/bin
sudo ln -s $owodir/script.sh /usr/local/bin/owo
function is_mac() {
uname | grep -q "Darwin"
}
# Install dependencies
if is_mac; then
echo "INFO : Dependencies are unavaliable for Mac."
echo "INFO : Please run \"owo --check\" to check later on."
else
(which notify-send &>/dev/null && echo "FOUND : found notify-send") || sudo apt-get install notify-send
(which maim &>/dev/null && echo "FOUND : found maim") || sudo apt-get install maim
(which xclip &>/dev/null && echo "FOUND : found xclip") || sudo apt-get install xclip
(which scrot &>/dev/null && echo "FOUND : found scrot") || sudo apt-get install scrot
fi
# Tell the user its done!
echo "INFO : Installation finished of owo.sh. Use it like \"owo file.png\""
echo "The config is in ~/.config/owo"