-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
executable file
·76 lines (58 loc) · 1.97 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
#/bin/sh
#NAS Music DB
#Author Jan Holomek ([email protected])
tagVersion="v1.2.2"
version="v1-2-2"
# Update and install Apache2
sudo apt update
sudo apt install -y apache2 exiftool bpm-tools
# Enable and start Apache2 service
sudo systemctl enable apache2
sudo systemctl start apache2
# Create directory and download content
folder="musicdb"
sudo mkdir -p /var/www/$folder
cd /var/www/$folder
sudo wget https://github.com/jahhoo/Cloud-Music-DB/releases/download/$tagVersion/$version.zip
sudo unzip $version
sudo rm $version
# Prompt for username and password
read -p "Enter username [default: music]: " username
username=${username:-music}
read -p "Enter password [default: mymusicdb]: " password
password=${password:-mymusicdb}
# Create .htaccess file
sudo bash -c "cat > /var/www/$folder/.htaccess <<EOF
AuthType Basic
AuthName \"Restricted Content\"
AuthUserFile /var/www/musicdb/.htpasswd
Require valid-user
EOF"
# Create .htpasswd file
sudo htpasswd -cb /var/www/musicdb/.htpasswd $username $password
# Prompt for music directory
read -p "Enter music directory [default: /home/$USER/music]: " music_dir
music_dir=${music_dir:-/home/$USER/music}
# Create symlink
sudo ln -s $music_dir /var/www/musicdb/music
# Update Apache2 configuration
sudo bash -c "cat > /etc/apache2/sites-available/000-default.conf <<EOF
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www
<Directory /var/www/musicdb>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ErrorLog \${APACHE_LOG_DIR}/error.log
CustomLog \${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
EOF"
# Restart Apache2 to apply changes
sudo systemctl restart apache2
chmod +x scanMusic.sh
sudo ./scanMusic.sh &
ip=$(ip addr show | grep 'inet ' | awk '{print $2}' | cut -d/ -f1 | tail -n 1)
echo "Installation and configuration complete! Now the analysis of music files will run for a few minutes."
echo "The application runs at http://$ip/$folder"