blob: 05eca6a2336bde7a44d4ece1885adcd6bf4eb50f (
plain)
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
106
107
108
|
#!/bin/bash
if [[ "$(basename -- "$0")" == "ostro-installer.sh" ]]; then
echo -e "$0 has to be sourced not run" >&2;
echo -e "\nExample:\nsource $0\n"; exit 1
fi
OSTRO_IMG=crops/ostro:builder
OSTRO_CONTAINER=ostro-builder
OSTRO_CONF=$HOME/ostro-workspace/shared/conf/ostro.conf
BITBAKE_WRAPPER=$HOME/.crops/bitbake.ostro
WIN_PLATFORM="msys"
LINUX_PLATFORM="linux"
MAC_PLATFORM="darwin"
unset MY_PLATFORM
# establish platform
if [[ "echo "${OSTYPE}" | tr '[:upper:]' '[:lower:]'" = *$LINUX_PLATFORM* ]]; then
MY_PLATFORM=$LINUX_PLATFORM
elif [[ "echo "${OSTYPE}" | tr '[:upper:]' '[:lower:]'" == *$MAC_PLATFORM* ]]; then
MY_PLATFORM=$MAC_PLATFORM
elif [[ "echo "${OSTYPE}" | tr '[:upper:]' '[:lower:]'" == *$WIN_PLATFORM* ]]; then
MY_PLATFORM=$WIN_PLATFORM
else
echo "Unknown platform: $OSTYPE. Exiting"; return 1
fi
echo -e "\nPlatform is $MY_PLATFORM"
if [ "`which docker`" = "" ]; then
echo -e "\nPlease install docker first, then run this installer"
if [[ $MY_PLATFORM = $LINUX_PLATFORM ]]; then
echo -e "\nFrom: https://docs.docker.com/linux/step_one/"
else
echo -e "\nFrom: https://www.docker.com/products/docker-toolbox"
fi
return 1
fi
echo -e "\n"
read -p "This will remove existing OSTRO build containers. Answering No will exit the installer. Proceed? Y/N " -r
echo
if [[ ! $REPLY =~ ^[Yy]$ ]]
then
echo "There is nothing for me to do. Exiting"; return 1
else
echo -e "\nRemove existing OSTRO build containers"
docker ps -a | awk '{ print $1,$2 }' | grep $OSTRO_IMG | awk '{print $1 }' | xargs -I {} docker rm -f {}
echo -e "Done"
fi
if [[ "$(docker images -q $OSTRO_IMG 2> /dev/null)" != "" ]]; then
read -p "OSTRO build image found. Download latest OSTRO build image? Y/N " -r; echo
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
if [[ "$(docker images -q $OSTRO_IMG 2> /dev/null)" == "" ]]; then
echo "OSTRO build image not found. Exiting installer"; return 1
fi
else
echo -e "\nRemove existing OSTRO build image"
docker rmi $OSTRO_IMG 2> /dev/null
echo -e "Done"
echo -e "\nDownloading OSTRO build image. Please wait"
docker pull $OSTRO_IMG
echo -e "Done"
fi
else
read -p "Download OSTRO build image? Y/N " -r
echo
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
if [[ "$(docker images -q $OSTRO_IMG 2> /dev/null)" == "" ]]; then
echo "OSTRO build image not found. Exiting installer"; return 1
fi
else
echo -e "\nDownloading OSTRO build image. Please wait"
docker pull $OSTRO_IMG
echo -e "Done"
fi
fi
if [[ "$(docker images -q $OSTRO_IMG 2> /dev/null)" == "" ]]; then
echo "OSTRO build image not found. Exiting installer"; return 1
fi
mkdir -p $HOME/.crops
if [[ -f "$BITBAKE_WRAPPER" ]]; then
read -p "OSTRO bitbake wrapper found. Do you want to reinstall bitbake wrapper? Y/N " -r; echo
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
echo -e "\nOSTRO bitbake wrapper was not updated"
else
rm -rf $BITBAKE_WRAPPER
echo -e "Downloading default OSTRO bitbake wrapper"
curl -k -s -o $BITBAKE_WRAPPER https://raw.githubusercontent.com/crops/crops/master/scripts/bitbake.ostro
chmod 755 $BITBAKE_WRAPPER
echo -e "Done."
fi
else
echo -e "Downloading OSTRO bitbake wrapper"
curl -k -s -o $BITBAKE_WRAPPER https://raw.githubusercontent.com/crops/crops/master/scripts/bitbake.ostro
chmod 755 $BITBAKE_WRAPPER
echo -e "Done."
fi
export PATH=$PATH:$HOME/.crops
echo -e "\n\nTHE OSTRO BUILD ENVIRONMENT HAS BEEN SET UP"
echo -e "\nYou can now build ostro-os from the CLI\n"
echo -e "Example :\nbitbake.ostro ostro-image-noswupd\n"
|