-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathspotify
executable file
·189 lines (138 loc) · 6.16 KB
/
spotify
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
#!/usr/bin/bash
#
# Uses alternative libs
# Passes all parametrs to spotify
# This only a script installer it download the oficial .deb from http://repository.spotify.com/pool/non-free/s/spotify/ and install in your personal directory. This script is Open Source own a GPLv3 http://www.gnu.org/licenses/gpl-3.0.html.
# Run only one instance, thanks Todd T
lockdir=/tmp
if [ -w /var/lock ]; then lockdir=/var/lock ; fi
self=`basename $0`
pidf="$lockdir/LCK..$self.uid$EUID.pid"
exec 221>${pidf}
flock --exclusive --nonblock 221 ||
{
echo "Already running"
exit 1
}
echo $$ | awk '{printf "%10u\n",$0}' >&221
####
check=20
DAY=2
# Deleting old source
if [ -f /tmp/repository-origin.spotify.com/pool/non-free/s/spotify-client/spotify-client*.deb ]; then
find /tmp/ -name spotify-client*.deb -ctime +$DAY -exec rm -rf {} \;
fi
# Deleting the program each 20 days, It will updating Spotify automatic.
if [ -d $HOME/.local/share/spotify/ ]; then
find $HOME/.local/share/spotify/ -name spotify-client -ctime +$check -exec rm -rf {} \;
find $HOME/.local/share/spotify/ -name libs -ctime +$check -exec rm -rf {} \;
find $HOME/.local/share/applications/ -name spotify-client.desktop -ctime +$check -exec rm -rf {} \;
find $HOME/.local/share/spotify/ -name spotify -ctime +$check -exec rm -rf {} \;
find $HOME/.local/share/spotify/libs/* -ctime +$check -exec rm -rf {} \;
find $HOME/.local/share/spotify/* -ctime +$check -exec rm -rf {} \;
fi
wait ${!}
if [ ! -d ~/.config/spotify ]; then
mkdir ~/.config/spotify/
fi
#LIBS
libs_spotify() {
echo 'Loading libs...'
if [ `getconf LONG_BIT` = "64" ]; then
libdir=lib64
else
libdir=lib
fi
# libplc4.so
ln -sf /usr/$libdir/libplc4.so $HOME/.local/share/spotify/libs/libplc4.so.0d
# libnspr4.so
ln -sf /usr/$libdir/libnspr4.so $HOME/.local/share/spotify/libs/libnspr4.so.0d
# libnss3.so
ln -sf /usr/$libdir/libnss3.so $HOME/.local/share/spotify/libs/libnss3.so.1d
# libnssutil3.so
ln -sf /usr/$libdir/libnssutil3.so $HOME/.local/share/spotify/libs/libnssutil3.so.1d
# libsmime3.so
ln -sf /usr/$libdir/libsmime3.so $HOME/.local/share/spotify/libs/libsmime3.so.1d
# libcurl-openssl
ln -sf /opt/shibboleth/$libdir/libcurl.so.4.3.0 $HOME/.local/share/spotify/libs/libcurl.so.4
ln -sf /opt/shibboleth/$libdir/libcurl.so.4.3.0 $HOME/.local/share/spotify/libs/libcurl-gnutls.so.4
# libudev.so
pushd /usr/$libdir/
udevlib=$(ls -l | grep -v ^l | grep libudev | head -1 | awk '{print $NF}')
popd
rm -f $HOME/.local/share/spotify/libs/libudev*
ln -sf /usr/$libdir/$udevlib $HOME/.local/share/spotify/libs/libudev.so.0
# openssl
# Spotify requires a old openssl, the symlink to new openssl doesn't work
#pushd /usr/$libdir/
# opensslib=$(ls -l | grep -v ^l | grep libssl | head -1 | awk '{print $NF}')
# cryptolib=$(ls -l | grep -v ^l | grep libcrypto | head -1 | awk '{print $NF}')
#popd
# rm -f $HOME/.local/share/spotify/libs/libssl*
# rm -f $HOME/.local/share/spotify/libs/libcrypto*
ln -sf /usr/$libdir/libssl.so.1.0.0 $HOME/.local/share/spotify/libs/libssl.so.1.0.0
ln -sf /usr/$libdir/libcrypto.so.1.0.0 $HOME/.local/share/spotify/libs/libcrypto.so.1.0.0
# libssl3.so
ln -sf /usr/$libdir/libssl3.so $HOME/.local/share/spotify/libs/libssl3.so.1d
# libplds4.so
ln -sf /usr/$libdir/libplds4.so $HOME/.local/share/spotify/libs/libplds4.so.0d
# libgcrypt
pushd /usr/$libdir/
gcryptlib=$(ls -l | grep -v ^l | grep libgcrypt | head -1 | awk '{print $NF}')
popd
rm -f $HOME/.local/share/spotify/libs/libgcrypt*
ln -sf /usr/$libdir/$gcryptlib $HOME/.local/share/spotify/libs/libgcrypt.so.11
# libgdk
ln -sf /usr/$libdir/libgdk-x11-2.0.so.0 $HOME/.local/share/spotify/libs/libgdk-x11-2.0.so.0
#libgtk
ln -sf /usr/$libdir/libgtk-x11-2.0.so.0 $HOME/.local/share/spotify/libs/libgtk-x11-2.0.so.0
#ffmpegsumo
ln -sf $HOME/.local/share/spotify/spotify-client/libcef.so $HOME/.local/share/spotify/libs/libffmpegsumo.so
# libcef.so
ln -sf $HOME/.local/share/spotify/spotify-client/libcef.so $HOME/.local/share/spotify/libs/libcef.so
# widevine
ln -sf $HOME/.local/share/spotify/spotify-client/libwidevinecdmadapter.so $HOME/.local/share/spotify/libs/libwidevinecdmadapter.so
}
# Run the program if exist, else It will installing Spotify
if [ -f $HOME/.local/share/spotify/spotify-client/spotify ]; then
libs_spotify
wait ${!}
cd $HOME/.local/share/spotify/spotify-client/
LD_LIBRARY_PATH=$PWD:$HOME/.local/share/spotify/libs/:/usr/lib64:/usr/lib:/usr/share/spotify/libs/:/usr/lib64/spotify-client/:/usr/lib/spotify-client/:$HOME/.local/share/spotify/spotify-client/ $HOME/.local/share/spotify/spotify-client/spotify "$@"
else
# Downloading the current source
install -dm 775 /tmp/source
cd /tmp/
if [ `getconf LONG_BIT` = "64" ]; then
xterm -e 'wget -c -r -np --secure-protocol=TLSv1_2 --no-check-certificate -A spotify-client\*amd64.deb -erobots=off https://repository-origin.spotify.com/pool/non-free/s/spotify-client/'
else
xterm -e 'wget -c -r -np --secure-protocol=TLSv1_2 --no-check-certificate -A spotify-client\*i386.deb -erobots=off https://repository-origin.spotify.com/pool/non-free/s/spotify-client/'
fi
wait ${!}
package=$(ls "$PWD/repository-origin.spotify.com/pool/non-free/s/spotify-client/" | grep spotify-client_ | sort | sed '/^\s*$/d' | tail -1)
ar x /tmp/repository-origin.spotify.com/pool/non-free/s/spotify-client/$package
wait ${!}
if [ -f /tmp/data.tar.xz ]; then
tar xJf data.tar.xz -C /tmp/source
elif [ -f /tmp/data.tar.gz ]; then
tar xmzvf data.tar.gz -C /tmp/source
else
echo 'some is wrong, check the extracted deb (/tmp/), "data.tar.*"'
fi
wait ${!}
# install
install -dm 775 $HOME/.local/share/spotify/libs/
rm -rf $HOME/.local/share/spotify/spotify-client
mv -f source/usr/share/spotify $HOME/.local/share/spotify/spotify-client
wait ${!}
libs_spotify
wait ${!}
cd $HOME/.local/share/spotify/spotify-client/
LD_LIBRARY_PATH=$PWD:$HOME/.local/share/spotify/libs/:/usr/lib64:/usr/lib:/usr/share/spotify/libs/:/usr/lib64/spotify-client/:/usr/lib/spotify-client/:$HOME/.local/share/spotify/spotify-client/ $HOME/.local/share/spotify/spotify-client/spotify "$@"
rm -rf /tmp/opt
rm -rf /tmp/source
rm -rf /tmp/usr/
rm -f /tmp/data.tar.*
rm -f /tmp/control.tar.*
rm -f /tmp/debian-binary
fi