forked from PetitPrinc3/PIpod-Nano
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
86 lines (72 loc) · 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
#!/bin/bash
if [ "$1" == "" ]
then
path=/home/pi/Music
else
path=$1
fi
read -r -p "The path to your music files will be $path. Are you sure ? [y/N] " response
if [[ "$response" =~ ^([yY][eE][sS]|[yY])$ ]]
then
echo The path to your music files will be $path
else
exit 0
fi
function add_to_config_text {
CONFIG_LINE="$1"
CONFIG="$2"
sed -i "s/^#$CONFIG_LINE/$CONFIG_LINE/" $CONFIG
if ! grep -q "$CONFIG_LINE" $CONFIG; then
printf "$CONFIG_LINE\n" >> $CONFIG
fi
}
success() {
echo -e "$(tput setaf 2)$1$(tput sgr0)"
}
inform() {
echo -e "$(tput setaf 6)$1$(tput sgr0)"
}
warning() {
echo -e "$(tput setaf 1)$1$(tput sgr0)"
}
inform "Begining, downloading Pimonori Pirate Audio Software"
git clone https://github.com/pimoroni/pirate-audio
echo
inform "Runing Pirate Audio Installation"
chmod +x pirate-audio/mopidy/install.sh
sudo pirate-audio/mopidy/install.sh
echo
inform "Now performing Gavroche's modifications"
sudo apt-get install mpc mopidy-mpd -y
echo
if [[ ! -d /usr/share/PIpodScripts ]]
then
mkdir -p /usr/share/PIpodScripts
fi
if [[ ! -d /tmp ]]
then
mkdir /tmp
fi
echo '#!/bin/bash' > /usr/share/PIpodScripts/autoplay.sh
echo >> /usr/share/PIpodScripts/autoplay.sh
echo path=$path >> /usr/share/PIpodScripts/autoplay.sh
cat autoplay.sh >> /usr/share/PIpodScripts/autoplay.sh
chmod +x /usr/share/PIpodScripts/autoplay.sh
mv buttons.py /usr/share/PIpodScripts/buttons.py
mv /etc/rc.local /etc/rc.local.save
cat /etc/rc.local.save | grep -v "exit 0" > /etc/rc.local
echo 'sudo python /usr/share/PIpodScripts/buttons.py &' >> /etc/rc.local
echo >> /etc/rc.local
echo 'exit 0'>> /etc/rc.local
sudo chmod +x /etc/rc.local
rm /etc/rc.local.save
mv PIpod.service /etc/systemd/system/PIpod.service
systemctl start PIpod.service
systemctl enable PIpod.service
mv frontend.py /usr/local/lib/python3.7/dist-packages/mopidy_raspberry_gpio/frontend.py
mv mopidy.conf /etc/mopidy/mopidy.conf
sudo systemctl stop PIpod.service
sudo rm /usr/share/PIpodScripts/database
echo
success "Done"
echo