-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathspotify
169 lines (116 loc) · 5.24 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
#!/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 you 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/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
# Run the program if exis, else will install Spotify
if [ -f $HOME/.local/share/spotify/spotify-client/spotify ]; then
cd $HOME/.local/share/spotify/spotify-client/
LD_LIBRARY_PATH=$HOME/.local/share/spotify/libs/:/usr/lib64:/usr/lib:/usr/share/spotify/libs/:$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 -l1 -H -t1 -nd -N -np -A spotify-client*amd64.deb -erobots=off http://repository.spotify.com/pool/non-free/s/spotify/'
# xterm -e 'wget -c -r -l1 -H -t1 -nd -N -np -A spotify-client*amd64.deb -erobots=off http://repository.spotify.com/pool/non-free/s/spotify-client/'
xterm -e 'wget -c -r -l1 -H -t1 -nd -N -np -A spotify-client\*amd64.deb -erobots=off http://repository.spotify.com/pool/non-free/s/spotify-client/'
else
# xterm -e 'wget -c -r -l1 -H -t1 -nd -N -np -A spotify-client*i386.deb -erobots=off http://repository.spotify.com/pool/non-free/s/spotify-client/'
# wget -c https://dl.dropboxusercontent.com/u/8593574/Spotify/spotify-client_0.9.4.183.g644e24e.428-1_i386.deb
xterm -e 'wget -c -r -l1 -H -t1 -nd -N -np -A spotify-client\*i386.deb -erobots=off http://repository.spotify.com/pool/non-free/s/spotify-client/'
fi
wait ${!}
package=$(ls | grep spotify-client | sort | sed '/^\s*$/d' | tail -1)
ar x $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/
install -dm 775 $HOME/.local/share/spotify/spotify-client
cp -rf source/usr/share/spotify/* $HOME/.local/share/spotify/spotify-client
wait ${!}
#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
# libudev.so
ln -sf /usr/$libdir/libudev.so.0 $HOME/.local/share/spotify/libs/libudev.so.0
# openssl
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
ln -sf /usr/$libdir/libgcrypt.so.11.8.3 $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
wait ${!}
cd $HOME/.local/share/spotify/spotify-client/
LD_LIBRARY_PATH=$HOME/.local/share/spotify/libs/:/usr/lib64:/usr/lib:/usr/share/spotify/libs/:$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