forked from Screenly/Anthias
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
executable file
·117 lines (94 loc) · 4.2 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
106
107
108
109
110
111
112
113
114
115
116
117
#!/bin/bash -e
# Make sure the command is launched interactive.
if ! [ -t 0 ]; then
echo -e "Detected old installation command. Please use:\n$ bash <(curl -sL https://www.screenlyapp.com/install-ose.sh)"
exit 1
fi
# Set color of logo
tput setaf 4
cat << EOF
_____ __ ____ _____ ______
/ ___/_____________ ___ ____ / /_ __ / __ \/ ___// ____/
\__ \/ ___/ ___/ _ \/ _ \/ __ \/ / / / / / / / /\__ \/ __/
___/ / /__/ / / __/ __/ / / / / /_/ / / /_/ /___/ / /___
/____/\___/_/ \___/\___/_/ /_/_/\__, / \____//____/_____/
/____/
EOF
# Reset color
tput sgr 0
echo -e "Screenly OSE requires a dedicated Raspberry Pi / SD card.\nYou will not be able to use the regular desktop environment once installed.\n"
read -p "Do you still want to continue? (y/N)" -n 1 -r -s INSTALL
if [ "$INSTALL" != 'y' ]; then
echo
exit 1
fi
echo && read -p "Would you like to use the experimental branch? It contains the last major changes, such as the new browser and migrating to Docker (y/N)" -n 1 -r -s EXP && echo
if [ "$EXP" != 'y' ]; then
echo && read -p "Would you like to use the development branch? You will get the latest features, but things may break. (y/N)" -n 1 -r -s DEV && echo
if [ "$DEV" != 'y' ]; then
export DOCKER_TAG="production"
echo "Screenly OSE version: Production" > ~/OSE_version.md
BRANCH="production"
else
export DOCKER_TAG="latest"
echo "Screenly OSE version: Development" > ~/OSE_version.md
BRANCH="master"
fi
else
export DOCKER_TAG="experimental"
echo "Screenly OSE version: Experimental" > ~/OSE_version.md
BRANCH="experimental"
fi
#Add reference of what linux flavor is running to OSE_version file
cat /etc/os-release | grep "PRETTY_NAME" >> ~/OSE_version.md
echo && read -p "Do you want to install network-manager? This is recommended for most users because this adds features to manage your network. (Y/n)" -n 1 -r -s NETWORK_MANAGER && echo
echo && read -p "Would you like to perform a full system upgrade as well? (y/N)" -n 1 -r -s UPGRADE && echo
if [ "$UPGRADE" != 'y' ]; then
EXTRA_ARGS="--skip-tags enable-ssl,system-upgrade"
else
EXTRA_ARGS="--skip-tags enable-ssl"
fi
if grep -qF "Raspberry Pi 3" /proc/device-tree/model; then
export DEVICE_TYPE="pi3"
elif grep -qF "Raspberry Pi 2" /proc/device-tree/model; then
export DEVICE_TYPE="pi2"
else
export DEVICE_TYPE="pi1"
fi
set -x
sudo mkdir -p /etc/ansible
echo -e "[local]\nlocalhost ansible_connection=local" | sudo tee /etc/ansible/hosts > /dev/null
if [ ! -f /etc/locale.gen ]; then
# No locales found. Creating locales with default UK/US setup.
echo -e "en_GB.UTF-8 UTF-8\nen_US.UTF-8 UTF-8" | sudo tee /etc/locale.gen > /dev/null
sudo locale-gen
fi
sudo sed -i 's/apt.screenlyapp.com/archive.raspbian.org/g' /etc/apt/sources.list
sudo apt-get update
sudo apt-get purge -y python-setuptools python-pip python-pyasn1
sudo apt-get install -y python-dev git-core libffi-dev libssl-dev
curl -s https://bootstrap.pypa.io/get-pip.py | sudo python
if [ "$NETWORK_MANAGER" == 'y' ]; then
export MANAGE_NETWORK=true
sudo apt-get install -y network_manager
else
export MANAGE_NETWORK=false
fi
sudo pip install ansible==2.7.10
ansible localhost -m git -a "repo=${1:-https://github.com/screenly/screenly-ose.git} dest=/home/pi/screenly version=$BRANCH"
cd /home/pi/screenly/ansible
ansible-playbook site.yml $EXTRA_ARGS
sudo apt-get autoclean
sudo apt-get clean
sudo find /usr/share/doc -depth -type f ! -name copyright -delete
sudo find /usr/share/doc -empty -delete
sudo rm -rf /usr/share/man /usr/share/groff /usr/share/info /usr/share/lintian /usr/share/linda /var/cache/man
sudo find /usr/share/locale -type f ! -name 'en' ! -name 'de*' ! -name 'es*' ! -name 'ja*' ! -name 'fr*' ! -name 'zh*' -delete
sudo find /usr/share/locale -mindepth 1 -maxdepth 1 ! -name 'en*' ! -name 'de*' ! -name 'es*' ! -name 'ja*' ! -name 'fr*' ! -name 'zh*' -exec rm -r {} \;
cd ~/screenly && git rev-parse HEAD > ~/.screenly/latest_screenly_sha
set +x
echo "Installation completed."
read -p "You need to reboot the system for the installation to complete. Would you like to reboot now? (y/N)" -n 1 -r -s REBOOT && echo
if [ "$REBOOT" == 'y' ]; then
sudo reboot
fi