-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall_smartiepi.sh
executable file
·76 lines (63 loc) · 1.91 KB
/
install_smartiepi.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
#!/bin/bash
HOME="/home/pi"
INSTALL_PATH="${HOME}/bin"
MUSIC_PATH="${HOME}/Music"
VIDEOS_PATH="${HOME}/Videos"
PICTURES_PATH="${HOME}/Pictures"
EXTERNAL="external"
YOUTUBE="youtube"
MOVIES="Movies"
EXTERNAL_STORAGE_PATH="$1"
if [ -z "${EXTERNAL_STORAGE_PATH}" ]; then
echo "Error - External storage path not found"
exit -1
fi;
# Cleanup existing mess
# Ensure directories
echo "Creating Directories..."
mkdir -p "${PICTURES_PATH}"
mkdir -p "${MUSIC_PATH}"
mkdir -p "${VIDEOS_PATH}"
mkdir -p "${EXTERNAL_STORAGE_PATH}/Pictures"
mkdir -p "${EXTERNAL_STORAGE_PATH}/Music"
mkdir -p "${EXTERNAL_STORAGE_PATH}/Videos/${YOUTUBE}"
mkdir -p "${EXTERNAL_STORAGE_PATH}/Videos/${MOVIES}"
# Setup symlinks to external storage
echo "Setting up symlinks to external storage ${1}..."
ln -sf "${EXTERNAL_STORAGE_PATH}/Pictures" "${PICTURES_PATH}/${EXTERNAL}"
ln -sf "${EXTERNAL_STORAGE_PATH}/Music" "${MUSIC_PATH}/${EXTERNAL}"
ln -sf "${EXTERNAL_STORAGE_PATH}/Videos/${YOUTUBE}" "${VIDEOS_PATH}/${YOUTUBE}"
ln -sf "${EXTERNAL_STORAGE_PATH}/Videos/${MOVIES}" "${VIDEOS_PATH}/${MOVIES}"
# Copy the scripts
echo "Copying scripts..."
mkdir -p "${INSTALL_PATH}"
cp *.sh "${INSTALL_PATH}"
chmod +x "${INSTALL_PATH}/*.sh"
# Install dependencies
echo "Installing dependencies..."
sudo apt-get update -y
sudo apt-get install -y \
mp3info \
omxplayer \
feh \
transmission-daemon \
transmission-cli \
transmission-common \
curl \
xvkbd \
screen \
realvnc-vnc-server \
realvnc-vnc-viewer
sudo curl -L https://yt-dl.org/downloads/latest/youtube-dl -o /usr/bin/youtube-dl
sudo chmod a+rx /usr/bin/youtube-dl
# Enable SSH
echo "Enabling SSH..."
sudo touch /boot/ssh
# Add the parameters 'consoleblank=0' to the kernel params in /boot/cmdline.txt
echo "Adding scripts to path..."
[[ ":$PATH:" != *":/home/pi/bin:"* ]] && echo 'export PATH=/home/pi/bin:${PATH}' >>~/.bash_profile
source ~/.bash_profile
echo "Done!"
echo "Rebooting in 5 seconds..."
sleep 5
sudo reboot now