Repository navigation
Expand file tree
/
Copy pathbootstrap.sh
More file actions
executable file
·84 lines (68 loc) · 2.23 KB
/
Copy pathbootstrap.sh
File metadata and controls
executable file
·84 lines (68 loc) · 2.23 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
#!/bin/bash
GOPATH=`go env GOPATH`
BOOTSTRAP_VERSION=1
BOOTSTRAP_REPO=github.com/fyne-io/bootstrap
BOOTSTRAP_DIR=$GOPATH/src/github.com/fyne-io/bootstrap
CONFIG_DIR=$HOME/.config/fyne/bootstrap/
LOG_FILE=$CONFIG_DIR/install.log
VERSION_FILE=$CONFIG_DIR/version
# TODO check if we are up to date with bootstrap
DEP_LIST="git go efl sudo"
DEP_FILE_LIST="git go ecore_evas_convert sudo"
INSTALL_COMMAND=""
if [[ -e "/etc/arch-release" ]] || [[ -e "/etc/manjaro-release" ]]; then
INSTALL_COMMAND="sudo pacman --noconfirm -S"
elif [[ -e "/etc/debian_version" ]]; then
VERSION=`cat /etc/debian_version`
if [[ ${VER%.*} -lt 10 ]]; then
echo "[ERROR] Bootstrap requires debian 10 (Buster) or later"
exit 1
fi
INSTALL_COMMAND="sudo apt-get install -q -y"
DEP_LIST="git golang libefl-all-dev libssl-dev"
DEP_FILE_LIST="git go ecore_evas_convert notestforssl"
elif [[ -e "/etc/fedora-release" ]]; then
INSTALL_COMMAND="sudo dnf install"
elif [[ "$OSTYPE" == "darwin"* ]]; then
INSTALL_COMMAND="brew install"
OPEN_SSL_ADD='export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:$(brew --prefix openssl)/lib/pkgconfig"'
if ! grep -Fxq "$OPEN_SSL_ADD" ~/.bash_profile; then
eval $OPEN_SSL_ADD
echo $OPEN_SSL_ADD >> ~/.bash_profile
echo "[INFO ] Added OpenSSL to the PKG_CONFIG_PATH in ~/.bash_profile"
fi
fi
mkdir -p $CONFIG_DIR
echo "Install started at `date`" > $LOG_FILE
i=0
read -ra DEP_FILE_ARRAY <<< "$DEP_FILE_LIST"
for DEP in $DEP_LIST; do
type ${DEP_FILE_ARRAY[$i]} > /dev/null 2>&1
if [[ $? -ne 0 ]]; then
INSTALL_DEP="$INSTALL_DEP $DEP"
fi
i=$i+1
done
if [[ ! -z $INSTALL_DEP ]]; then
echo "[INFO ] Installing dependencies $INSTALL_DEP"
if [[ -z $INSTALL_COMMAND ]]; then
echo "[FATAL] Unable to manage installation for unknwon system"
exit 1
fi
$INSTALL_COMMAND $INSTALL_DEP 2>&1 >> $LOG_FILE
if [[ $? -ne 0 ]]; then
echo "[FATAL] Unable to install dependencies"
echo "[LOG ] Last 5 lines:"
tail -n 5 $LOG_FILE
echo "[LOG ] Full log at $LOG_FILE"
exit 2
fi
fi
echo "[INFO ] All dependencies installed, downloading bootstrapper"
go get -u $BOOTSTRAP_REPO
if [[ $? -ne 0 ]]; then
echo "[FATAL] Unable to download bootstrap repository"
exit 3
fi
cd $BOOTSTRAP_DIR
go run bootstrap.go