Merge pull request #1294 from jooola/feat/format_shell_scripts
Format and check shell scripts
This commit is contained in:
commit
745ac37389
36 changed files with 1644 additions and 1594 deletions
4
.github/scripts/install-bionic.sh
vendored
4
.github/scripts/install-bionic.sh
vendored
|
@ -25,5 +25,5 @@ apt-get install -y gstreamer1.0-plugins-base \
|
||||||
libcairo2-dev
|
libcairo2-dev
|
||||||
|
|
||||||
# Making log directory for PHP tests
|
# Making log directory for PHP tests
|
||||||
mkdir -p $LIBRETIME_LOG_DIR
|
mkdir -p "$LIBRETIME_LOG_DIR"
|
||||||
chown runner:runner $LIBRETIME_LOG_DIR
|
chown runner:runner "$LIBRETIME_LOG_DIR"
|
||||||
|
|
4
.github/scripts/install-xenial.sh
vendored
4
.github/scripts/install-xenial.sh
vendored
|
@ -25,5 +25,5 @@ apt-get install -y gstreamer1.0-plugins-base \
|
||||||
libcairo2-dev
|
libcairo2-dev
|
||||||
|
|
||||||
# Making log directory for PHP tests
|
# Making log directory for PHP tests
|
||||||
mkdir -p $LIBRETIME_LOG_DIR
|
mkdir -p "$LIBRETIME_LOG_DIR"
|
||||||
chown runner:runner $LIBRETIME_LOG_DIR
|
chown runner:runner "$LIBRETIME_LOG_DIR"
|
||||||
|
|
8
.github/scripts/python-pkg-install.sh
vendored
8
.github/scripts/python-pkg-install.sh
vendored
|
@ -1,10 +1,10 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
echo "::group::Install Python apps"
|
echo "::group::Install Python apps"
|
||||||
for app in $(ls python_apps); do
|
for app in python_apps/*; do
|
||||||
if [[ -f "python_apps/$app/requirements-dev.txt" ]]; then
|
if [[ -f "$app/requirements-dev.txt" ]]; then
|
||||||
pip3 install -r "python_apps/$app/requirements-dev.txt"
|
pip3 install -r "$app/requirements-dev.txt"
|
||||||
fi
|
fi
|
||||||
pip3 install -e "python_apps/$app"
|
pip3 install -e "$app"
|
||||||
done
|
done
|
||||||
echo "::endgroup::"
|
echo "::endgroup::"
|
||||||
|
|
2
.github/scripts/python-pkg-test.sh
vendored
2
.github/scripts/python-pkg-test.sh
vendored
|
@ -14,7 +14,7 @@ if ! make -C python_apps/api_clients test; then
|
||||||
fi
|
fi
|
||||||
echo "::endgroup::"
|
echo "::endgroup::"
|
||||||
|
|
||||||
if [[ "$failed" = "true" ]]; then
|
if [[ $failed == "true" ]]; then
|
||||||
echo "Python tests failed"
|
echo "Python tests failed"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
6
.github/scripts/release.sh
vendored
6
.github/scripts/release.sh
vendored
|
@ -17,10 +17,8 @@ if [ $# == 0 ]; then
|
||||||
exit 1
|
exit 1
|
||||||
elif [ $# == 1 ]; then
|
elif [ $# == 1 ]; then
|
||||||
suffix=$1
|
suffix=$1
|
||||||
version=$1
|
|
||||||
else
|
else
|
||||||
suffix=$1-$2
|
suffix=$1-$2
|
||||||
version=$1
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Creating tarball for LibreTime ${suffix}."
|
echo "Creating tarball for LibreTime ${suffix}."
|
||||||
|
@ -41,9 +39,9 @@ echo " Done"
|
||||||
#echo "Done"
|
#echo "Done"
|
||||||
|
|
||||||
cd ..
|
cd ..
|
||||||
find libretime-${suffix} -type f -exec dos2unix {} \;
|
find "libretime-${suffix}" -type f -exec dos2unix {} \;
|
||||||
echo -n "Creating tarball..."
|
echo -n "Creating tarball..."
|
||||||
tar -czf libretime-${suffix}.tar.gz \
|
tar -czf "libretime-${suffix}.tar.gz" \
|
||||||
--owner=root --group=root \
|
--owner=root --group=root \
|
||||||
--exclude-vcs \
|
--exclude-vcs \
|
||||||
--exclude .zfproject.xml \
|
--exclude .zfproject.xml \
|
||||||
|
|
21
.github/workflows/test.yml
vendored
21
.github/workflows/test.yml
vendored
|
@ -25,6 +25,27 @@ jobs:
|
||||||
- uses: actions/setup-python@v2
|
- uses: actions/setup-python@v2
|
||||||
- uses: pre-commit/action@v2.0.3
|
- uses: pre-commit/action@v2.0.3
|
||||||
|
|
||||||
|
check-shell:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- uses: actions/setup-python@v2
|
||||||
|
- run: |
|
||||||
|
python -m venv venv && source venv/bin/activate
|
||||||
|
pip install gh-release-install
|
||||||
|
|
||||||
|
sudo venv/bin/gh-release-install \
|
||||||
|
koalaman/shellcheck \
|
||||||
|
shellcheck-{tag}.linux.x86_64.tar.xz --extract shellcheck-{tag}/shellcheck \
|
||||||
|
/usr/bin/shellcheck
|
||||||
|
|
||||||
|
sudo venv/bin/gh-release-install \
|
||||||
|
mvdan/sh \
|
||||||
|
shfmt_{tag}_linux_amd64 \
|
||||||
|
/usr/bin/shfmt
|
||||||
|
|
||||||
|
- run: SEVERITY=warning make shell-check
|
||||||
|
|
||||||
test:
|
test:
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
|
|
16
Makefile
Normal file
16
Makefile
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
.PHONY: setup
|
||||||
|
|
||||||
|
SHELL = bash
|
||||||
|
|
||||||
|
all: setup
|
||||||
|
|
||||||
|
setup:
|
||||||
|
command -v pre-commit > /dev/null && pre-commit install
|
||||||
|
|
||||||
|
# https://google.github.io/styleguide/shellguide.html
|
||||||
|
shell-format:
|
||||||
|
shfmt -f . | xargs shfmt -i 2 -ci -sr -kp -w
|
||||||
|
|
||||||
|
shell-check:
|
||||||
|
shfmt -f . | xargs shfmt -i 2 -ci -sr -kp -d
|
||||||
|
shfmt -f . | xargs shellcheck --color=always --severity=$${SEVERITY:-style}
|
|
@ -1,4 +1,4 @@
|
||||||
#!/bin/bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
#Create a RabbitMQ airtime_tests user
|
#Create a RabbitMQ airtime_tests user
|
||||||
#This is necessary for tests to run
|
#This is necessary for tests to run
|
||||||
|
@ -30,8 +30,7 @@ export AIRTIME_UNIT_TEST="1"
|
||||||
|
|
||||||
#Change the working directory to this script's directory
|
#Change the working directory to this script's directory
|
||||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}")" && pwd)"
|
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
cd $DIR
|
cd "$DIR" || (echo "could not cd in $DIR!" && exit 1)
|
||||||
|
|
||||||
#Run the unit tests
|
#Run the unit tests
|
||||||
phpunit --verbose --log-junit test_results.xml
|
phpunit --verbose --log-junit test_results.xml
|
||||||
|
|
||||||
|
|
11
build.sh
11
build.sh
|
@ -1,4 +1,7 @@
|
||||||
#!/bin/bash -e
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -e # Exit if any of the steps fails.
|
||||||
|
|
||||||
composer install --no-dev --no-interaction
|
composer install --no-dev --no-interaction
|
||||||
|
|
||||||
git_build=""
|
git_build=""
|
||||||
|
@ -8,13 +11,13 @@ if [ -d .git ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "${git_build}" = "y" ]; then
|
if [ "${git_build}" = "y" ]; then
|
||||||
git_version=`git tag --points-at HEAD`
|
git_version=$(git tag --points-at HEAD)
|
||||||
echo " * Version from tag: ${git_version}"
|
echo " * Version from tag: ${git_version}"
|
||||||
if [ "${git_version}" = "" ]; then
|
if [ "${git_version}" = "" ]; then
|
||||||
git_version=`git rev-parse --short HEAD`
|
git_version=$(git rev-parse --short HEAD)
|
||||||
echo " * Overriding empty version with sha1 commit-ish: ${git_version}"
|
echo " * Overriding empty version with sha1 commit-ish: ${git_version}"
|
||||||
fi
|
fi
|
||||||
echo ${git_version} > VERSION
|
echo "${git_version}" > VERSION
|
||||||
else
|
else
|
||||||
# if no file was in tarball we create one letting the user know
|
# if no file was in tarball we create one letting the user know
|
||||||
# if you run in to this you should grab an enriched tarball built
|
# if you run in to this you should grab an enriched tarball built
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/bin/bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
# Set up 3 way PO file merging, which we need for non-mainline branches
|
# Set up 3 way PO file merging, which we need for non-mainline branches
|
||||||
cp scripts/git-merge-po /usr/local/bin
|
cp scripts/git-merge-po /usr/local/bin
|
||||||
|
|
|
@ -1,9 +1,12 @@
|
||||||
#!/bin/bash -e
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
apt-get install -y --force-yes lsb-release sudo
|
apt-get install -y --force-yes lsb-release sudo
|
||||||
dist=`lsb_release -is`
|
dist=$(lsb_release -is)
|
||||||
code=`lsb_release -cs`
|
code=$(lsb_release -cs)
|
||||||
cpu=`getconf LONG_BIT`
|
# cpu=$(getconf LONG_BIT)
|
||||||
cpuvalue=
|
# cpuvalue=
|
||||||
|
|
||||||
#enable apt.sourcefabric.org source
|
#enable apt.sourcefabric.org source
|
||||||
set +e
|
set +e
|
||||||
|
@ -17,8 +20,6 @@ apt-get update
|
||||||
apt-get -y --force-yes install sourcefabric-keyring
|
apt-get -y --force-yes install sourcefabric-keyring
|
||||||
apt-get update
|
apt-get update
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if [ "$dist" = "Ubuntu" ]; then
|
if [ "$dist" = "Ubuntu" ]; then
|
||||||
set +e
|
set +e
|
||||||
grep -E "deb http://ca.archive.ubuntu.com/ubuntu/ $code multiverse" /etc/apt/sources.list
|
grep -E "deb http://ca.archive.ubuntu.com/ubuntu/ $code multiverse" /etc/apt/sources.list
|
||||||
|
@ -31,7 +32,7 @@ if [ "$dist" = "Ubuntu" ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#enable squeeze backports to get lame packages
|
#enable squeeze backports to get lame packages
|
||||||
if [ "$dist" = "Debian" -a "$code" = "squeeze" ]; then
|
if [[ "$dist" == "Debian" && "$code" == "squeeze" ]]; then
|
||||||
set +e
|
set +e
|
||||||
grep -E "deb http://backports.debian.org/debian-backports squeeze-backports main" /etc/apt/sources.list
|
grep -E "deb http://backports.debian.org/debian-backports squeeze-backports main" /etc/apt/sources.list
|
||||||
returncode=$?
|
returncode=$?
|
||||||
|
@ -41,12 +42,12 @@ if [ "$dist" = "Debian" -a "$code" = "squeeze" ]; then
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "System is $cpu bit..."
|
# echo "System is $cpu bit..."
|
||||||
if [ "$cpu" = "64" ]; then
|
# if [ "$cpu" = "64" ]; then
|
||||||
cpuvalue="amd64"
|
# cpuvalue="amd64"
|
||||||
else
|
# else
|
||||||
cpuvalue="i386"
|
# cpuvalue="i386"
|
||||||
fi
|
# fi
|
||||||
|
|
||||||
apt-get update
|
apt-get update
|
||||||
apt-get -o Dpkg::Options::="--force-confold" upgrade
|
apt-get -o Dpkg::Options::="--force-confold" upgrade
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/bin/bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
exec 2>&1
|
exec 2>&1
|
||||||
|
|
||||||
|
@ -29,9 +29,9 @@ build_env () {
|
||||||
|
|
||||||
echo "build_env $1"
|
echo "build_env $1"
|
||||||
#exec > >(tee ./liquidsoap_compile_logs/build_env_$1.log)
|
#exec > >(tee ./liquidsoap_compile_logs/build_env_$1.log)
|
||||||
os=`echo $1 | awk '/(debian)/'`
|
os=$(echo $1 | awk '/(debian)/')
|
||||||
cpu=`echo $1 | awk '/(64)/'`
|
cpu=$(echo $1 | awk '/(64)/')
|
||||||
dist=`echo $1 | awk -F "_" '{print $2}'`
|
dist=$(echo $1 | awk -F "_" '{print $2}')
|
||||||
|
|
||||||
rm -f /etc/schroot/chroot.d/$1.conf
|
rm -f /etc/schroot/chroot.d/$1.conf
|
||||||
if cat /etc/passwd | awk -F:'{print $1}' | grep "tmp" > /dev/null 2>&1; then
|
if cat /etc/passwd | awk -F:'{print $1}' | grep "tmp" > /dev/null 2>&1; then
|
||||||
|
@ -76,7 +76,7 @@ build_env () {
|
||||||
compile_liq() {
|
compile_liq() {
|
||||||
echo "complie_liq $1"
|
echo "complie_liq $1"
|
||||||
#exec > >(tee ./liquidsoap_compile_logs/compile_liq_$1.log)
|
#exec > >(tee ./liquidsoap_compile_logs/compile_liq_$1.log)
|
||||||
binfilename=`echo $1 | sed -e 's/ubuntu/liquidsoap/g' -e 's/debian/liquidsoap/g' -e 's/32/i386/g' -e 's/64/amd64/g'`
|
binfilename=$(echo $1 | sed -e 's/ubuntu/liquidsoap/g' -e 's/debian/liquidsoap/g' -e 's/32/i386/g' -e 's/64/amd64/g')
|
||||||
rm -f /srv/chroot/$1/liquidsoap-compile.sh
|
rm -f /srv/chroot/$1/liquidsoap-compile.sh
|
||||||
rm -f /srv/chroot/$1/liquidsoap
|
rm -f /srv/chroot/$1/liquidsoap
|
||||||
cp liquidsoap-compile.sh /srv/chroot/$1/
|
cp liquidsoap-compile.sh /srv/chroot/$1/
|
||||||
|
@ -100,20 +100,17 @@ if [ x$1 = x ];then
|
||||||
showhelp
|
showhelp
|
||||||
fi
|
fi
|
||||||
|
|
||||||
while getopts b:c:u: arg
|
while getopts b:c:u: arg; do
|
||||||
do
|
|
||||||
case $arg in
|
case $arg in
|
||||||
b)
|
b)
|
||||||
if [ "$OPTARG" = "all" ]; then
|
if [ "$OPTARG" = "all" ]; then
|
||||||
echo "Building all platforms on server..."
|
echo "Building all platforms on server..."
|
||||||
for i in $(seq 0 $(($num -1)));
|
for i in $(seq 0 $((num - 1))); do
|
||||||
do
|
|
||||||
build_env ${os_versions[$i]} | tee ./liquidsoap-compile_logs/build_env_${os_versions[$i]}.log
|
build_env ${os_versions[$i]} | tee ./liquidsoap-compile_logs/build_env_${os_versions[$i]}.log
|
||||||
done
|
done
|
||||||
else
|
else
|
||||||
flag=1
|
flag=1
|
||||||
for i in $(seq 0 $(($num -1)));
|
for i in $(seq 0 $((num - 1))); do
|
||||||
do
|
|
||||||
if [ "$OPTARG" = ${os_versions[$i]} ]; then
|
if [ "$OPTARG" = ${os_versions[$i]} ]; then
|
||||||
echo "Building platform: $OPTARG ..."
|
echo "Building platform: $OPTARG ..."
|
||||||
build_env ${os_versions[$i]} | tee ./liquidsoap-compile_logs/build_env_${os_versions[$i]}.log
|
build_env ${os_versions[$i]} | tee ./liquidsoap-compile_logs/build_env_${os_versions[$i]}.log
|
||||||
|
@ -122,8 +119,7 @@ do
|
||||||
done
|
done
|
||||||
if [ $flag = 1 ]; then
|
if [ $flag = 1 ]; then
|
||||||
echo "Unsupported Platform from:"
|
echo "Unsupported Platform from:"
|
||||||
for j in "${os_versions[@]}"
|
for j in "${os_versions[@]}"; do
|
||||||
do
|
|
||||||
echo $j
|
echo $j
|
||||||
done
|
done
|
||||||
exit 1
|
exit 1
|
||||||
|
@ -133,15 +129,13 @@ do
|
||||||
c)
|
c)
|
||||||
if [ "$OPTARG" = "all" ]; then
|
if [ "$OPTARG" = "all" ]; then
|
||||||
echo "Compiling liquidsoap for all platforms on server..."
|
echo "Compiling liquidsoap for all platforms on server..."
|
||||||
for i in $(seq 0 $(($num -1)))
|
for i in $(seq 0 $((num - 1))); do
|
||||||
do
|
|
||||||
compile_liq ${os_versions[$i]} | tee ./liquidsoap-compile_logs/compile_liq_${os_versions[$i]}.log
|
compile_liq ${os_versions[$i]} | tee ./liquidsoap-compile_logs/compile_liq_${os_versions[$i]}.log
|
||||||
done
|
done
|
||||||
|
|
||||||
else
|
else
|
||||||
flag=1
|
flag=1
|
||||||
for i in $(seq 0 $(($num -1)));
|
for i in $(seq 0 $((num - 1))); do
|
||||||
do
|
|
||||||
if [ "$OPTARG" = ${os_versions[$i]} ]; then
|
if [ "$OPTARG" = ${os_versions[$i]} ]; then
|
||||||
echo "Compiling liquidsoap for platform: $OPTARG ..."
|
echo "Compiling liquidsoap for platform: $OPTARG ..."
|
||||||
compile_liq ${os_versions[$i]} | tee ./liquidsoap-compile_logs/compile_liq_${os_versions[$i]}.log
|
compile_liq ${os_versions[$i]} | tee ./liquidsoap-compile_logs/compile_liq_${os_versions[$i]}.log
|
||||||
|
@ -150,8 +144,7 @@ do
|
||||||
done
|
done
|
||||||
if [ $flag = 1 ]; then
|
if [ $flag = 1 ]; then
|
||||||
echo "Unsupported Platform from:"
|
echo "Unsupported Platform from:"
|
||||||
for k in "${os_versions[@]}"
|
for k in "${os_versions[@]}"; do
|
||||||
do
|
|
||||||
echo $k
|
echo $k
|
||||||
done
|
done
|
||||||
exit 1
|
exit 1
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/bin/bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
# the base url of the bamboo server
|
# the base url of the bamboo server
|
||||||
baseurl="$1/updateAndBuild.action?buildKey="
|
baseurl="$1/updateAndBuild.action?buildKey="
|
||||||
|
@ -21,5 +21,4 @@ while (( "$#" )); do
|
||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
|
|
@ -1,11 +1,14 @@
|
||||||
#!/bin/bash -e
|
#!/usr/bin/env bash
|
||||||
# Absolute path to this script
|
|
||||||
SCRIPT=`readlink -f $0`
|
|
||||||
# Absolute directory this script is in
|
|
||||||
SCRIPTPATH=`dirname $SCRIPT`
|
|
||||||
|
|
||||||
cd $SCRIPTPATH/../airtime_mvc/
|
set -e
|
||||||
path=`pwd`
|
|
||||||
|
# Absolute path to this script
|
||||||
|
SCRIPT=$(readlink -f "$0")
|
||||||
|
# Absolute directory this script is in
|
||||||
|
SCRIPTPATH=$(dirname "$SCRIPT")
|
||||||
|
|
||||||
|
cd "$SCRIPTPATH/../airtime_mvc/" || (echo "could not cd in $SCRIPTPATH/../airtime_mvc/" && exit 1)
|
||||||
|
path=$(pwd)
|
||||||
cd build
|
cd build
|
||||||
sed -i s#"project\.home =.*$"#"project.home = $path"#g build.properties
|
sed -i "s|\"project\.home =.*$\"|\"project.home = $path\"|g" build.properties
|
||||||
../../vendor/propel/propel1/generator/bin/propel-gen
|
../../vendor/propel/propel1/generator/bin/propel-gen
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
#!/bin/bash -e
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
#release.sh 1.8.2
|
#release.sh 1.8.2
|
||||||
#creates a libretime folder with a "1.8.2" suffix
|
#creates a libretime folder with a "1.8.2" suffix
|
||||||
|
@ -17,13 +19,13 @@ if [ $# == 0 ]; then
|
||||||
exit
|
exit
|
||||||
elif [ $# == 1 ]; then
|
elif [ $# == 1 ]; then
|
||||||
suffix=$1
|
suffix=$1
|
||||||
version=$1
|
# version=$1
|
||||||
else
|
else
|
||||||
suffix=$1-$2
|
suffix=$1-$2
|
||||||
version=$1
|
# version=$1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
dir=$(dirname $(readlink -f $0))
|
# dir=$(dirname "$(readlink -f "$0")")
|
||||||
gitrepo=$(readlink -f ./../../)
|
gitrepo=$(readlink -f ./../../)
|
||||||
|
|
||||||
echo "Creating tarball for LibreTime ${suffix}."
|
echo "Creating tarball for LibreTime ${suffix}."
|
||||||
|
@ -78,5 +80,4 @@ tar -czf $target_file \
|
||||||
echo " Done"
|
echo " Done"
|
||||||
popd
|
popd
|
||||||
|
|
||||||
|
|
||||||
echo "Output file available at $target_file"
|
echo "Output file available at $target_file"
|
||||||
|
|
|
@ -22,7 +22,8 @@
|
||||||
#
|
#
|
||||||
# - When merging branches, conflicts in PO files will be marked with "#-#-#-#"
|
# - When merging branches, conflicts in PO files will be marked with "#-#-#-#"
|
||||||
#
|
#
|
||||||
O=$1
|
|
||||||
|
# O=$1
|
||||||
A=$2
|
A=$2
|
||||||
B=$3
|
B=$3
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/bin/bash
|
#!/usr/bin/env bash
|
||||||
if [[ $EUID -ne 0 ]]; then
|
if [[ $EUID -ne 0 ]]; then
|
||||||
echo "This script must be run as root." 1>&2
|
echo "This script must be run as root." 1>&2
|
||||||
exit 1
|
exit 1
|
||||||
|
@ -30,7 +30,6 @@ elif [ "$1" = "--disable" ]; then
|
||||||
chown -Rv $user:$user /var/tmp/airtime/pypo/
|
chown -Rv $user:$user /var/tmp/airtime/pypo/
|
||||||
chmod -v a+r /etc/airtime/api_client.cfg
|
chmod -v a+r /etc/airtime/api_client.cfg
|
||||||
|
|
||||||
|
|
||||||
/etc/init.d/airtime-playout stop-liquidsoap
|
/etc/init.d/airtime-playout stop-liquidsoap
|
||||||
/etc/init.d/airtime-playout start
|
/etc/init.d/airtime-playout start
|
||||||
else
|
else
|
||||||
|
|
|
@ -4,8 +4,8 @@ cd ..
|
||||||
|
|
||||||
#generate a new .po file
|
#generate a new .po file
|
||||||
#this will generate a file called messages.po
|
#this will generate a file called messages.po
|
||||||
find airtime_mvc -iname "*.phtml" -o -name "*.php" | xargs xgettext -L php --from-code=UTF-8
|
find airtime_mvc -print0 -iname "*.phtml" -o -name "*.php" | xargs xgettext -L php --from-code=UTF-8
|
||||||
find airtime_mvc -iname "*.phtml" -o -name "*.php" | xargs xgettext -L php --from-code=UTF-8 -k --keyword=_pro:1 -d pro --force-po
|
find airtime_mvc -print0 -iname "*.phtml" -o -name "*.php" | xargs xgettext -L php --from-code=UTF-8 -k --keyword=_pro:1 -d pro --force-po
|
||||||
|
|
||||||
#merge the new messages from messages.po into each existing .po file
|
#merge the new messages from messages.po into each existing .po file
|
||||||
#this will generate new .po files
|
#this will generate new .po files
|
||||||
|
|
189
install
189
install
|
@ -1,7 +1,6 @@
|
||||||
#!/bin/bash -e
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
#-e Causes bash script to exit if any of the installers
|
set -e # Exit if any of the steps fails.
|
||||||
#return with a non-zero return value.
|
|
||||||
|
|
||||||
if [[ $EUID -ne 0 ]]; then
|
if [[ $EUID -ne 0 ]]; then
|
||||||
echo "Please run as root user."
|
echo "Please run as root user."
|
||||||
|
@ -57,8 +56,7 @@ showhelp () {
|
||||||
Skips all postgres related install tasks (Useful if you configure
|
Skips all postgres related install tasks (Useful if you configure
|
||||||
postgresql as part of another script / docker builds)
|
postgresql as part of another script / docker builds)
|
||||||
--no-rabbitmq
|
--no-rabbitmq
|
||||||
Skips all rabbitmq related install tasks.
|
Skips all rabbitmq related install tasks."
|
||||||
"
|
|
||||||
exit 0
|
exit 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -112,16 +110,16 @@ function loud() {
|
||||||
function loudCmd() {
|
function loudCmd() {
|
||||||
if [[ ${_q} -eq 0 ]]; then
|
if [[ ${_q} -eq 0 ]]; then
|
||||||
verbose "$@"
|
verbose "$@"
|
||||||
eval $@
|
eval "$@"
|
||||||
else
|
else
|
||||||
eval $@ > /dev/null
|
eval "$@" > /dev/null
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkCommandExists() {
|
function checkCommandExists() {
|
||||||
set +e
|
set +e
|
||||||
command=$@
|
command="$1"
|
||||||
eval hash ${command} 2>/dev/null
|
eval hash "${command}" 2> /dev/null
|
||||||
commandFound=$?
|
commandFound=$?
|
||||||
if [[ ! ${commandFound} -eq 0 ]]; then
|
if [[ ! ${commandFound} -eq 0 ]]; then
|
||||||
echo -e "Error: ${command} not found. Please ensure you have the corresponding dependency installed."
|
echo -e "Error: ${command} not found. Please ensure you have the corresponding dependency installed."
|
||||||
|
@ -151,15 +149,25 @@ function systemInitDetect() {
|
||||||
# Get package of PID=1 path as it identifies the init system.
|
# Get package of PID=1 path as it identifies the init system.
|
||||||
# Allow this to fail, at least then the init system can be guessed from the
|
# Allow this to fail, at least then the init system can be guessed from the
|
||||||
# PID 1 executable alone
|
# PID 1 executable alone
|
||||||
pid_1_package=$(dpkg -S $pid_1_path 2>/dev/null ||
|
pid_1_package=$(dpkg -S "$pid_1_path" 2> /dev/null ||
|
||||||
rpm --qf '%{name}\n' -qf $pid_1_path 2>/dev/null ||
|
rpm --qf '%{name}\n' -qf "$pid_1_path" 2> /dev/null ||
|
||||||
echo "unknown")
|
echo "unknown")
|
||||||
verbose "Detected package name for PID=1 process: $pid_1_package"
|
verbose "Detected package name for PID=1 process: $pid_1_package"
|
||||||
case "${pid_1_package}:${pid_1_path}" in
|
case "${pid_1_package}:${pid_1_path}" in
|
||||||
*systemd*) has_systemd_init=true; verbose "Detected init system type: systemd" ;;
|
*systemd*)
|
||||||
*upstart*) has_upstart_init=true; verbose "Detected init system type: Upstart" ;;
|
has_systemd_init=true
|
||||||
*sysvinit*) has_systemv_init=true; verbose "Detected init system type: System V" ;;
|
verbose "Detected init system type: systemd"
|
||||||
*) echo "ERROR: Unable to detect init system using package or path of PID=1 process!" >&2
|
;;
|
||||||
|
*upstart*)
|
||||||
|
has_upstart_init=true
|
||||||
|
verbose "Detected init system type: Upstart"
|
||||||
|
;;
|
||||||
|
*sysvinit*)
|
||||||
|
has_systemv_init=true
|
||||||
|
verbose "Detected init system type: System V"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "ERROR: Unable to detect init system using package or path of PID=1 process!" >&2
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
@ -176,6 +184,7 @@ function systemInitDetect() {
|
||||||
function systemInitInstall() {
|
function systemInitInstall() {
|
||||||
local service_name="$1"
|
local service_name="$1"
|
||||||
local user="$2"
|
local user="$2"
|
||||||
|
# shellcheck disable=SC2034
|
||||||
local source_base_path=""
|
local source_base_path=""
|
||||||
local source_path=""
|
local source_path=""
|
||||||
local target_path=""
|
local target_path=""
|
||||||
|
@ -189,26 +198,26 @@ function systemInitInstall() {
|
||||||
libretime-analyzer)
|
libretime-analyzer)
|
||||||
source_path="${python_source_path}/airtime_analyzer/install/systemd/${service_name}.service"
|
source_path="${python_source_path}/airtime_analyzer/install/systemd/${service_name}.service"
|
||||||
target_path="/etc/systemd/system/${service_name}.service"
|
target_path="/etc/systemd/system/${service_name}.service"
|
||||||
alt_path=$(echo $target_path | sed 's/libretime-/airtime_/')
|
alt_path="${target_path//libretime-/airtime_}"
|
||||||
;;
|
;;
|
||||||
libretime-celery)
|
libretime-celery)
|
||||||
source_path="${python_source_path}/airtime-celery/install/systemd/${service_name}.service"
|
source_path="${python_source_path}/airtime-celery/install/systemd/${service_name}.service"
|
||||||
target_path="/etc/systemd/system/${service_name}.service"
|
target_path="/etc/systemd/system/${service_name}.service"
|
||||||
alt_path=$(echo $target_path | sed 's/libretime-/airtime-/')
|
alt_path="${target_path//libretime-/airtime-}"
|
||||||
;;
|
;;
|
||||||
libretime-liquidsoap | libretime-playout)
|
libretime-liquidsoap | libretime-playout)
|
||||||
source_path="${python_source_path}/pypo/install/systemd/${service_name}.service"
|
source_path="${python_source_path}/pypo/install/systemd/${service_name}.service"
|
||||||
target_path="/etc/systemd/system/${service_name}.service"
|
target_path="/etc/systemd/system/${service_name}.service"
|
||||||
alt_path=$(echo $target_path | sed 's/libretime-/airtime-/')
|
alt_path="${target_path//libretime-/airtime-}"
|
||||||
;;
|
;;
|
||||||
libretime-api)
|
libretime-api)
|
||||||
source_path="${SCRIPT_DIR-$PWD}/api/install/systemd/${service_name}.service"
|
source_path="${SCRIPT_DIR-$PWD}/api/install/systemd/${service_name}.service"
|
||||||
target_path="/etc/systemd/system/${service_name}.service"
|
target_path="/etc/systemd/system/${service_name}.service"
|
||||||
alt_path=$(echo $target_path | sed 's/libretime-/airtime-/')
|
alt_path="${target_path//libretime-/airtime-}"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
if [[ ! -e $source_path ]]; then
|
if [[ ! -e $source_path ]]; then
|
||||||
echo "$0:${FUNCNAME}(): ERROR: service \"$service_name\" with source path \"$source_path\" does not exist!" >&2
|
echo "$0:${FUNCNAME[0]}(): ERROR: service \"$service_name\" with source path \"$source_path\" does not exist!" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
# Stop and disable the service if it already exists
|
# Stop and disable the service if it already exists
|
||||||
|
@ -220,7 +229,8 @@ function systemInitInstall() {
|
||||||
local old_style_unit_exists="f"
|
local old_style_unit_exists="f"
|
||||||
# Migrate old style airtime unit exist if it exists
|
# Migrate old style airtime unit exist if it exists
|
||||||
if [[ -e $alt_path && ! -L $alt_path ]]; then
|
if [[ -e $alt_path && ! -L $alt_path ]]; then
|
||||||
local old_service=$(echo $service_name | sed 's/libretime/airtime/' | sed 's/-analyzer/_analyzer/')
|
local old_service
|
||||||
|
old_service=$(echo "$service_name" | sed 's/libretime/airtime/' | sed 's/-analyzer/_analyzer/')
|
||||||
verbose "Old service $old_service already exists - migrating."
|
verbose "Old service $old_service already exists - migrating."
|
||||||
loudCmd "systemctl disable ${old_service}.service"
|
loudCmd "systemctl disable ${old_service}.service"
|
||||||
loudCmd "systemctl stop ${old_service}.service"
|
loudCmd "systemctl stop ${old_service}.service"
|
||||||
|
@ -232,15 +242,15 @@ function systemInitInstall() {
|
||||||
loudCmd "cp $source_path $target_path"
|
loudCmd "cp $source_path $target_path"
|
||||||
else
|
else
|
||||||
sed -e "s/User=.*/User=${user}/" \
|
sed -e "s/User=.*/User=${user}/" \
|
||||||
-e "s/Group=.*/Group=${user}/" $source_path > $target_path
|
-e "s/Group=.*/Group=${user}/" "$source_path" > "$target_path"
|
||||||
fi
|
fi
|
||||||
if [[ $old_style_unit_exists == "t" ]]; then
|
if [[ $old_style_unit_exists == "t" ]]; then
|
||||||
verbose "Maintaining compatibility with old systemd unit names"
|
verbose "Maintaining compatibility with old systemd unit names"
|
||||||
# Alias to old Airtime names
|
# Alias to old Airtime names
|
||||||
loudCmd "ln -s $source_path $alt_path"
|
loudCmd "ln -s $source_path $alt_path"
|
||||||
fi
|
fi
|
||||||
chmod 0644 $target_path
|
chmod 0644 "$target_path"
|
||||||
chown root:root $target_path
|
chown root:root "$target_path"
|
||||||
verbose "Service ${service_name} installed into ${target_path}"
|
verbose "Service ${service_name} installed into ${target_path}"
|
||||||
# Enable and start the service
|
# Enable and start the service
|
||||||
loudCmd "systemctl enable ${service_name}.service"
|
loudCmd "systemctl enable ${service_name}.service"
|
||||||
|
@ -264,7 +274,7 @@ function systemInitInstall() {
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
if [[ ! -e $source_path ]]; then
|
if [[ ! -e $source_path ]]; then
|
||||||
echo "$0:${FUNCNAME}(): ERROR: service \"$service_name\" with source path \"$source_path\" does not exist!" >&2
|
echo "$0:${FUNCNAME[0]}(): ERROR: service \"$service_name\" with source path \"$source_path\" does not exist!" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
# Stop the service if it already exists
|
# Stop the service if it already exists
|
||||||
|
@ -277,10 +287,10 @@ function systemInitInstall() {
|
||||||
loudCmd "cp $source_path $target_path"
|
loudCmd "cp $source_path $target_path"
|
||||||
else
|
else
|
||||||
sed -e "s/WEB_USER/${user}/g" \
|
sed -e "s/WEB_USER/${user}/g" \
|
||||||
-e "/^set[gu]id/{s/www-data/${user}/}" $source_path > $target_path
|
-e "/^set[gu]id/{s/www-data/${user}/}" "$source_path" > "$target_path"
|
||||||
fi
|
fi
|
||||||
chmod 0644 $target_path
|
chmod 0644 "$target_path"
|
||||||
chown root:root $target_path
|
chown root:root "$target_path"
|
||||||
verbose "Service ${service_name} installed into ${target_path}"
|
verbose "Service ${service_name} installed into ${target_path}"
|
||||||
loudCmd "initctl check-config $service_name"
|
loudCmd "initctl check-config $service_name"
|
||||||
elif $has_systemv_init; then
|
elif $has_systemv_init; then
|
||||||
|
@ -304,7 +314,7 @@ function systemInitInstall() {
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
if [[ ! -e $source_path ]]; then
|
if [[ ! -e $source_path ]]; then
|
||||||
echo "$0:${FUNCNAME}(): ERROR: service \"$service_name\" with source path \"$source_path\" does not exist!" >&2
|
echo "$0:${FUNCNAME[0]}(): ERROR: service \"$service_name\" with source path \"$source_path\" does not exist!" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
# Stop the service if it already exists
|
# Stop the service if it already exists
|
||||||
|
@ -319,13 +329,13 @@ function systemInitInstall() {
|
||||||
loudCmd "cp $source_config_path $target_config_path"
|
loudCmd "cp $source_config_path $target_config_path"
|
||||||
else
|
else
|
||||||
sed -e "/^USERID/{s/www-data/${user}/}" \
|
sed -e "/^USERID/{s/www-data/${user}/}" \
|
||||||
-e "/^GROUPID/{s/www-data/${user}/}" $source_path > $target_path
|
-e "/^GROUPID/{s/www-data/${user}/}" "$source_path" > "$target_path"
|
||||||
fi
|
fi
|
||||||
chmod 0644 $target_path
|
chmod 0644 "$target_path"
|
||||||
chown root:root $target_path
|
chown root:root "$target_path"
|
||||||
if [[ -n $target_config_path ]]; then
|
if [[ -n $target_config_path ]]; then
|
||||||
chmod 0644 $target_config_path
|
chmod 0644 "$target_config_path"
|
||||||
chown root:root $target_config_path
|
chown root:root "$target_config_path"
|
||||||
fi
|
fi
|
||||||
verbose "Service ${service_name} installed into ${target_path}"
|
verbose "Service ${service_name} installed into ${target_path}"
|
||||||
# Create symlinks for the appropriate runlevels
|
# Create symlinks for the appropriate runlevels
|
||||||
|
@ -342,17 +352,18 @@ function systemInitInstall() {
|
||||||
# Where _command_ is one of: start, stop, status, reload, restart
|
# Where _command_ is one of: start, stop, status, reload, restart
|
||||||
# enable, disable and either daemon-reload or reload-configuration.
|
# enable, disable and either daemon-reload or reload-configuration.
|
||||||
function systemInitCommand() {
|
function systemInitCommand() {
|
||||||
local command=$1; shift
|
local command=$1
|
||||||
|
shift
|
||||||
case "$command" in
|
case "$command" in
|
||||||
start | stop | status | reload | restart)
|
start | stop | status | reload | restart)
|
||||||
if $has_systemd_init; then
|
if $has_systemd_init; then
|
||||||
loudCmd "systemctl $command $@"
|
loudCmd "systemctl $command $*"
|
||||||
elif $has_upstart_init; then
|
elif $has_upstart_init; then
|
||||||
for svc_name in $@; do
|
for svc_name in "$@"; do
|
||||||
loudCmd "service $svc_name $command"
|
loudCmd "service $svc_name $command"
|
||||||
done
|
done
|
||||||
elif $has_systemv_init; then
|
elif $has_systemv_init; then
|
||||||
for svc_name in $@; do
|
for svc_name in "$@"; do
|
||||||
loudCmd "invoke-rc.d $svc_name $command"
|
loudCmd "invoke-rc.d $svc_name $command"
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
@ -361,9 +372,10 @@ function systemInitCommand() {
|
||||||
$has_systemd_init &&
|
$has_systemd_init &&
|
||||||
loudCmd "systemctl $command $1.service"
|
loudCmd "systemctl $command $1.service"
|
||||||
if $has_systemv_init; then
|
if $has_systemv_init; then
|
||||||
if [[ "$command" = "enable" ]]
|
if [[ "$command" == "enable" ]]; then
|
||||||
then loudCmd "update-rc.d $1 defaults"
|
loudCmd "update-rc.d $1 defaults"
|
||||||
else loudCmd "update-rc.d $1 enable"
|
else
|
||||||
|
loudCmd "update-rc.d $1 enable"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
@ -373,7 +385,8 @@ function systemInitCommand() {
|
||||||
$has_upstart_init &&
|
$has_upstart_init &&
|
||||||
loudCmd "initctl reload-configuration"
|
loudCmd "initctl reload-configuration"
|
||||||
;;
|
;;
|
||||||
*) echo -e "$0:${FUNCNAME}(): ERROR: command \"$command\" is not supported!" >&2
|
*)
|
||||||
|
echo -e "$0:${FUNCNAME[0]}(): ERROR: command \"$command\" is not supported!" >&2
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
@ -465,7 +478,7 @@ while :; do
|
||||||
;;
|
;;
|
||||||
--web-root)
|
--web-root)
|
||||||
if [ "$2" ]; then
|
if [ "$2" ]; then
|
||||||
web_root=$(readlink -f $2)
|
web_root=$(readlink -f "$2")
|
||||||
shift 2
|
shift 2
|
||||||
continue
|
continue
|
||||||
else
|
else
|
||||||
|
@ -556,19 +569,21 @@ while :; do
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "$0: error - unrecognized option '${1:$i:1}'" >&2;
|
echo "$0: error - unrecognized option '${1:i:1}'" >&2
|
||||||
echo "Try 'install --help' for more information."
|
echo "Try 'install --help' for more information."
|
||||||
exit 1
|
exit 1
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
break
|
break
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ -z web_root -a ! -d web_root ]; then
|
if [[ -z $web_root || ! -d $web_root ]]; then
|
||||||
echo "$web_root doesn't exist!"
|
echo "$web_root doesn't exist!"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
@ -582,6 +597,7 @@ echo -e " \/ \/ \/ \/ \/\n"
|
||||||
echo -e "Detecting distribution and release ..."
|
echo -e "Detecting distribution and release ..."
|
||||||
if [ -e /etc/os-release ]; then
|
if [ -e /etc/os-release ]; then
|
||||||
# Access $ID, $VERSION_ID and $PRETTY_NAME
|
# Access $ID, $VERSION_ID and $PRETTY_NAME
|
||||||
|
# shellcheck disable=SC1091
|
||||||
source /etc/os-release
|
source /etc/os-release
|
||||||
echo "Detected distribution id: $ID"
|
echo "Detected distribution id: $ID"
|
||||||
echo "Detected distribution release id: $VERSION_ID"
|
echo "Detected distribution release id: $VERSION_ID"
|
||||||
|
@ -591,7 +607,7 @@ else
|
||||||
VERSION_ID=unknown
|
VERSION_ID=unknown
|
||||||
PRETTY_NAME="Unknown distribution and release"
|
PRETTY_NAME="Unknown distribution and release"
|
||||||
echo "WARNING: /etc/os-release configuration not found. Unable to detect distribution." >&2
|
echo "WARNING: /etc/os-release configuration not found. Unable to detect distribution." >&2
|
||||||
if [ -z "$dist" -o -z "$code" ]; then
|
if [[ -z $dist || -z $code ]]; then
|
||||||
echo "ERROR: One or both of --distribution and --release options were not specified." >&2
|
echo "ERROR: One or both of --distribution and --release options were not specified." >&2
|
||||||
echo "This is an unsupported distribution and/or version!" >&2
|
echo "This is an unsupported distribution and/or version!" >&2
|
||||||
exit 1
|
exit 1
|
||||||
|
@ -606,9 +622,16 @@ if [ -n "$dist" ]; then
|
||||||
if [ "$dist" != "$ID" ]; then
|
if [ "$dist" != "$ID" ]; then
|
||||||
verbose "Detected distribution \"$ID\" does not match specified one of \"$dist\". Checking ..."
|
verbose "Detected distribution \"$ID\" does not match specified one of \"$dist\". Checking ..."
|
||||||
case "$dist" in
|
case "$dist" in
|
||||||
centos|rhel) pkg_installer=/usr/bin/yum; verbose "Detected yum package installer" ;;
|
centos | rhel)
|
||||||
debian|ubuntu) pkg_installer=/usr/bin/apt-get; verbose "Detected apt-get package installer" ;;
|
pkg_installer=/usr/bin/yum
|
||||||
*) echo "ERROR: the value \"$dist\" specified for --distribution is unsupported." >&2
|
verbose "Detected yum package installer"
|
||||||
|
;;
|
||||||
|
debian | ubuntu)
|
||||||
|
pkg_installer=/usr/bin/apt-get
|
||||||
|
verbose "Detected apt-get package installer"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "ERROR: the value \"$dist\" specified for --distribution is unsupported." >&2
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
@ -625,6 +648,7 @@ is_debian_buster=false
|
||||||
is_ubuntu_dist=false
|
is_ubuntu_dist=false
|
||||||
is_ubuntu_bionic=false
|
is_ubuntu_bionic=false
|
||||||
is_centos_dist=false
|
is_centos_dist=false
|
||||||
|
# shellcheck disable=SC2034
|
||||||
is_centos_7=false
|
is_centos_7=false
|
||||||
is_centos_8=false
|
is_centos_8=false
|
||||||
# Use specified distribution and release or detected otherwise.
|
# Use specified distribution and release or detected otherwise.
|
||||||
|
@ -654,16 +678,17 @@ case "${dist}-${code}" in
|
||||||
is_debian_buster=true
|
is_debian_buster=true
|
||||||
;;
|
;;
|
||||||
#Fix for Raspbian 9 (stretch)
|
#Fix for Raspbian 9 (stretch)
|
||||||
raspbian-9|9)
|
raspbian-9)
|
||||||
echo -e "ERROR: Raspbian Stretch is archived and does not receive any security or other updates since 2020-06-06." >&2
|
echo -e "ERROR: Raspbian Stretch is archived and does not receive any security or other updates since 2020-06-06." >&2
|
||||||
echo -e "The LibreTime installer dropped support for installing LibreTime on Stretch in 3.0.0-alpha.10." >&2
|
echo -e "The LibreTime installer dropped support for installing LibreTime on Stretch in 3.0.0-alpha.10." >&2
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
#End of fix
|
#End of fix
|
||||||
#Fix for Raspbian 10 (buster)
|
#Fix for Raspbian 10 (buster)
|
||||||
raspbian-10|10)
|
raspbian-10)
|
||||||
code="buster"
|
code="buster"
|
||||||
dist="debian"
|
dist="debian"
|
||||||
|
# shellcheck disable=SC2034
|
||||||
is_debian_dist=true
|
is_debian_dist=true
|
||||||
is_debian_buster=true
|
is_debian_buster=true
|
||||||
;;
|
;;
|
||||||
|
@ -676,6 +701,7 @@ case "${dist}-${code}" in
|
||||||
;;
|
;;
|
||||||
centos-8)
|
centos-8)
|
||||||
is_centos_dist=true
|
is_centos_dist=true
|
||||||
|
# shellcheck disable=SC2034
|
||||||
is_centos_8=true
|
is_centos_8=true
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
|
@ -785,8 +811,8 @@ will be moved to /etc/airtime/airtime.conf.tmp"
|
||||||
rm -f /etc/apache2/sites-available/airtime.conf /etc/apache2/sites-enabled/airtime.conf
|
rm -f /etc/apache2/sites-available/airtime.conf /etc/apache2/sites-enabled/airtime.conf
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -d /usr/share/airtime -a web_root = /usr/share/airtime ]; then
|
if [[ -d "/usr/share/airtime" && $web_root == "/usr/share/airtime" ]]; then
|
||||||
rm -rf /usr/share/airtime
|
rm -rf "/usr/share/airtime"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
mv /etc/airtime/airtime.conf /etc/airtime/airtime.conf.tmp
|
mv /etc/airtime/airtime.conf /etc/airtime/airtime.conf.tmp
|
||||||
|
@ -795,17 +821,17 @@ will be moved to /etc/airtime/airtime.conf.tmp"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
API2_APACHE_CONF=$(grep -F "ProxyPass" /etc/apache2/sites-available/airtime.conf || true)
|
API2_APACHE_CONF=$(grep -F "ProxyPass" /etc/apache2/sites-available/airtime.conf || true)
|
||||||
if [ -z "${API2_APACHE_CONF}" -a "$apache" = "t" ]; then
|
if [[ -z "${API2_APACHE_CONF}" && "$apache" == "t" ]]; then
|
||||||
# Remove Apache configuration so that the ProxyPass configuration for API 2.0
|
# Remove Apache configuration so that the ProxyPass configuration for API 2.0
|
||||||
# is installed
|
# is installed
|
||||||
rm -f /etc/apache2/sites-available/airtime.conf /etc/apache2/sites-enabled/airtime.conf
|
rm -f /etc/apache2/sites-available/airtime.conf /etc/apache2/sites-enabled/airtime.conf
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$apache" = "f" -a ${_i} -eq 1 ]; then
|
if [[ "$apache" = "f" && ${_i} -eq 1 ]]; then
|
||||||
echo -e "Install default Airtime apache configuration? (Y/n): \c"
|
echo -e "Install default Airtime apache configuration? (Y/n): \c"
|
||||||
read IN
|
read IN
|
||||||
IN=${IN:-$default_value}
|
IN=${IN:-$default_value}
|
||||||
if [ "$IN" = "y" -o "$IN" = "Y" ]; then
|
if [[ "$IN" = "y" || "$IN" = "Y" ]]; then
|
||||||
apache="t"
|
apache="t"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
@ -835,7 +861,7 @@ if [ "$apache" = "t" ]; then
|
||||||
loud " * Configuring Apache * "
|
loud " * Configuring Apache * "
|
||||||
loud "-----------------------------------------------------"
|
loud "-----------------------------------------------------"
|
||||||
# Detect Apache root folder, e.g. /etc/apache2 or /etc/httpd
|
# Detect Apache root folder, e.g. /etc/apache2 or /etc/httpd
|
||||||
eval $($apache_bin -V |awk '/HTTPD_ROOT|SERVER_CONFIG_FILE/ { print $2 }')
|
eval "$($apache_bin -V | awk '/HTTPD_ROOT|SERVER_CONFIG_FILE/ { print $2 }')"
|
||||||
apache_conf="${HTTPD_ROOT}/${SERVER_CONFIG_FILE}"
|
apache_conf="${HTTPD_ROOT}/${SERVER_CONFIG_FILE}"
|
||||||
verbose "Detected Apache root folder is: ${HTTPD_ROOT}"
|
verbose "Detected Apache root folder is: ${HTTPD_ROOT}"
|
||||||
if [[ ! -e $apache_conf ]]; then
|
if [[ ! -e $apache_conf ]]; then
|
||||||
|
@ -870,7 +896,7 @@ if [ "$apache" = "t" ]; then
|
||||||
# install apache, we should overwrite any existing configuration. If we don't do this, doing
|
# install apache, we should overwrite any existing configuration. If we don't do this, doing
|
||||||
# an in-place installation over an old Airtime install (which installs to /usr/share by default)
|
# an in-place installation over an old Airtime install (which installs to /usr/share by default)
|
||||||
# will fail
|
# will fail
|
||||||
if [ "$upgrade" = "t" -o ! -f ${apache_sitedir}${airtimeconfigfile} ]; then
|
if [[ "$upgrade" == "t" || ! -f "${apache_sitedir}${airtimeconfigfile}" ]]; then
|
||||||
verbose "\n * Creating Apache config for Airtime..."
|
verbose "\n * Creating Apache config for Airtime..."
|
||||||
listen_port=""
|
listen_port=""
|
||||||
if [ "$web_port" != "80" ]; then
|
if [ "$web_port" != "80" ]; then
|
||||||
|
@ -903,11 +929,11 @@ if [ "$apache" = "t" ]; then
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$icecast" = "f" -a ${_i} -eq 1 ]; then
|
if [[ "$icecast" == "f" && ${_i} -eq 1 ]]; then
|
||||||
echo -e "Install default Airtime Icecast configuration? (Y/n): \c"
|
echo -e "Install default Airtime Icecast configuration? (Y/n): \c"
|
||||||
read IN
|
read -r IN
|
||||||
IN=${IN:-$default_value}
|
IN=${IN:-$default_value}
|
||||||
if [ "$IN" = "y" -o "$IN" = "Y" ]; then
|
if [[ $IN == "y" || $IN == "Y" ]]; then
|
||||||
icecast="t"
|
icecast="t"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
@ -926,15 +952,15 @@ if [ "$icecast" = "t" ]; then
|
||||||
icecast_unit_name="icecast"
|
icecast_unit_name="icecast"
|
||||||
icecast_config="/etc/icecast.xml"
|
icecast_config="/etc/icecast.xml"
|
||||||
fi
|
fi
|
||||||
systemInitCommand enable ${icecast_unit_name}
|
systemInitCommand enable "${icecast_unit_name}"
|
||||||
# only update icecast password if
|
# only update icecast password if
|
||||||
if [ ! -e "/etc/airtime/airtime.conf" ] && [ ! -e "/etc/airtime/airtime.conf.tmp" ]; then
|
if [ ! -e "/etc/airtime/airtime.conf" ] && [ ! -e "/etc/airtime/airtime.conf.tmp" ]; then
|
||||||
icecast_pass=$(< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c${1:-12};)
|
icecast_pass=$(tr -dc _A-Z-a-z-0-9 < /dev/urandom | head -c"${1:-12}")
|
||||||
echo $icecast_pass > /tmp/icecast_pass
|
echo "$icecast_pass" > /tmp/icecast_pass
|
||||||
loud "\n New install detected setting icecast password to random value."
|
loud "\n New install detected setting icecast password to random value."
|
||||||
xmlstarlet ed --inplace -u /icecast/authentication/source-password -v $icecast_pass $icecast_config
|
xmlstarlet ed --inplace -u /icecast/authentication/source-password -v "$icecast_pass" "$icecast_config"
|
||||||
xmlstarlet ed --inplace -u /icecast/authentication/relay-password -v $icecast_pass $icecast_config
|
xmlstarlet ed --inplace -u /icecast/authentication/relay-password -v "$icecast_pass" "$icecast_config"
|
||||||
xmlstarlet ed --inplace -u /icecast/authentication/admin-password -v $icecast_pass $icecast_config
|
xmlstarlet ed --inplace -u /icecast/authentication/admin-password -v "$icecast_pass" "$icecast_config"
|
||||||
fi
|
fi
|
||||||
# restart in case icecast was already started (like is the case on debian)
|
# restart in case icecast was already started (like is the case on debian)
|
||||||
systemInitCommand restart ${icecast_unit_name}
|
systemInitCommand restart ${icecast_unit_name}
|
||||||
|
@ -958,7 +984,7 @@ verbose "...Done"
|
||||||
verbose "\n * Creating /run/airtime..."
|
verbose "\n * Creating /run/airtime..."
|
||||||
mkdir -p /run/airtime
|
mkdir -p /run/airtime
|
||||||
chmod 755 /run/airtime
|
chmod 755 /run/airtime
|
||||||
chown -R ${web_user}:${web_user} /run/airtime
|
chown -R "${web_user}:${web_user}" /run/airtime
|
||||||
verbose "...Done"
|
verbose "...Done"
|
||||||
|
|
||||||
if [ ! -d /var/log/airtime ]; then
|
if [ ! -d /var/log/airtime ]; then
|
||||||
|
@ -982,8 +1008,8 @@ verbose "\n * Installing pypo and liquidsoap..."
|
||||||
loudCmd "$python_bin ${AIRTIMEROOT}/python_apps/pypo/setup.py install --install-scripts=/usr/bin --no-init-script"
|
loudCmd "$python_bin ${AIRTIMEROOT}/python_apps/pypo/setup.py install --install-scripts=/usr/bin --no-init-script"
|
||||||
loudCmd "mkdir -p /var/log/airtime/{pypo,pypo-liquidsoap} /var/tmp/airtime/pypo/{cache,files,tmp} /var/tmp/airtime/show-recorder/"
|
loudCmd "mkdir -p /var/log/airtime/{pypo,pypo-liquidsoap} /var/tmp/airtime/pypo/{cache,files,tmp} /var/tmp/airtime/show-recorder/"
|
||||||
loudCmd "chown -R ${web_user}:${web_user} /var/log/airtime/{pypo,pypo-liquidsoap} /var/tmp/airtime/pypo/{cache,files,tmp} /var/tmp/airtime/show-recorder/"
|
loudCmd "chown -R ${web_user}:${web_user} /var/log/airtime/{pypo,pypo-liquidsoap} /var/tmp/airtime/pypo/{cache,files,tmp} /var/tmp/airtime/show-recorder/"
|
||||||
systemInitInstall libretime-liquidsoap $web_user
|
systemInitInstall libretime-liquidsoap "$web_user"
|
||||||
systemInitInstall libretime-playout $web_user
|
systemInitInstall libretime-playout "$web_user"
|
||||||
verbose "...Done"
|
verbose "...Done"
|
||||||
|
|
||||||
verbose "\n * Installing airtime-celery..."
|
verbose "\n * Installing airtime-celery..."
|
||||||
|
@ -1004,16 +1030,16 @@ verbose "...Done"
|
||||||
|
|
||||||
verbose "\n * Installing libretime-analyzer..."
|
verbose "\n * Installing libretime-analyzer..."
|
||||||
loudCmd "$python_bin ${AIRTIMEROOT}/python_apps/airtime_analyzer/setup.py install --install-scripts=/usr/bin"
|
loudCmd "$python_bin ${AIRTIMEROOT}/python_apps/airtime_analyzer/setup.py install --install-scripts=/usr/bin"
|
||||||
systemInitInstall libretime-analyzer $web_user
|
systemInitInstall libretime-analyzer "$web_user"
|
||||||
verbose "...Done"
|
verbose "...Done"
|
||||||
|
|
||||||
verbose "\n * Installing API..."
|
verbose "\n * Installing API..."
|
||||||
loudCmd "python3 ${AIRTIMEROOT}/api/setup.py install --install-scripts=/usr/bin"
|
loudCmd "python3 ${AIRTIMEROOT}/api/setup.py install --install-scripts=/usr/bin"
|
||||||
systemInitInstall libretime-api $web_user
|
systemInitInstall libretime-api "$web_user"
|
||||||
mkdir -p /etc/airtime
|
mkdir -p /etc/airtime
|
||||||
sed -e "s@WEB_USER@${web_user}@g" \
|
sed -e "s@WEB_USER@${web_user}@g" \
|
||||||
-e "s@WEB_ROOT@${web_root}@g" \
|
-e "s@WEB_ROOT@${web_root}@g" \
|
||||||
${AIRTIMEROOT}/installer/uwsgi/libretime-api.ini > /etc/airtime/libretime-api.ini
|
"${AIRTIMEROOT}/installer/uwsgi/libretime-api.ini" > /etc/airtime/libretime-api.ini
|
||||||
loudCmd "libretime-api collectstatic --clear --noinput"
|
loudCmd "libretime-api collectstatic --clear --noinput"
|
||||||
verbose "...Done"
|
verbose "...Done"
|
||||||
|
|
||||||
|
@ -1037,7 +1063,7 @@ php_conf_dirs=(
|
||||||
"/etc/php5/apache2/conf.d" # Debian Stretch, Debian Jessie, Ubuntu Trusty
|
"/etc/php5/apache2/conf.d" # Debian Stretch, Debian Jessie, Ubuntu Trusty
|
||||||
"/etc/php.d" # CentOS 7
|
"/etc/php.d" # CentOS 7
|
||||||
)
|
)
|
||||||
for php_conf in ${php_conf_dirs[@]}; do
|
for php_conf in "${php_conf_dirs[@]}"; do
|
||||||
[[ -d $php_conf ]] && break
|
[[ -d $php_conf ]] && break
|
||||||
done
|
done
|
||||||
if [[ -d $php_conf ]]; then
|
if [[ -d $php_conf ]]; then
|
||||||
|
@ -1097,7 +1123,7 @@ EOF
|
||||||
echo -e "Create default airtime postgres user? (Y/n): \c"
|
echo -e "Create default airtime postgres user? (Y/n): \c"
|
||||||
read IN
|
read IN
|
||||||
IN=${IN:-$default_value}
|
IN=${IN:-$default_value}
|
||||||
if [ "$IN" = "y" -o "$IN" = "Y" ]; then
|
if [[ "$IN" = "y" || "$IN" = "Y" ]]; then
|
||||||
setupAirtimePostgresUser
|
setupAirtimePostgresUser
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
@ -1112,7 +1138,7 @@ if [ $skip_rabbitmq -eq 0 ]; then
|
||||||
RABBITMQ_VHOST=/airtime
|
RABBITMQ_VHOST=/airtime
|
||||||
RABBITMQ_USER=airtime
|
RABBITMQ_USER=airtime
|
||||||
RABBITMQ_PASSWORD=airtime
|
RABBITMQ_PASSWORD=airtime
|
||||||
EXCHANGES="airtime-pypo|pypo-fetch|airtime-analyzer|media-monitor"
|
# EXCHANGES="airtime-pypo|pypo-fetch|airtime-analyzer|media-monitor"
|
||||||
|
|
||||||
# Ignore errors in this check to avoid dying when vhost isn't found
|
# Ignore errors in this check to avoid dying when vhost isn't found
|
||||||
set +e
|
set +e
|
||||||
|
@ -1158,7 +1184,6 @@ if [ ! -d "/srv/airtime" ]; then
|
||||||
fi
|
fi
|
||||||
chown -R ${web_user}:${web_user} /srv/airtime
|
chown -R ${web_user}:${web_user} /srv/airtime
|
||||||
|
|
||||||
|
|
||||||
# We only generate the locales for Airtime if you're allowing us
|
# We only generate the locales for Airtime if you're allowing us
|
||||||
# to install our dependencies, so that we won't automatically do this
|
# to install our dependencies, so that we won't automatically do this
|
||||||
# when this install script runs from our DEB package.
|
# when this install script runs from our DEB package.
|
||||||
|
@ -1172,14 +1197,14 @@ if [ "$ignore_dependencies" = "f" ]; then
|
||||||
else
|
else
|
||||||
set +e
|
set +e
|
||||||
verbose "\n * Generating locales"
|
verbose "\n * Generating locales"
|
||||||
for i in `ls ${web_root}/../locale | grep ".._.."`; do
|
for locale_file in "${web_root}"/../locale/*_*; do
|
||||||
|
locale=$(basename "$locale_file")
|
||||||
if [ "$dist" = "debian" ]; then
|
if [ "$dist" = "debian" ]; then
|
||||||
grep -qi "^$i" /etc/locale.gen
|
if ! grep -qi "^$locale" /etc/locale.gen; then
|
||||||
if [ $? -ne 0 ]; then
|
verbose "$locale.UTF-8 UTF-8" >> /etc/locale.gen
|
||||||
verbose "$i.UTF-8 UTF-8" >> /etc/locale.gen
|
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
loudCmd "locale-gen \"$i.utf8\""
|
loudCmd "locale-gen \"$locale.utf8\""
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
set -e
|
set -e
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
#!/bin/bash -e
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -e
|
||||||
#-e Causes bash script to exit if any of the installers
|
#-e Causes bash script to exit if any of the installers
|
||||||
#return with a non-zero return value.
|
#return with a non-zero return value.
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/bin/bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
# Additional Repos
|
# Additional Repos
|
||||||
yum install -y epel-release
|
yum install -y epel-release
|
||||||
|
@ -58,7 +58,6 @@ su -l postgres bash -c 'createdb -O airtime airtime'
|
||||||
echo "ALTER USER airtime WITH PASSWORD 'airtime';" | su -l postgres bash -c psql
|
echo "ALTER USER airtime WITH PASSWORD 'airtime';" | su -l postgres bash -c psql
|
||||||
echo "GRANT ALL PRIVILEGES ON DATABASE airtime TO airtime;" | su -l postgres bash -c psql
|
echo "GRANT ALL PRIVILEGES ON DATABASE airtime TO airtime;" | su -l postgres bash -c psql
|
||||||
|
|
||||||
|
|
||||||
# RabbitMQ
|
# RabbitMQ
|
||||||
curl -s https://packagecloud.io/install/repositories/rabbitmq/rabbitmq-server/script.rpm.sh | sudo bash
|
curl -s https://packagecloud.io/install/repositories/rabbitmq/rabbitmq-server/script.rpm.sh | sudo bash
|
||||||
yum install -y rabbitmq-server
|
yum install -y rabbitmq-server
|
||||||
|
@ -142,7 +141,6 @@ sed -i \
|
||||||
-e 's/LoadModule mpm_event_module/#LoadModule mpm_event_module/' \
|
-e 's/LoadModule mpm_event_module/#LoadModule mpm_event_module/' \
|
||||||
/etc/httpd/conf.modules.d/00-mpm.conf
|
/etc/httpd/conf.modules.d/00-mpm.conf
|
||||||
|
|
||||||
|
|
||||||
# celery will not run unless we install a specific version (https://github.com/pypa/setuptools/issues/942)
|
# celery will not run unless we install a specific version (https://github.com/pypa/setuptools/issues/942)
|
||||||
# this will need to be figured out later on and will get overridden by the docs installer anyhow :(
|
# this will need to be figured out later on and will get overridden by the docs installer anyhow :(
|
||||||
pip3 install setuptools==33.1.1
|
pip3 install setuptools==33.1.1
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/bin/bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
DEBIAN_FRONTEND=noninteractive apt-get -y install alsa-utils
|
DEBIAN_FRONTEND=noninteractive apt-get -y install alsa-utils
|
||||||
usermod -a -G audio vagrant
|
usermod -a -G audio vagrant
|
||||||
|
|
4
jekyll.sh
Normal file → Executable file
4
jekyll.sh
Normal file → Executable file
|
@ -1,4 +1,4 @@
|
||||||
#/bin/bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
echo "Installing Ruby"
|
echo "Installing Ruby"
|
||||||
apt-get update -y && apt-get install -y ruby-full build-essential zlib1g-dev
|
apt-get update -y && apt-get install -y ruby-full build-essential zlib1g-dev
|
||||||
|
@ -8,7 +8,7 @@ export PATH=".gems/bin:$PATH"
|
||||||
|
|
||||||
echo "Installing Jekyll"
|
echo "Installing Jekyll"
|
||||||
|
|
||||||
cd docs
|
cd docs || (echo "Could not cd in docs" && exit 1)
|
||||||
gem install jekyll bundler
|
gem install jekyll bundler
|
||||||
|
|
||||||
# Running Jekyll
|
# Running Jekyll
|
||||||
|
|
|
@ -1,4 +1,7 @@
|
||||||
#!/bin/sh -e
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
# ============================================
|
# ============================================
|
||||||
# celeryd - Starts the Celery worker daemon.
|
# celeryd - Starts the Celery worker daemon.
|
||||||
# ============================================
|
# ============================================
|
||||||
|
@ -8,7 +11,6 @@
|
||||||
#
|
#
|
||||||
# See http://docs.celeryproject.org/en/latest/tutorials/daemonizing.html#generic-init-scripts
|
# See http://docs.celeryproject.org/en/latest/tutorials/daemonizing.html#generic-init-scripts
|
||||||
|
|
||||||
|
|
||||||
### BEGIN INIT INFO
|
### BEGIN INIT INFO
|
||||||
# Provides: celeryd
|
# Provides: celeryd
|
||||||
# Required-Start: $network $local_fs $remote_fs
|
# Required-Start: $network $local_fs $remote_fs
|
||||||
|
@ -30,7 +32,7 @@
|
||||||
#
|
#
|
||||||
VERSION=10.1
|
VERSION=10.1
|
||||||
echo "celery init v${VERSION}."
|
echo "celery init v${VERSION}."
|
||||||
if [ $(id -u) -ne 0 ]; then
|
if [ "$(id -u)" -ne 0 ]; then
|
||||||
echo "Error: This program can only be used by the root user."
|
echo "Error: This program can only be used by the root user."
|
||||||
echo " Unprivileged users must use the 'celery multi' utility, "
|
echo " Unprivileged users must use the 'celery multi' utility, "
|
||||||
echo " or 'celery worker --detach'."
|
echo " or 'celery worker --detach'."
|
||||||
|
@ -52,15 +54,19 @@ DEFAULT_PID_FILE="/var/run/celery/%n.pid"
|
||||||
DEFAULT_LOG_FILE="/var/log/celery/%n.log"
|
DEFAULT_LOG_FILE="/var/log/celery/%n.log"
|
||||||
DEFAULT_LOG_LEVEL="INFO"
|
DEFAULT_LOG_LEVEL="INFO"
|
||||||
DEFAULT_NODES="celery"
|
DEFAULT_NODES="celery"
|
||||||
DEFAULT_CELERYD="-m celery worker --detach"
|
# DEFAULT_CELERYD="-m celery worker --detach"
|
||||||
|
|
||||||
CELERY_DEFAULTS=${CELERY_DEFAULTS:-"/etc/default/${SCRIPT_NAME}"}
|
CELERY_DEFAULTS=${CELERY_DEFAULTS:-"/etc/default/${SCRIPT_NAME}"}
|
||||||
# Make sure executable configuration script is owned by root
|
# Make sure executable configuration script is owned by root
|
||||||
_config_sanity() {
|
_config_sanity() {
|
||||||
local path="$1"
|
local path
|
||||||
local owner=$(ls -ld "$path" | awk '{print $3}')
|
local owner
|
||||||
local iwgrp=$(ls -ld "$path" | cut -b 6)
|
local iwgrp
|
||||||
local iwoth=$(ls -ld "$path" | cut -b 9)
|
local iwoth
|
||||||
|
path="$1"
|
||||||
|
owner=$(ls -ld "$path" | awk '{print $3}')
|
||||||
|
iwgrp=$(ls -ld "$path" | cut -b 6)
|
||||||
|
iwoth=$(ls -ld "$path" | cut -b 9)
|
||||||
if [ "$(id -u $owner)" != "0" ]; then
|
if [ "$(id -u $owner)" != "0" ]; then
|
||||||
echo "Error: Config script '$path' must be owned by root!"
|
echo "Error: Config script '$path' must be owned by root!"
|
||||||
echo
|
echo
|
||||||
|
@ -98,6 +104,7 @@ _config_sanity() {
|
||||||
if [ -f "$CELERY_DEFAULTS" ]; then
|
if [ -f "$CELERY_DEFAULTS" ]; then
|
||||||
_config_sanity "$CELERY_DEFAULTS"
|
_config_sanity "$CELERY_DEFAULTS"
|
||||||
echo "Using config script: $CELERY_DEFAULTS"
|
echo "Using config script: $CELERY_DEFAULTS"
|
||||||
|
# shellcheck disable=SC1090
|
||||||
. "$CELERY_DEFAULTS"
|
. "$CELERY_DEFAULTS"
|
||||||
fi
|
fi
|
||||||
# Sets --app argument for CELERY_BIN
|
# Sets --app argument for CELERY_BIN
|
||||||
|
@ -126,8 +133,8 @@ export CELERY_LOADER
|
||||||
if [ -n "$2" ]; then
|
if [ -n "$2" ]; then
|
||||||
CELERYD_OPTS="$CELERYD_OPTS $2"
|
CELERYD_OPTS="$CELERYD_OPTS $2"
|
||||||
fi
|
fi
|
||||||
CELERYD_LOG_DIR=`dirname $CELERYD_LOG_FILE`
|
CELERYD_LOG_DIR=$(dirname $CELERYD_LOG_FILE)
|
||||||
CELERYD_PID_DIR=`dirname $CELERYD_PID_FILE`
|
CELERYD_PID_DIR=$(dirname $CELERYD_PID_FILE)
|
||||||
# Extra start-stop-daemon options, like user/group.
|
# Extra start-stop-daemon options, like user/group.
|
||||||
if [ -n "$CELERYD_CHDIR" ]; then
|
if [ -n "$CELERYD_CHDIR" ]; then
|
||||||
DAEMON_OPTS="$DAEMON_OPTS --workdir=$CELERYD_CHDIR"
|
DAEMON_OPTS="$DAEMON_OPTS --workdir=$CELERYD_CHDIR"
|
||||||
|
@ -185,8 +192,10 @@ _get_pids() {
|
||||||
found_pids=0
|
found_pids=0
|
||||||
my_exitcode=0
|
my_exitcode=0
|
||||||
for pidfile in $(_get_pidfiles); do
|
for pidfile in $(_get_pidfiles); do
|
||||||
local pid=`cat "$pidfile"`
|
local pid
|
||||||
local cleaned_pid=`echo "$pid" | sed -e 's/[^0-9]//g'`
|
local cleaned_pid
|
||||||
|
pid=$(cat "$pidfile")
|
||||||
|
cleaned_pid=$(echo "$pid" | sed -e 's/[^0-9]//g')
|
||||||
if [ -z "$pid" ] || [ "$cleaned_pid" != "$pid" ]; then
|
if [ -z "$pid" ] || [ "$cleaned_pid" != "$pid" ]; then
|
||||||
echo "bad pid file ($pidfile)"
|
echo "bad pid file ($pidfile)"
|
||||||
one_failed=true
|
one_failed=true
|
||||||
|
@ -208,7 +217,7 @@ start_workers () {
|
||||||
if [ ! -z "$CELERYD_ULIMIT" ]; then
|
if [ ! -z "$CELERYD_ULIMIT" ]; then
|
||||||
ulimit $CELERYD_ULIMIT
|
ulimit $CELERYD_ULIMIT
|
||||||
fi
|
fi
|
||||||
_chuid $* start $CELERYD_NODES $DAEMON_OPTS \
|
_chuid "$@" start $CELERYD_NODES $DAEMON_OPTS \
|
||||||
--pidfile="$CELERYD_PID_FILE" \
|
--pidfile="$CELERYD_PID_FILE" \
|
||||||
--logfile="$CELERYD_LOG_FILE" \
|
--logfile="$CELERYD_LOG_FILE" \
|
||||||
--loglevel="$CELERYD_LOG_LEVEL" \
|
--loglevel="$CELERYD_LOG_LEVEL" \
|
||||||
|
@ -236,7 +245,7 @@ restart_workers_graceful () {
|
||||||
echo "WARNING: Use with caution in production"
|
echo "WARNING: Use with caution in production"
|
||||||
echo "The workers will attempt to restart, but they may not be able to."
|
echo "The workers will attempt to restart, but they may not be able to."
|
||||||
local worker_pids=
|
local worker_pids=
|
||||||
worker_pids=`_get_pids`
|
worker_pids=$(_get_pids)
|
||||||
[ "$one_failed" ] && exit 1
|
[ "$one_failed" ] && exit 1
|
||||||
for worker_pid in $worker_pids; do
|
for worker_pid in $worker_pids; do
|
||||||
local failed=
|
local failed=
|
||||||
|
@ -260,9 +269,12 @@ check_status () {
|
||||||
one_failed=true
|
one_failed=true
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
local node=`basename "$pidfile" .pid`
|
local node
|
||||||
local pid=`cat "$pidfile"`
|
local pid
|
||||||
local cleaned_pid=`echo "$pid" | sed -e 's/[^0-9]//g'`
|
local cleaned_pid
|
||||||
|
node=$(basename "$pidfile" .pid)
|
||||||
|
pid=$(cat "$pidfile")
|
||||||
|
cleaned_pid=$(echo "$pid" | sed -e 's/[^0-9]//g')
|
||||||
if [ -z "$pid" ] || [ "$cleaned_pid" != "$pid" ]; then
|
if [ -z "$pid" ] || [ "$cleaned_pid" != "$pid" ]; then
|
||||||
echo "bad pid file ($pidfile)"
|
echo "bad pid file ($pidfile)"
|
||||||
one_failed=true
|
one_failed=true
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/bin/bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
### BEGIN INIT INFO
|
### BEGIN INIT INFO
|
||||||
# Provides: libretime-analyzer
|
# Provides: libretime-analyzer
|
||||||
|
@ -20,6 +20,7 @@ PIDFILE=/var/run/$NAME.pid
|
||||||
[ -x "$DAEMON" ] || exit 0
|
[ -x "$DAEMON" ] || exit 0
|
||||||
|
|
||||||
# Read configuration variable file if it is present
|
# Read configuration variable file if it is present
|
||||||
|
# shellcheck disable=SC1090
|
||||||
[ -r /etc/default/$NAME ] && . /etc/default/$NAME
|
[ -r /etc/default/$NAME ] && . /etc/default/$NAME
|
||||||
|
|
||||||
# Load the VERBOSE setting and other rcS variables
|
# Load the VERBOSE setting and other rcS variables
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
#!/bin/bash -xv
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -xv
|
||||||
|
|
||||||
post_file() {
|
post_file() {
|
||||||
#kill process after 30 minutes (360*5=30 minutes)
|
#kill process after 30 minutes (360*5=30 minutes)
|
||||||
|
@ -15,11 +17,10 @@ post_file() {
|
||||||
stripped_file_path=${file_path//','/''}
|
stripped_file_path=${file_path//','/''}
|
||||||
mv "${file_path}" "${stripped_file_path}"
|
mv "${file_path}" "${stripped_file_path}"
|
||||||
file_path="${stripped_file_path}"
|
file_path="${stripped_file_path}"
|
||||||
filename="${file_path##*/}"
|
# filename="${file_path##*/}"
|
||||||
|
|
||||||
airtime_conf_path=/etc/airtime/airtime.conf
|
airtime_conf_path=/etc/airtime/airtime.conf
|
||||||
|
|
||||||
|
|
||||||
#instance_path will look like 1/1384, for example
|
#instance_path will look like 1/1384, for example
|
||||||
http_path=$(grep base_url ${airtime_conf_path} | awk '{print $3;}')
|
http_path=$(grep base_url ${airtime_conf_path} | awk '{print $3;}')
|
||||||
http_port=$(grep base_port ${airtime_conf_path} | awk '{print $3;}')
|
http_port=$(grep base_port ${airtime_conf_path} | awk '{print $3;}')
|
||||||
|
@ -31,14 +32,12 @@ post_file() {
|
||||||
url+=$http_port
|
url+=$http_port
|
||||||
url+=/rest/media
|
url+=/rest/media
|
||||||
|
|
||||||
|
|
||||||
api_key=$(grep api_key ${airtime_conf_path} | awk '{print $3;}')
|
api_key=$(grep api_key ${airtime_conf_path} | awk '{print $3;}')
|
||||||
|
|
||||||
# -f is needed to make curl fail if there's an HTTP error code
|
# -f is needed to make curl fail if there's an HTTP error code
|
||||||
# -L is needed to follow redirects! (just in case)
|
# -L is needed to follow redirects! (just in case)
|
||||||
until curl -fL --max-time 30 $url -u $api_key":" -X POST -F "file=@${file_path}"
|
until curl -fL --max-time 30 $url -u $api_key":" -X POST -F "file=@${file_path}"; do
|
||||||
do
|
retry_count=$((retry_count + 1))
|
||||||
retry_count=$[$retry_count+1]
|
|
||||||
if [ $retry_count -ge $max_retry ]; then
|
if [ $retry_count -ge $max_retry ]; then
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -8,9 +8,8 @@ post_file() {
|
||||||
max_retry=10
|
max_retry=10
|
||||||
retry_count=0
|
retry_count=0
|
||||||
|
|
||||||
until curl --max-time 30 http://localhost/rest/media -u 3188BDIMPJROQP89Z0OX: -X POST -F "file=@${file_path}" -F "name=${filename}"
|
until curl --max-time 30 http://localhost/rest/media -u 3188BDIMPJROQP89Z0OX: -X POST -F "file=@${file_path}" -F "name=${filename}"; do
|
||||||
do
|
retry_count=$((retry_count + 1))
|
||||||
retry_count=$[$retry_count+1]
|
|
||||||
if [ $retry_count -ge $max_retry ]; then
|
if [ $retry_count -ge $max_retry ]; then
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/bin/bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
### BEGIN INIT INFO
|
### BEGIN INIT INFO
|
||||||
# Provides: airtime-liquidsoap
|
# Provides: airtime-liquidsoap
|
||||||
|
@ -20,6 +20,7 @@ PIDFILE=/var/run/$NAME.pid
|
||||||
[ -x "$DAEMON" ] || exit 0
|
[ -x "$DAEMON" ] || exit 0
|
||||||
|
|
||||||
# Read configuration variable file if it is present
|
# Read configuration variable file if it is present
|
||||||
|
# shellcheck disable=SC1090
|
||||||
[ -r /etc/default/$NAME ] && . /etc/default/$NAME
|
[ -r /etc/default/$NAME ] && . /etc/default/$NAME
|
||||||
|
|
||||||
# Load the VERBOSE setting and other rcS variables
|
# Load the VERBOSE setting and other rcS variables
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/bin/bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
### BEGIN INIT INFO
|
### BEGIN INIT INFO
|
||||||
# Provides: airtime-playout
|
# Provides: airtime-playout
|
||||||
|
@ -20,6 +20,7 @@ PIDFILE=/var/run/$NAME.pid
|
||||||
[ -x "$DAEMON" ] || exit 0
|
[ -x "$DAEMON" ] || exit 0
|
||||||
|
|
||||||
# Read configuration variable file if it is present
|
# Read configuration variable file if it is present
|
||||||
|
# shellcheck disable=SC1090
|
||||||
[ -r /etc/default/$NAME ] && . /etc/default/$NAME
|
[ -r /etc/default/$NAME ] && . /etc/default/$NAME
|
||||||
|
|
||||||
# Load the VERBOSE setting and other rcS variables
|
# Load the VERBOSE setting and other rcS variables
|
||||||
|
|
47
uninstall
47
uninstall
|
@ -1,6 +1,6 @@
|
||||||
#!/bin/bash -e
|
#!/usr/bin/env bash
|
||||||
# -e Causes bash script to exit if any of the steps
|
|
||||||
# return with a non-zero return value.
|
set -e # Exit if any of the steps fails.
|
||||||
|
|
||||||
if [[ $EUID -ne 0 ]]; then
|
if [[ $EUID -ne 0 ]]; then
|
||||||
echo "Please run as root user."
|
echo "Please run as root user."
|
||||||
|
@ -8,27 +8,13 @@ if [[ $EUID -ne 0 ]]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
getStorDirFromDatabase() {
|
getStorDirFromDatabase() {
|
||||||
# here-doc to execute this block as postgres user
|
sudo -u postgres psql -d airtime -tAc "SELECT directory FROM cc_music_dirs WHERE type='stor'"
|
||||||
result=`su postgres <<'EOF'
|
|
||||||
set +e
|
|
||||||
echo $(psql -d airtime -tAc "SELECT directory FROM cc_music_dirs WHERE type='stor'")
|
|
||||||
set -e
|
|
||||||
# don't indent this!
|
|
||||||
EOF`
|
|
||||||
echo $result
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dropLibreTimeDatabase() {
|
dropLibreTimeDatabase() {
|
||||||
# here-doc to execute this block as postgres user
|
sudo -u postgres psql -d postgres -tAc "DROP DATABASE IF EXISTS airtime_test"
|
||||||
su postgres <<'EOF'
|
sudo -u postgres psql -d postgres -tAc "DROP DATABASE IF EXISTS airtime"
|
||||||
set +e
|
sudo -u postgres psql -d postgres -tAc "DROP USER IF EXISTS airtime"
|
||||||
# DROP DATABASE cannot be executed from a function or multi-command string
|
|
||||||
psql -d postgres -tAc "DROP DATABASE IF EXISTS airtime_test"
|
|
||||||
psql -d postgres -tAc "DROP DATABASE IF EXISTS airtime"
|
|
||||||
psql -d postgres -tAc "DROP USER IF EXISTS airtime"
|
|
||||||
set -e
|
|
||||||
# don't indent this!
|
|
||||||
EOF
|
|
||||||
}
|
}
|
||||||
|
|
||||||
removeRabbitmqLibreTimeSettings() {
|
removeRabbitmqLibreTimeSettings() {
|
||||||
|
@ -44,9 +30,6 @@ removeRabbitmqLibreTimeSettings() {
|
||||||
rabbitmqctl delete_user ${RMQ_USER}
|
rabbitmqctl delete_user ${RMQ_USER}
|
||||||
}
|
}
|
||||||
|
|
||||||
SCRIPT_DIR="$( cd "$( dirname "$0" )" && pwd )"
|
|
||||||
AIRTIMEROOT=${SCRIPT_DIR}
|
|
||||||
|
|
||||||
STOR_DIR=$(getStorDirFromDatabase)
|
STOR_DIR=$(getStorDirFromDatabase)
|
||||||
|
|
||||||
FILES=(
|
FILES=(
|
||||||
|
@ -64,7 +47,7 @@ FILES=(
|
||||||
|
|
||||||
echo -e "The following files, directories, and services will be removed:\n"
|
echo -e "The following files, directories, and services will be removed:\n"
|
||||||
for i in ${FILES[*]}; do
|
for i in ${FILES[*]}; do
|
||||||
echo $i
|
echo "$i"
|
||||||
done
|
done
|
||||||
echo "pip3 airtime-playout"
|
echo "pip3 airtime-playout"
|
||||||
|
|
||||||
|
@ -72,15 +55,15 @@ echo -e "\nIf your web root is not listed, you will need to manually remove it."
|
||||||
|
|
||||||
echo -e "\nThis will *permanently* remove LibreTime and all related files from your computer. \
|
echo -e "\nThis will *permanently* remove LibreTime and all related files from your computer. \
|
||||||
Any files in LibreTime directories and subdirectories will be deleted. Are you sure you want to proceed? [y/N]: \c"
|
Any files in LibreTime directories and subdirectories will be deleted. Are you sure you want to proceed? [y/N]: \c"
|
||||||
read IN
|
read -r IN
|
||||||
if [[ ! ( "$IN" = "y" || "$IN" = "Y" ) ]]; then
|
if [[ ! ($IN == "y" || $IN == "Y") ]]; then
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "${STOR_DIR}" ]; then
|
if [ -n "${STOR_DIR}" ]; then
|
||||||
echo -e "\nDo you want to remove your music storage directory ${STOR_DIR} and all of its subdirectories? [y/N]: \c"
|
echo -e "\nDo you want to remove your music storage directory ${STOR_DIR} and all of its subdirectories? [y/N]: \c"
|
||||||
read IN
|
read -r IN
|
||||||
if [[ ( "$IN" = "y" || "$IN" = "Y" ) ]]; then
|
if [[ $IN == "y" || $IN == "Y" ]]; then
|
||||||
rm -rf "${STOR_DIR}"
|
rm -rf "${STOR_DIR}"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
|
@ -94,12 +77,12 @@ removeRabbitmqLibreTimeSettings
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
for i in ${FILES[*]}; do
|
for i in ${FILES[*]}; do
|
||||||
rm -rf $i
|
rm -rf "$i"
|
||||||
done
|
done
|
||||||
|
|
||||||
echo -e "\nDo you want to drop your current LibreTime database? [y/N]: \c"
|
echo -e "\nDo you want to drop your current LibreTime database? [y/N]: \c"
|
||||||
read IN
|
read -r IN
|
||||||
if [[ "$IN" = "y" || "$IN" = "Y" ]]; then
|
if [[ $IN == "y" || $IN == "Y" ]]; then
|
||||||
echo -e "\nDropping LibreTime database..."
|
echo -e "\nDropping LibreTime database..."
|
||||||
dropLibreTimeDatabase
|
dropLibreTimeDatabase
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/bash
|
#!/usr/bin/env bash
|
||||||
# Absolute path to this script
|
# Absolute path to this script
|
||||||
SCRIPT=`readlink -f $0`
|
SCRIPT=$(readlink -f $0)
|
||||||
# Absolute directory this script is in
|
# Absolute directory this script is in
|
||||||
SCRIPTPATH=`dirname $SCRIPT`
|
SCRIPTPATH=$(dirname $SCRIPT)
|
||||||
|
|
||||||
php -q $SCRIPTPATH/airtime-log.php "$@" || exit 1
|
php -q $SCRIPTPATH/airtime-log.php "$@" || exit 1
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/bin/bash
|
#!/usr/bin/env bash
|
||||||
#-------------------------------------------------------------------------------
|
#-------------------------------------------------------------------------------
|
||||||
# Copyright (c) 2011 Sourcefabric O.P.S.
|
# Copyright (c) 2011 Sourcefabric O.P.S.
|
||||||
#
|
#
|
||||||
|
@ -24,10 +24,10 @@
|
||||||
# This script send data to data collection server
|
# This script send data to data collection server
|
||||||
#
|
#
|
||||||
# Absolute path to this script
|
# Absolute path to this script
|
||||||
SCRIPT=`readlink -f $0`
|
SCRIPT=$(readlink -f $0)
|
||||||
# Absolute directory this script is in
|
# Absolute directory this script is in
|
||||||
SCRIPTPATH=`dirname $SCRIPT`
|
SCRIPTPATH=$(dirname $SCRIPT)
|
||||||
|
|
||||||
cd $SCRIPTPATH
|
cd $SCRIPTPATH || exit 1
|
||||||
|
|
||||||
python airtime-test-soundcard.py "$@" || exit 1
|
python airtime-test-soundcard.py "$@" || exit 1
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/bin/bash
|
#!/usr/bin/env bash
|
||||||
#-------------------------------------------------------------------------------
|
#-------------------------------------------------------------------------------
|
||||||
# Copyright (c) 2011 Sourcefabric O.P.S.
|
# Copyright (c) 2011 Sourcefabric O.P.S.
|
||||||
#
|
#
|
||||||
|
@ -24,10 +24,10 @@
|
||||||
# This script send data to data collection server
|
# This script send data to data collection server
|
||||||
#
|
#
|
||||||
# Absolute path to this script
|
# Absolute path to this script
|
||||||
SCRIPT=`readlink -f $0`
|
SCRIPT=$(readlink -f $0)
|
||||||
# Absolute directory this script is in
|
# Absolute directory this script is in
|
||||||
SCRIPTPATH=`dirname $SCRIPT`
|
SCRIPTPATH=$(dirname $SCRIPT)
|
||||||
|
|
||||||
cd $SCRIPTPATH
|
cd $SCRIPTPATH || exit 1
|
||||||
|
|
||||||
python airtime-test-stream.py "$@" || exit 1
|
python airtime-test-stream.py "$@" || exit 1
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
#!/bin/bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
if [ -z "$1" ]
|
if [ -z "$1" ]; then
|
||||||
then
|
|
||||||
## Use config
|
## Use config
|
||||||
backup_folder=~/libretime_backup/
|
backup_folder=~/libretime_backup/
|
||||||
else
|
else
|
||||||
|
@ -9,38 +8,37 @@ if [ -z "$1" ]
|
||||||
backup_folder=$1
|
backup_folder=$1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
airtime_conf_path=/etc/airtime/airtime.conf
|
airtime_conf_path=/etc/airtime/airtime.conf
|
||||||
uploads_folder=/srv/airtime/stor/
|
uploads_folder=/srv/airtime/stor/
|
||||||
|
|
||||||
psdl_db=$(grep dbname ${airtime_conf_path} | awk '{print $3;}' )
|
psql_db=$(grep dbname ${airtime_conf_path} | awk '{print $3;}')
|
||||||
psql_user=$(grep dbuser ${airtime_conf_path} | awk '{print $3;}')
|
psql_user=$(grep dbuser ${airtime_conf_path} | awk '{print $3;}')
|
||||||
psql_password=$(grep dbpass ${airtime_conf_path} | awk '{print $3;}')
|
psql_password=$(grep dbpass ${airtime_conf_path} | awk '{print $3;}')
|
||||||
|
|
||||||
## Remove old backup
|
## Remove old backup
|
||||||
rm -rf $backup_folder
|
rm -rf "$backup_folder"
|
||||||
mkdir $backup_folder
|
mkdir "$backup_folder"
|
||||||
|
|
||||||
## Backup of database
|
## Backup of database
|
||||||
|
|
||||||
echo 'db: Getting database...'
|
echo "db: Getting database..."
|
||||||
pg_dump --dbname='postgresql://'$psql_user':'$psql_password'@localhost/'$psql_db > $backup_folder'database'
|
pg_dump --dbname="postgresql://$psql_user:$psql_password@localhost/$psql_db" > "${backup_folder}database"
|
||||||
echo 'db: Complete'
|
echo "db: Complete"
|
||||||
|
|
||||||
## Backup of sounds
|
## Backup of sounds
|
||||||
|
|
||||||
mkdir $backup_folder'uploads/'
|
mkdir "${backup_folder}uploads/"
|
||||||
|
|
||||||
echo 'stor : Copying uploaded files...'
|
echo "stor : Copying uploaded files..."
|
||||||
rsync -r -a --info=progress2 $uploads_folder $backup_folder'uploads/'
|
rsync -r -a --info=progress2 $uploads_folder "${backup_folder}uploads/"
|
||||||
echo 'stor: Complete'
|
echo "stor: Complete"
|
||||||
|
|
||||||
## Backup of libretime config
|
## Backup of libretime config
|
||||||
|
|
||||||
mkdir $backup_folder'airtime_config/'
|
mkdir "${backup_folder}airtime_config/"
|
||||||
|
|
||||||
echo 'config: Copying config...'
|
echo "config: Copying config..."
|
||||||
rsync -r -a --info=progress2 /etc/airtime/ $backup_folder'airtime_config/'
|
rsync -r -a --info=progress2 /etc/airtime/ "${backup_folder}airtime_config/"
|
||||||
echo 'config: Complete'
|
echo "config: Complete"
|
||||||
|
|
||||||
date >> $backup_folder'datelog.txt'
|
date >> "${backup_folder}datelog.txt"
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
#!/bin/bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
/etc/init.d/rabbitmq-server status | grep "\[{pid"
|
/etc/init.d/rabbitmq-server status | grep "\[{pid"
|
||||||
pid_found="$?"
|
pid_found="$?"
|
||||||
|
|
||||||
if [ "$pid_found" == "0" ]; then
|
if [ "$pid_found" == "0" ]; then
|
||||||
#PID is available in the status message
|
#PID is available in the status message
|
||||||
rabbitmqpid=`/etc/init.d/rabbitmq-server status | grep "\[{pid" | sed "s/.*,\(.*\)\}.*/\1/"`
|
rabbitmqpid=$(/etc/init.d/rabbitmq-server status | grep "\[{pid" | sed "s/.*,\(.*\)\}.*/\1/")
|
||||||
else
|
else
|
||||||
#PID should be available from file
|
#PID should be available from file
|
||||||
rabbitmqpid=`sed "s/.*,\(.*\)\}.*/\1/" /var/lib/rabbitmq/pids`
|
rabbitmqpid=$(sed "s/.*,\(.*\)\}.*/\1/" /var/lib/rabbitmq/pids)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "RabbitMQ PID: $rabbitmqpid"
|
echo "RabbitMQ PID: $rabbitmqpid"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/bin/bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
# A bash script to convert all Rivendell's audio-library to MP3, extract meta-tags from Rivendell's
|
# A bash script to convert all Rivendell's audio-library to MP3, extract meta-tags from Rivendell's
|
||||||
# database and set appropriate tags to each MP3 file.
|
# database and set appropriate tags to each MP3 file.
|
||||||
|
@ -7,7 +7,6 @@
|
||||||
# 1 - Rivendell store files in .wav format, airtime uses .mp3 format
|
# 1 - Rivendell store files in .wav format, airtime uses .mp3 format
|
||||||
# 2 - WAV does not have Meta-tag support so all meta-tags need to be fetched from Rivendell database.
|
# 2 - WAV does not have Meta-tag support so all meta-tags need to be fetched from Rivendell database.
|
||||||
|
|
||||||
|
|
||||||
if [ $# -ne 2 ]; then
|
if [ $# -ne 2 ]; then
|
||||||
echo "usage: $0 <rivendell_dir> <final_dir>"
|
echo "usage: $0 <rivendell_dir> <final_dir>"
|
||||||
exit
|
exit
|
||||||
|
@ -22,23 +21,21 @@ db="Rivendell" #Edit this only if you changed Rivendell's database name :-)
|
||||||
rivendell_dir=$1
|
rivendell_dir=$1
|
||||||
end_dir=$2
|
end_dir=$2
|
||||||
|
|
||||||
cd "$rivendell_dir"
|
cd "$rivendell_dir" || (echo "could not cd in $rivendell_dir" && exit 1)
|
||||||
|
|
||||||
for file in *
|
for file in *; do
|
||||||
do
|
|
||||||
lame "$file"
|
lame "$file"
|
||||||
done
|
done
|
||||||
|
|
||||||
mv "$rivendell_dir"/*.mp3 "$end_dir"
|
mv "$rivendell_dir"/*.mp3 "$end_dir"
|
||||||
cd "$end_dir"
|
cd "$end_dir" || (echo "could not cd in $end_dir" && exit 1)
|
||||||
|
|
||||||
for file in *
|
for file in *; do
|
||||||
do
|
id=$(echo "$file" | head -c 10)
|
||||||
id=`echo $file | head -c 10`
|
title=$(mysql -u $user -p$pass -sN -e "SELECT CU.DESCRIPTION FROM CUTS CU, CART CA WHERE CA.NUMBER=CU.CART_NUMBER AND CU.CUT_NAME=\"${id}\"" $db)
|
||||||
title=`mysql -u $user -p$pass -sN -e "SELECT CU.DESCRIPTION FROM CUTS CU, CART CA WHERE CA.NUMBER=CU.CART_NUMBER AND CU.CUT_NAME=\"${id}\"" $db`
|
artist=$(mysql -u $user -p$pass -sN -e "SELECT CA.ARTIST FROM CUTS CU, CART CA WHERE CA.NUMBER=CU.CART_NUMBER AND CU.CUT_NAME=\"${id}\"" $db)
|
||||||
artist=`mysql -u $user -p$pass -sN -e "SELECT CA.ARTIST FROM CUTS CU, CART CA WHERE CA.NUMBER=CU.CART_NUMBER AND CU.CUT_NAME=\"${id}\"" $db`
|
album=$(mysql -u $user -p$pass -sN -e "SELECT CA.ALBUM FROM CUTS CU, CART CA WHERE CA.NUMBER=CU.CART_NUMBER AND CU.CUT_NAME=\"${id}\"" $db)
|
||||||
album=`mysql -u $user -p$pass -sN -e "SELECT CA.ALBUM FROM CUTS CU, CART CA WHERE CA.NUMBER=CU.CART_NUMBER AND CU.CUT_NAME=\"${id}\"" $db`
|
year=$(mysql -u $user -p$pass -sN -e "SELECT CA.YEAR FROM CUTS CU, CART CA WHERE CA.NUMBER=CU.CART_NUMBER AND CU.CUT_NAME=\"${id}\"" $db)
|
||||||
year=`mysql -u $user -p$pass -sN -e "SELECT CA.YEAR FROM CUTS CU, CART CA WHERE CA.NUMBER=CU.CART_NUMBER AND CU.CUT_NAME=\"${id}\"" $db`
|
|
||||||
id3 -t "$title" -a "$artist" -A "$album" -y "$year" $file
|
id3 -t "$title" -a "$artist" -A "$album" -y "$year" $file
|
||||||
mv "$file" "$artist-$title.mp3"
|
mv "$file" "$artist-$title.mp3"
|
||||||
done
|
done
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue