forked from DbRtx/xshot
-
Notifications
You must be signed in to change notification settings - Fork 1
/
install.sh
105 lines (105 loc) · 2.23 KB
/
install.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
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
100
101
102
103
104
105
#!/bin/bash
o='\033[0m'
r='\033[1;31m'
b='\033[1;36m'
bx='\033[2;7;36m'
w='\033[1;37m'
y='\033[1;33m'
g='\033[1;32m'
N=$r'['$y'~'$r'] '
P=$r'['$y'?'$r'] '
W=$w'['$r'!'$w'] '
S=$w'['$g'✓'$w'] '
I=$r'['$y'i'$r'] '
B=$w'['$y'+'$w'] '
font_dir="/data/data/com.termux/files/home/.fonts"
local="/data/data/com.termux/files/home/.local"
bin="${local}/bin"
sdcard="/data/data/com.termux/files/home/storage/"
dir_package="/data/data/com.termux/files/usr/bin"
package=(
"magick"
"inotifywait"
"bc"
)
log ()
{
echo -e "${r}[${y}$(date +'%H:%M:%S')${r}]${o} $@"
}
check ()
{
if [[ $? -eq 0 && ${PIPESTATUS[0]} -eq 0 ]]; then
2> /dev/null
else
echo -e "$(log)${r}Error"
exit 1
fi
}
ad ()
{
echo -e "$(log)${g}package already exists"
}
header ()
{
echo -e "${r}
╔══╗ ╔╗ ╔╗╔╗
╚╣╠╝ ╔╝╚╗ ║║║║
║║╔═╗╔═╩╗╔╬══╣║║║╔══╦═╗
║║║╔╗╣══╣║║╔╗║║║║║║═╣╔╝
╔╣╠╣║║╠══║╚╣╔╗║╚╣╚╣║═╣║
╚══╩╝╚╩══╩═╩╝╚╩═╩═╩══╩╝${b}
xshot 1.0.3
"
}
enter ()
{
echo -e "${P}${b}press enter to continue ..."
}
header
read -p $"$(enter)" enter
echo -e "$(log)${b}Installing package requirements"
echo -e "${r}[${y}imagemagick${r}]"
if [[ ! "${dir_package}/${package[0]}" ]]; then
pkg i imagemagick -y
check
else
ad
fi
echo -e "${r}[${y}inotify-tools${r}]"
if [[ ! "${dir_package}/${package[1]}" ]]; then
pkg i inotify-tools -y
check
else
ad
fi
echo -e "${r}[${y}Bc${r}]"
if [[ ! "${dir_package}/${package[2]}" ]]; then
pkg i bc -y
check
else
ad
fi
echo -e "$(log)${b}Installing fonts"
cp -rf "$(pwd)/fonts" ~/.fonts
check
if [[ ! -d ${sdcard} ]]; then
termux-setup-storage
fi
echo -e "${I}${b}Looking directory ${y}~/.local/bin/${b} ..."
sleep 1s
if [[ ! -d ${local} ]]; then
echo -e "${I}${b}Creating directory ..."
mkdir ${local} && mkdir ${bin}
check
else
echo -e "${I}${b}directory ${y}~/.local/bin/${b} already exists"
fi
echo -e "${I}${b}moving file ${y}xshot${b} ..."
sleep 1s
cp xshot.sh ${bin}/xshot
check
chmod +x ${bin}/xshot
check
echo -e "$(log)${g}installation complete"
echo -e "${o}
run tools with command 'xshot'"