-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup-ampache-test.sh
executable file
·90 lines (77 loc) · 3.05 KB
/
setup-ampache-test.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
87
88
89
90
#!/bin/sh
AMPACHEDIR=$PWD
COMPOSERPATH="/usr/local/bin/composer"
if [ ! -f $COMPOSERPATH ]; then
COMPOSERPATH="$AMPACHEDIR/docker/composer"
wget -q -O $COMPOSERPATH https://getcomposer.org/download/latest-stable/composer.phar
chmod +x $COMPOSERPATH
fi
if [ ! -d $AMPACHEDIR/ampache ]; then
git clone -b patch6 https://github.com/ampache/ampache.git ampache
fi
if [ ! -f $AMPACHEDIR/ampache/index.php ]; then
rm -rf $AMPACHEDIR/ampache
git clone -b patch6 https://github.com/ampache/ampache.git ampache
fi
cd $AMPACHEDIR/ampache && git reset --hard origin/patch6 && git pull
rm -rf ./composer.lock vendor/* public/lib/components/* && php8.2 $COMPOSERPATH install
php8.2 $COMPOSERPATH install
find . -xtype l -exec rm {} \;
wget -P ./public/lib/components/jQuery-contextMenu/dist/ https://raw.githubusercontent.com/swisnl/jQuery-contextMenu/a7a1b9f3b9cd789d6eb733ee5e7cbc6c91b3f0f8/dist/jquery.contextMenu.min.js.map
wget -P ./public/lib/components/jQuery-contextMenu/dist/ https://raw.githubusercontent.com/swisnl/jQuery-contextMenu/a7a1b9f3b9cd789d6eb733ee5e7cbc6c91b3f0f8/dist/jquery.contextMenu.min.css.map
find . -name "*.map.1" -exec rm {} \;
# create the htaccess files
if [ ! -f $AMPACHEDIR/ampache/public/play/.htaccess ]; then
cp $AMPACHEDIR/ampache/public/play/.htaccess.dist $AMPACHEDIR/ampache/public/play/.htaccess
fi
if [ ! -f $AMPACHEDIR/ampache/public/rest/.htaccess ]; then
cp $AMPACHEDIR/ampache/public/rest/.htaccess.dist $AMPACHEDIR/ampache/public/rest/.htaccess
fi
# create the docker volume folders
if [ ! -d $AMPACHEDIR/docker/log ]; then
mkdir $AMPACHEDIR/docker/log
fi
if [ ! -d $AMPACHEDIR/docker/media ]; then
mkdir $AMPACHEDIR/docker/media
fi
if [ ! -d $AMPACHEDIR/docker/art ]; then
mkdir $AMPACHEDIR/docker/art
fi
if [ ! -d $AMPACHEDIR/docker/music ]; then
mkdir $AMPACHEDIR/docker/music
fi
if [ ! -d $AMPACHEDIR/docker/podcast ]; then
mkdir $AMPACHEDIR/docker/podcast
fi
if [ ! -d $AMPACHEDIR/docker/upload ]; then
mkdir $AMPACHEDIR/docker/upload
fi
if [ ! -d $AMPACHEDIR/docker/video ]; then
mkdir $AMPACHEDIR/docker/video
fi
#copy the config
cp -f $AMPACHEDIR/ampache.cfg.php $AMPACHEDIR/ampache/config/ampache.cfg.php
# reset perms
chown $UID:33 $AMPACHEDIR/docker/log
chmod 775 $AMPACHEDIR/docker/log
chown $UID:33 $AMPACHEDIR/docker/media
chmod 775 $AMPACHEDIR/docker/media
chown $UID:33 $AMPACHEDIR/ampache/composer.json
chmod 775 $AMPACHEDIR/ampache/composer.json
chown -R $UID:33 $AMPACHEDIR/ampache/config
chmod -R 775 $AMPACHEDIR/ampache/config
chown -R $UID:33 $AMPACHEDIR/ampache/vendor/
chmod -R 775 $AMPACHEDIR/ampache/vendor/
chown -R $UID:33 $AMPACHEDIR/ampache/public/
chmod -R 775 $AMPACHEDIR/ampache/public/
# remove the lock and install composer packages
if [ -f $AMPACHEDIR/ampache/composer.lock ]; then
rm $AMPACHEDIR/ampache/composer.lock
fi
cd $AMPACHEDIR/ampache && php8.2 $COMPOSERPATH install && cd $AMPACHEDIR
chown $UID:33 $AMPACHEDIR/docker/log
chmod 775 $AMPACHEDIR/docker/log
chown $UID:33 $AMPACHEDIR/docker/media
chmod 775 $AMPACHEDIR/docker/media
chown $UID:33 $AMPACHEDIR/ampache
chmod 775 $AMPACHEDIR/ampache