diff options
author | Sibren Vasse | 2015-09-05 01:00:24 +0200 |
---|---|---|
committer | Sibren Vasse | 2015-09-05 01:00:24 +0200 |
commit | 8ba734a876d2bb227544c6084ac6d9fd3d6b9ee6 (patch) | |
tree | 432bf2f783cbd831458c4a26622db693195da1d1 | |
download | aur-8ba734a876d2bb227544c6084ac6d9fd3d6b9ee6.tar.gz |
Initial commit
-rw-r--r-- | .SRCINFO | 22 | ||||
-rw-r--r-- | PKGBUILD | 28 | ||||
-rw-r--r-- | spotcommander.install | 141 |
3 files changed, 191 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 000000000000..88e226125547 --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,22 @@ +pkgbase = spotcommander + pkgdesc = A remote control for Spotify for Linux, optimized for mobile devices. + pkgver = 12.4 + pkgrel = 1 + url = http://www.olejon.net/code/spotcommander + install = spotcommander.install + arch = any + license = GPL3 + depends = apache + depends = php + depends = php-apache + depends = php-sqlite + depends = qt4 + depends = inotify-tools + depends = xdotool + optdepends = spotify: The application to remote control + conflicts = spotcommander-xampp + source = http://www.olejon.net/code/spotcommander/files/spotcommander-12.4.tar.bz2 + md5sums = 7dea4e8a0113e75ba1ebade5bd90e4c8 + +pkgname = spotcommander + diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 000000000000..c3e32336b46e --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,28 @@ +# Author : Ole Jon Bjørkum <mail at olejon dot net> +# Maintainer: Sibren Vasse <arch at sibrenvasse dot nl> + +pkgname=spotcommander +pkgver=12.4 +pkgrel=1 +pkgdesc="A remote control for Spotify for Linux, optimized for mobile devices." +arch=('any') +url="http://www.olejon.net/code/spotcommander" +license=('GPL3') +depends=('apache' 'php' 'php-apache' 'php-sqlite' 'qt4' 'inotify-tools' 'xdotool') +optdepends=('spotify: The application to remote control') +conflicts=('spotcommander-xampp') +install=$pkgname.install +source=($url/files/$pkgname-$pkgver.tar.bz2) +md5sums=('7dea4e8a0113e75ba1ebade5bd90e4c8') + +package() +{ + mkdir -p $pkgdir/usr/share/webapps + mv $srcdir/$pkgname $pkgdir/usr/share/webapps/$pkgname + cd $pkgdir/usr/share/webapps/$pkgname + chmod 755 . + chmod 755 bin/* + chmod -R 777 db/ + chmod 777 run/ + chmod 666 run/* +} diff --git a/spotcommander.install b/spotcommander.install new file mode 100644 index 000000000000..28106c3f35ef --- /dev/null +++ b/spotcommander.install @@ -0,0 +1,141 @@ +post_install() +{ + echo "Configuring PHP..." + + sed -i 's/;extension=curl.so/extension=curl.so/' /etc/php/php.ini + sed -i 's/;extension=pdo_sqlite.so/extension=pdo_sqlite.so/' /etc/php/php.ini + sed -i 's/;extension=posix.so/extension=posix.so/' /etc/php/php.ini + sed -i 's/;extension=sqlite3.so/extension=sqlite3.so/' /etc/php/php.ini + + echo "Configuring Apache..." + + sed -i 's/LoadModule mpm_event_module modules\/mod_mpm_event.so/#LoadModule mpm_event_module modules\/mod_mpm_event.so/' /etc/httpd/conf/httpd.conf + + echo -e "\n# Start SpotCommander configuration" >> /etc/httpd/conf/httpd.conf + echo "LoadModule mpm_prefork_module modules/mod_mpm_prefork.so" >> /etc/httpd/conf/httpd.conf + echo "LoadModule php5_module modules/libphp5.so" >> /etc/httpd/conf/httpd.conf + echo "Include conf/extra/php5_module.conf" >> /etc/httpd/conf/httpd.conf + echo "Include conf/extra/spotcommander.conf" >> /etc/httpd/conf/httpd.conf + echo -e "# End SpotCommander configuration\n" >> /etc/httpd/conf/httpd.conf + + echo -e "Alias /spotcommander /usr/share/webapps/spotcommander\n\n<Directory \"/usr/share/webapps/spotcommander\">\nAllowOverride AuthConfig\nRequire all granted\n</Directory>" > /etc/httpd/conf/extra/spotcommander.conf + + systemctl restart httpd.service 1>/dev/null 2>&1 + + systemctl enable httpd.service 1>/dev/null 2>&1 + + echo "Creating symlink..." + + ln -s /usr/share/webapps/spotcommander/bin/spotcommander /usr/bin/spotcommander + + echo "Adding daemon to startup applications..." + + echo -e "[Desktop Entry]\nType=Application\nName=SpotCommander\nExec=spotcommander start" > /etc/xdg/autostart/spotcommander.desktop + +echo " + -------------------------------------------------------------- + | Installation complete! | + | | + | YOU MUST NOW RE-LOGIN TO YOUR DESKTOP TO START THE DAEMON. | + | | + | You should then be able to control Spotify by going to: | + | | + | http://this.computers.ip.address.or.hostname/spotcommander | + -------------------------------------------------------------- +" + +} + +pre_upgrade() +{ + spotcommander stop + + echo "Backing up playlists and library in case of upgrade..." + + cp -p /usr/share/webapps/spotcommander/db/playlists.db /tmp/spotcommander-playlists.db + cp -p /usr/share/webapps/spotcommander/db/library.db /tmp/spotcommander-library.db + + echo "Backing up Spotify authorization in case of upgrade..." + + cp -p /usr/share/webapps/spotcommander/run/spotify.country /tmp/spotcommander-spotify.country + cp -p /usr/share/webapps/spotcommander/run/spotify.token /tmp/spotcommander-spotify.token + cp -p /usr/share/webapps/spotcommander/run/spotify.username /tmp/spotcommander-spotify.username + + echo "Backing up authentication configuration in case of upgrade..." + + cp -p /usr/share/webapps/spotcommander/.htaccess /tmp/spotcommander-htaccess + cp -p /usr/share/webapps/spotcommander/.htpasswd /tmp/spotcommander-htpasswd +} + +post_upgrade() +{ + if [ -e /tmp/spotcommander-playlists.db ]; then + + echo "Restoring playlists..." + + cp -p /tmp/spotcommander-playlists.db /usr/share/webapps/spotcommander/db/playlists.db + + fi + + if [ -e /tmp/spotcommander-library.db ]; then + + echo "Restoring library..." + + cp -p /tmp/spotcommander-library.db /usr/share/webapps/spotcommander/db/library.db + + fi + + if [ -e /tmp/spotcommander-spotify.token ]; then + + echo "Restoring Spotify authorization..." + + cp -p /tmp/spotcommander-spotify.country /usr/share/webapps/spotcommander/run/spotify.country + cp -p /tmp/spotcommander-spotify.token /usr/share/webapps/spotcommander/run/spotify.token + cp -p /tmp/spotcommander-spotify.username /usr/share/webapps/spotcommander/run/spotify.username + + fi + + if [ -e /tmp/spotcommander-htaccess ]; then + + echo "Restoring authentication configuration..." + + cp -p /tmp/spotcommander-htaccess /usr/share/webapps/spotcommander/.htaccess + cp -p /tmp/spotcommander-htpasswd /usr/share/webapps/spotcommander/.htpasswd + + fi + +echo " + -------------------------------------------------------------- + | Upgrade complete! | + | | + | YOU MUST NOW RE-LOGIN TO YOUR DESKTOP TO START THE DAEMON. | + | | + | You should then be able to control Spotify by going to: | + | | + | http://this.computers.ip.address.or.hostname/spotcommander | + -------------------------------------------------------------- +" + +} + +pre_remove() +{ + spotcommander stop + + echo "Deleting files..." + + rm -f /usr/share/webapps/spotcommander/run/daemon-user-*.socket + rm /usr/bin/spotcommander + rm /etc/httpd/conf/extra/spotcommander.conf + rm /etc/xdg/autostart/spotcommander.desktop + + echo "Configuring Apache..." + + sed -i '/# Start SpotCommander configuration/,/# End SpotCommander configuration/d' /etc/httpd/conf/httpd.conf + + sed -i 's/#LoadModule mpm_event_module modules\/mod_mpm_event.so/LoadModule mpm_event_module modules\/mod_mpm_event.so/' /etc/httpd/conf/httpd.conf + + systemctl restart httpd.service 1>/dev/null 2>&1 + + echo "Uninstallation complete!" +} |