-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
43 lines (35 loc) · 1.17 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
#!/usr/bin/env bash
if [[ $(id -u) -ne 0 ]] ; then echo "Please run as root" ; exit 1 ; fi
{
configure_group() {
if [ $(getent group music) ]; then
echo "Already created group music"
else
groupadd music
usermod -a -G music pi
echo 'Created music group'
fi
}
configure_user() {
if id peapod &>/dev/null; then
echo 'Already created user peapod.'
else
useradd --shell /bin/nologin --groups sudo,input,music --comment "Pea Pod" --create-home --home-dir /home/peapod peapod;
usermod -a -G music peapod # this allows access to MP3 files
usermod -a -G audio peapod # this allows acces to audio devices
echo 'peapod ALL=(ALL) NOPASSWD: ALL' | sudo tee /etc/sudoers.d/010_peapod-nopasswd
# NOTE: this user cannot login by standard means, use sudo -u peapod -s
echo 'Created user peapod'
fi
}
perform_setup() {
sudo -u peapod sh -c "cd ~; if test -d peapod; then cd peapod; git pull; else git clone https://github.com/catpea/peapod.git; fi;"
sudo -u peapod sh -c "cd ~/peapod; sudo ./setup.sh"
}
install() {
configure_group;
configure_user;
perform_setup;
}
install;
}