forked from flovilmart/parse-image
-
Notifications
You must be signed in to change notification settings - Fork 12
/
install.sh
executable file
·60 lines (49 loc) · 1.04 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
#!/bin/bash
HAS_GM=0;
HAS_IM=0;
gm version > /dev/null 2>&1 && HAS_GM=1;
convert -version > /dev/null 2>&1 && HAS_IM=1;
if [[ "$HAS_GM" -eq "1" && "$HAS_IM" -eq "1" ]];
then
echo "Found all dependencies";
exit 0;
fi
INSTALL=0;
brew --version > /dev/null 2>&1 && INSTALL=1;
if [ $INSTALL -eq 1 ]
then
echo "Installing using brew...";
if [ "$HAS_GM" -eq "0" ]; then
brew install graphicsmagick;
fi
if [ "$HAS_IM" -eq "0" ]; then
brew install imagemagick;
fi
exit 0;
fi
APT_GET="sudo apt-get";
if [ -z "$UID" ];
then
APT_GET="apt-get";
elif [ "$UID" -eq "0" ];
then
APT_GET="apt-get";
fi
$APT_GET --version > /dev/null 2>&1 && INSTALL=1;
if [ $INSTALL -eq "1" ]
then
echo "Installing using $APT_GET...";
$APT_GET update;
TO_INSTALL="";
if [ "$HAS_GM" -eq "0" ]; then
TO_INSTALL="$TO_INSTALL graphicsmagick"
fi
if [ "$HAS_IM" -eq "0" ]; then
TO_INSTALL="$TO_INSTALL imagemagick"
fi
$APT_GET install $TO_INSTALL -y --fix-missing;
exit 0;
fi
echo "Cannot install using brew or $APT_GET";
echo "Please install manually";
exit 0;