#159 -- Re-enable legacy IceCast2/LiquidSoap for ARMHF processors.

This commit is contained in:
Buster Silver 2017-06-12 15:29:03 -05:00
parent ef2c7f3be2
commit 1e12ce9818
8 changed files with 191 additions and 137 deletions

View File

@ -177,11 +177,21 @@ abstract class AdapterAbstract
}
/**
* Indicate if the backend in question is installed on the server.
* Indicate if the adapter in question is installed on the server.
*
* @return bool
*/
public static function isInstalled()
{
return (static::getBinary() !== false);
}
/**
* Return the binary executable location for this item.
*
* @return bool
*/
public static function getBinary()
{
return true;
}

View File

@ -362,10 +362,12 @@ class LiquidSoap extends BackendAbstract
public function getCommand()
{
$user_base = realpath(APP_INCLUDE_ROOT.'/..');
$config_path = $this->station->getRadioConfigDir() . '/liquidsoap.liq';
return $user_base.'/.opam/system/bin/liquidsoap --errors-as-warnings ' . $config_path;
if ($binary = self::getBinary()) {
$config_path = $this->station->getRadioConfigDir() . '/liquidsoap.liq';
return $binary . ' --errors-as-warnings ' . $config_path;
} else {
return '/bin/false';
}
}
public function skip()
@ -403,13 +405,19 @@ class LiquidSoap extends BackendAbstract
return (8000 + (($this->station->id - 1) * 10) + 4);
}
/*
* Static Functions
*/
public static function isInstalled()
public static function getBinary()
{
$user_base = realpath(APP_INCLUDE_ROOT.'/..');
return (APP_INSIDE_DOCKER || file_exists($user_base.'/.opam/system/bin/liquidsoap'));
$new_path = $user_base . '/.opam/system/bin/liquidsoap';
$legacy_path = '/usr/bin/liquidsoap';
if (APP_INSIDE_DOCKER || file_exists($new_path)) {
return $new_path;
} elseif (file_exists($legacy_path)) {
return $legacy_path;
} else {
return false;
}
}
}

View File

@ -191,9 +191,12 @@ class IceCast extends FrontendAbstract
public function getCommand()
{
$config_path = $this->station->getRadioConfigDir() . '/icecast.xml';
return '/usr/local/bin/icecast -c ' . $config_path;
if ($binary = self::getBinary()) {
$config_path = $this->station->getRadioConfigDir() . '/icecast.xml';
return $binary . ' -c ' . $config_path;
} else {
return '/bin/false';
}
}
public function getStreamUrl()
@ -354,12 +357,18 @@ class IceCast extends FrontendAbstract
return $defaults;
}
/*
* Static Functions
*/
public static function isInstalled()
public static function getBinary()
{
return (APP_INSIDE_DOCKER || file_exists('/usr/local/bin/icecast'));
$new_path = '/usr/local/bin/icecast';
$legacy_path = '/usr/bin/icecast2';
if (APP_INSIDE_DOCKER || file_exists($new_path)) {
return $new_path;
} elseif (file_exists($legacy_path)) {
return $legacy_path;
} else {
return false;
}
}
}

View File

@ -155,11 +155,14 @@ class ShoutCast2 extends FrontendAbstract
public function getCommand()
{
$config_path = $this->station->getRadioConfigDir();
$sc_binary = realpath(APP_INCLUDE_ROOT . '/..') . '/servers/shoutcast2/sc_serv';
$sc_config = $config_path . '/sc_serv.conf';
if ($binary = self::getBinary()) {
$config_path = $this->station->getRadioConfigDir();
$sc_config = $config_path . '/sc_serv.conf';
return $sc_binary . ' ' . $sc_config;
return $binary . ' ' . $sc_config;
} else {
return '/bin/false';
}
}
public function getStreamUrl()
@ -236,13 +239,14 @@ class ShoutCast2 extends FrontendAbstract
return $defaults;
}
/*
* Static Functions
*/
public static function isInstalled()
public static function getBinary()
{
$sc_binary = realpath(APP_INCLUDE_ROOT . '/..') . '/servers/shoutcast2/sc_serv';
return (APP_INSIDE_DOCKER || file_exists($sc_binary));
$new_path = realpath(APP_INCLUDE_ROOT . '/..') . '/servers/shoutcast2/sc_serv';
if (APP_INSIDE_DOCKER || file_exists($new_path)) {
return $new_path;
} else {
return false;
}
}
}

View File

@ -0,0 +1,25 @@
---
- name: Install IceCast2
become: true
apt: pkg=icecast2 state=latest
- name: Link Fallback Error MP3
file: src="{{ www_base }}/resources/error.mp3" dest="/usr/share/icecast2/web/error.mp3" state=link
- name: Remove problematic LiquidSoap plugins
become: true
apt: pkg="{{ item }}" state=absent
with_items:
- liquidsoap-plugin-all
- liquidsoap-plugin-opus
- name: Install LiquidSoap
become: true
apt: pkg="{{ item }}" install_recommends=yes state=latest
with_items:
- liquidsoap
- liquidsoap-plugin-ogg
- liquidsoap-plugin-vorbis
- liquidsoap-plugin-lame
- liquidsoap-plugin-flac
- liquidsoap-plugin-icecast

View File

@ -1,100 +1,8 @@
---
- name: Install IceCast-KH Dependencies
become: true
apt: pkg="{{ item }}" install_recommends=no state=latest
with_items:
- libxml2
- libxslt1-dev
- libvorbis-dev
- libssl-dev
- libcurl4-openssl-dev
- pkg-config
- include: x86.yml
dynamic: no
when: ansible_architecture == 'x86_64' or ansible_architecture == 'i386'
- name: Download IceCast-KH Source
get_url:
url: https://github.com/karlheyes/icecast-kh/archive/icecast-2.4.0-kh5.tar.gz
dest: "{{ app_base }}/servers/icecast2/icecast2.tar.gz"
- name: Extract IceCast-KH Source
unarchive:
src: "{{ app_base }}/servers/icecast2/icecast2.tar.gz"
dest: "{{ app_base }}/servers/icecast2"
remote_src: yes
creates: "{{ app_base }}/servers/icecast2/configure"
mode: "u=rwx,g=rx,o=rx"
owner: "azuracast"
group: "www-data"
extra_opts: "--strip-components=1"
- name: Build IceCast-KH
become: true
shell: "cd {{ app_base }}/servers/icecast2 && ./configure && make && make install"
args:
chdir: "{{ app_base }}/servers/icecast2"
creates: "/usr/local/bin/icecast"
- name: Link IceCast Resource Files
file: src="{{ item.src }}" dest="{{ item.dest }}" state=link
with_items:
- { src: "{{ www_base }}/resources/error.mp3", dest: "/usr/local/share/icecast/web/error.mp3" }
- { src: "{{ www_base }}/resources/status-json.xsl", dest: "/usr/local/share/icecast/web/status-json.xsl" }
- { src: "{{ www_base }}/resources/xml2json.xslt", dest: "/usr/local/share/icecast/web/xml2json.xslt" }
- name: Add OPAM Repository
become: true
apt_repository: repo=ppa:avsm/ppa
register: installed_opam_ppa
when: ansible_distribution == 'Ubuntu' and ansible_distribution_release == 'trusty'
- name: Update apt again
become: true
apt: update_cache=yes
when: installed_opam_ppa.changed
- name: Install OPAM
become: true
apt: pkg="opam" install_recommends=yes state=latest
- name: Install LiquidSoap Dependencies
become: true
apt: pkg="{{ item }}" install_recommends=no state=latest
with_items:
- libpcre3-dev
- libfdk-aac-dev
- libmad0-dev
- libmp3lame-dev
- libtag1-dev
- libfaad-dev
- libflac-dev
- pkg-config
- m4
- name: Build LiquidSoap
become: true
become_user: azuracast
shell: "opam init -y && opam install -y taglib mad faad fdkaac lame vorbis.0.6.2 cry.0.4.1 flac liquidsoap.1.2.1"
args:
chdir: "{{ app_base }}"
- name: Download ShoutCast 2 (x86)
get_url:
url: http://download.nullsoft.com/shoutcast/tools/sc_serv2_linux-latest.tar.gz
dest: "{{ app_base }}/servers/shoutcast2/sc_serv.tar.gz"
when: ansible_architecture == 'i386'
- name: Download ShoutCast 2 (x64)
get_url:
url: http://download.nullsoft.com/shoutcast/tools/sc_serv2_linux_x64-latest.tar.gz
dest: "{{ app_base }}/servers/shoutcast2/sc_serv.tar.gz"
when: ansible_architecture == 'x86_64'
- name: Extract ShoutCast 2 Binary
unarchive:
src: "{{ app_base }}/servers/shoutcast2/sc_serv.tar.gz"
dest: "{{ app_base }}/servers/shoutcast2"
remote_src: yes
creates: "{{ app_base }}/servers/shoutcast2/sc_serv"
mode: "u=rwx,g=rx,o=rx"
owner: "azuracast"
group: "www-data"
when: ansible_architecture == 'x86_64' or ansible_architecture == 'i386'
- include: armhf.yml
dynamic: no
when: ansible_architecture != 'x86_64' and ansible_architecture != 'i386'

View File

@ -0,0 +1,99 @@
---
- name: Install IceCast-KH Dependencies
become: true
apt: pkg="{{ item }}" install_recommends=no state=latest
with_items:
- libxml2
- libxslt1-dev
- libvorbis-dev
- libssl-dev
- libcurl4-openssl-dev
- pkg-config
- name: Download IceCast-KH Source
get_url:
url: https://github.com/karlheyes/icecast-kh/archive/icecast-2.4.0-kh5.tar.gz
dest: "{{ app_base }}/servers/icecast2/icecast2.tar.gz"
- name: Extract IceCast-KH Source
unarchive:
src: "{{ app_base }}/servers/icecast2/icecast2.tar.gz"
dest: "{{ app_base }}/servers/icecast2"
remote_src: yes
creates: "{{ app_base }}/servers/icecast2/configure"
mode: "u=rwx,g=rx,o=rx"
owner: "azuracast"
group: "www-data"
extra_opts: "--strip-components=1"
- name: Build IceCast-KH
become: true
shell: "cd {{ app_base }}/servers/icecast2 && ./configure && make && make install"
args:
chdir: "{{ app_base }}/servers/icecast2"
creates: "/usr/local/bin/icecast"
- name: Link IceCast Resource Files
file: src="{{ item.src }}" dest="{{ item.dest }}" state=link
with_items:
- { src: "{{ www_base }}/resources/error.mp3", dest: "/usr/local/share/icecast/web/error.mp3" }
- { src: "{{ www_base }}/resources/status-json.xsl", dest: "/usr/local/share/icecast/web/status-json.xsl" }
- { src: "{{ www_base }}/resources/xml2json.xslt", dest: "/usr/local/share/icecast/web/xml2json.xslt" }
- name: Add OPAM Repository
become: true
apt_repository: repo=ppa:avsm/ppa
register: installed_opam_ppa
when: ansible_distribution == 'Ubuntu' and ansible_distribution_release == 'trusty'
- name: Update apt again
become: true
apt: update_cache=yes
when: installed_opam_ppa.changed
- name: Install OPAM
become: true
apt: pkg="opam" install_recommends=yes state=latest
- name: Install LiquidSoap Dependencies
become: true
apt: pkg="{{ item }}" install_recommends=no state=latest
with_items:
- libpcre3-dev
- libfdk-aac-dev
- libmad0-dev
- libmp3lame-dev
- libtag1-dev
- libfaad-dev
- libflac-dev
- pkg-config
- m4
- name: Build LiquidSoap
become: true
become_user: azuracast
shell: "opam init -y && opam install -y taglib mad faad fdkaac lame vorbis.0.6.2 cry.0.4.1 flac liquidsoap.1.2.1"
args:
chdir: "{{ app_base }}"
- name: Download ShoutCast 2 (x86)
get_url:
url: http://download.nullsoft.com/shoutcast/tools/sc_serv2_linux-latest.tar.gz
dest: "{{ app_base }}/servers/shoutcast2/sc_serv.tar.gz"
when: ansible_architecture == 'i386'
- name: Download ShoutCast 2 (x64)
get_url:
url: http://download.nullsoft.com/shoutcast/tools/sc_serv2_linux_x64-latest.tar.gz
dest: "{{ app_base }}/servers/shoutcast2/sc_serv.tar.gz"
when: ansible_architecture == 'x86_64'
- name: Extract ShoutCast 2 Binary
unarchive:
src: "{{ app_base }}/servers/shoutcast2/sc_serv.tar.gz"
dest: "{{ app_base }}/servers/shoutcast2"
remote_src: yes
creates: "{{ app_base }}/servers/shoutcast2/sc_serv"
mode: "u=rwx,g=rx,o=rx"
owner: "azuracast"
group: "www-data"

View File

@ -6,15 +6,6 @@
msg: "Running in Testing Mode."
when: testing_mode|bool == true
- name: Add multiverse repository
apt_repository: repo="{{item}}"
when: ansible_distribution == 'Ubuntu'
with_items:
- "deb http://archive.ubuntu.com/ubuntu {{ansible_distribution_release}} multiverse"
- "deb-src http://archive.ubuntu.com/ubuntu/ {{ansible_distribution_release}} multiverse"
- "deb http://archive.ubuntu.com/ubuntu {{ansible_distribution_release}}-updates multiverse"
- "deb-src http://archive.ubuntu.com/ubuntu/ {{ansible_distribution_release}}-updates multiverse"
- name: Update apt
become: true
apt: update_cache=yes