generated from mrrosoff/React-Static-Site
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinstall.sh
executable file
·85 lines (71 loc) · 2.58 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
#!/bin/bash
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[0;33m'
NC='\033[0m'
printf "${YELLOW}About to install Garage-UI (Make sure to run ONLY on a Raspberry Pi)${NC}\n"
read -p "Continue? (Y/N): " confirm && [[ $confirm == [yY] || $confirm == [yY][eE][sS] ]] || exit 1
if [ $(pwd | sed 's#.*/##') != "Garage-UI" ]; then
printf "${RED}ERROR: Not in Garage-UI directory. Exiting...${NC}\n"
exit 1
fi
mkdir logs
GARAGE_UI_DIR=$PWD
printf "${YELLOW}Installing Node...${NC}\n"
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
export NVM_DIR="$HOME/.config/nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
nvm install lts/*
nvm use
printf "${GREEN}Done.${NC}\n"
printf "${YELLOW}Installing Dependencies...${NC}\n"
sudo apt-get update -y
sudo apt-get upgrade -y
sudo apt-get install -y matchbox xorg ttf-mscorefonts-installer xwit sqlite3 libnss3
sudo apt-get autoremove -y
printf "${GREEN}Done.${NC}\n"
printf "${YELLOW}Setting Up Emojis...${NC}\n"
mkdir emj_temp
cd emj_temp
wget https://fontsdata.com/zipdown-segoeuiemoji-132714.htm
wget https://noto-website.storage.googleapis.com/pkgs/NotoColorEmoji-unhinted.zip
mv zipdown-segoeuiemoji-132714.htm segoeuiemoji.zip
unzip segoeuiemoji.zip
unzip NotoColorEmoji-unhinted.zip
mkdir $HOME/.fonts &>/dev/null
mv seguiemj.ttf "$HOME/.fonts/Segoe UI.ttf"
mv NotoColorEmoji.ttf "$HOME/.fonts/Noto Color Emoji.ttf"
fc-cache -f -v &>/dev/null
cd ..
rm -rf emj_temp
printf "${GREEN}Done.${NC}\n"
printf "${YELLOW}Installing Auto Start Script...${NC}\n"
sudo chmod 757 /etc/X11/xinit/xinitrc
sed -i "2 i cd $GARAGE_UI_DIR" xinitrc
cat xinitrc > /etc/X11/xinit/xinitrc
# Check if not already appended
if ! grep -q "export GARAGE_UI_DIR" ~/.bashrc; then
printf "${YELLOW}Appending Startup Script to Shell${NC}\n"
printf "
export GARAGE_UI_DIR=\"${GARAGE_UI_DIR}\"
RED='\033[1;31m'
GREEN='\033[1;32m'
NC='\033[0m'
if [[ -z \$SSH_CONNECTION ]]; then
echo -e \"\${GREEN}About to launch Garage-UI... \${RED}press Ctrl+C to exit to terminal.\${NC}\"
sleep 4s
startx -- -nocursor
fi
" >> ~/.bashrc
printf "${GREEN}Done.${NC}\n"
fi
printf "${YELLOW}Scheduling Auto Updates...${NC}\n"
sudo chmod 757 $GARAGE_UI_DIR/scripts/reboot.sh
sudo printf "# m h dom mon dow command\n0 4 * * 0 $GARAGE_UI_DIR/scripts/reboot.sh\n" >> temp_cron
sudo crontab temp_cron
rm temp_cron
printf "${GREEN}Done.${NC}\n"
printf "${GREEN}Success! Rebooting...${NC}\n"
sleep 4s
sudo reboot