Fix shellcheck errors
This commit is contained in:
parent
b5f302ac61
commit
dc999f9006
|
@ -25,5 +25,5 @@ apt-get install -y gstreamer1.0-plugins-base \
|
|||
libcairo2-dev
|
||||
|
||||
# Making log directory for PHP tests
|
||||
mkdir -p $LIBRETIME_LOG_DIR
|
||||
chown runner:runner $LIBRETIME_LOG_DIR
|
||||
mkdir -p "$LIBRETIME_LOG_DIR"
|
||||
chown runner:runner "$LIBRETIME_LOG_DIR"
|
||||
|
|
|
@ -25,5 +25,5 @@ apt-get install -y gstreamer1.0-plugins-base \
|
|||
libcairo2-dev
|
||||
|
||||
# Making log directory for PHP tests
|
||||
mkdir -p $LIBRETIME_LOG_DIR
|
||||
chown runner:runner $LIBRETIME_LOG_DIR
|
||||
mkdir -p "$LIBRETIME_LOG_DIR"
|
||||
chown runner:runner "$LIBRETIME_LOG_DIR"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
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
|
||||
pip3 install -r "python_apps/$app/requirements-dev.txt"
|
||||
fi
|
||||
|
|
|
@ -14,7 +14,7 @@ if ! make -C python_apps/api_clients test; then
|
|||
fi
|
||||
echo "::endgroup::"
|
||||
|
||||
if [[ "$failed" = "true" ]]; then
|
||||
if [[ $failed == "true" ]]; then
|
||||
echo "Python tests failed"
|
||||
exit 1
|
||||
fi
|
||||
|
|
7
build.sh
7
build.sh
|
@ -1,4 +1,7 @@
|
|||
#!/usr/bin/env bash -e
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e # Exit if any of the steps fails.
|
||||
|
||||
composer install --no-dev --no-interaction
|
||||
|
||||
git_build=""
|
||||
|
@ -14,7 +17,7 @@ if [ "${git_build}" = "y" ]; then
|
|||
git_version=$(git rev-parse --short HEAD)
|
||||
echo " * Overriding empty version with sha1 commit-ish: ${git_version}"
|
||||
fi
|
||||
echo ${git_version} > VERSION
|
||||
echo "${git_version}" > VERSION
|
||||
else
|
||||
# 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
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
#!/usr/bin/env bash -e
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
apt-get install -y --force-yes lsb-release sudo
|
||||
dist=$(lsb_release -is)
|
||||
code=$(lsb_release -cs)
|
||||
|
|
|
@ -105,12 +105,12 @@ while getopts b:c:u: arg; do
|
|||
b)
|
||||
if [ "$OPTARG" = "all" ]; then
|
||||
echo "Building all platforms on server..."
|
||||
for i in $(seq 0 $(($num - 1))); do
|
||||
for i in $(seq 0 $((num - 1))); do
|
||||
build_env ${os_versions[$i]} | tee ./liquidsoap-compile_logs/build_env_${os_versions[$i]}.log
|
||||
done
|
||||
else
|
||||
flag=1
|
||||
for i in $(seq 0 $(($num - 1))); do
|
||||
for i in $(seq 0 $((num - 1))); do
|
||||
if [ "$OPTARG" = ${os_versions[$i]} ]; then
|
||||
echo "Building platform: $OPTARG ..."
|
||||
build_env ${os_versions[$i]} | tee ./liquidsoap-compile_logs/build_env_${os_versions[$i]}.log
|
||||
|
@ -129,13 +129,13 @@ while getopts b:c:u: arg; do
|
|||
c)
|
||||
if [ "$OPTARG" = "all" ]; then
|
||||
echo "Compiling liquidsoap for all platforms on server..."
|
||||
for i in $(seq 0 $(($num - 1))); do
|
||||
for i in $(seq 0 $((num - 1))); do
|
||||
compile_liq ${os_versions[$i]} | tee ./liquidsoap-compile_logs/compile_liq_${os_versions[$i]}.log
|
||||
done
|
||||
|
||||
else
|
||||
flag=1
|
||||
for i in $(seq 0 $(($num - 1))); do
|
||||
for i in $(seq 0 $((num - 1))); do
|
||||
if [ "$OPTARG" = ${os_versions[$i]} ]; then
|
||||
echo "Compiling liquidsoap for platform: $OPTARG ..."
|
||||
compile_liq ${os_versions[$i]} | tee ./liquidsoap-compile_logs/compile_liq_${os_versions[$i]}.log
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
#!/usr/bin/env bash -e
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
# Absolute path to this script
|
||||
SCRIPT=$(readlink -f $0)
|
||||
# Absolute directory this script is in
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
#!/usr/bin/env bash -e
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
#release.sh 1.8.2
|
||||
#creates a libretime folder with a "1.8.2" suffix
|
||||
|
|
109
install
109
install
|
@ -1,7 +1,6 @@
|
|||
#!/usr/bin/env bash -e
|
||||
#!/usr/bin/env bash
|
||||
|
||||
#-e Causes bash script to exit if any of the installers
|
||||
#return with a non-zero return value.
|
||||
set -e # Exit if any of the steps fails.
|
||||
|
||||
if [[ $EUID -ne 0 ]]; then
|
||||
echo "Please run as root user."
|
||||
|
@ -111,16 +110,16 @@ function loud() {
|
|||
function loudCmd() {
|
||||
if [[ ${_q} -eq 0 ]]; then
|
||||
verbose "$@"
|
||||
eval $@
|
||||
eval "$@"
|
||||
else
|
||||
eval $@ > /dev/null
|
||||
eval "$@" > /dev/null
|
||||
fi
|
||||
}
|
||||
|
||||
function checkCommandExists() {
|
||||
set +e
|
||||
command=$@
|
||||
eval hash ${command} 2> /dev/null
|
||||
command="$1"
|
||||
eval hash "${command}" 2> /dev/null
|
||||
commandFound=$?
|
||||
if [[ ! ${commandFound} -eq 0 ]]; then
|
||||
echo -e "Error: ${command} not found. Please ensure you have the corresponding dependency installed."
|
||||
|
@ -150,8 +149,8 @@ function systemInitDetect() {
|
|||
# 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
|
||||
# PID 1 executable alone
|
||||
pid_1_package=$(dpkg -S $pid_1_path 2> /dev/null ||
|
||||
rpm --qf '%{name}\n' -qf $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 ||
|
||||
echo "unknown")
|
||||
verbose "Detected package name for PID=1 process: $pid_1_package"
|
||||
case "${pid_1_package}:${pid_1_path}" in
|
||||
|
@ -185,6 +184,7 @@ function systemInitDetect() {
|
|||
function systemInitInstall() {
|
||||
local service_name="$1"
|
||||
local user="$2"
|
||||
# shellcheck disable=SC2034
|
||||
local source_base_path=""
|
||||
local source_path=""
|
||||
local target_path=""
|
||||
|
@ -198,26 +198,26 @@ function systemInitInstall() {
|
|||
libretime-analyzer)
|
||||
source_path="${python_source_path}/airtime_analyzer/install/systemd/${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)
|
||||
source_path="${python_source_path}/airtime-celery/install/systemd/${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)
|
||||
source_path="${python_source_path}/pypo/install/systemd/${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)
|
||||
source_path="${SCRIPT_DIR-$PWD}/api/install/systemd/${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
|
||||
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
|
||||
fi
|
||||
# Stop and disable the service if it already exists
|
||||
|
@ -229,7 +229,8 @@ function systemInitInstall() {
|
|||
local old_style_unit_exists="f"
|
||||
# Migrate old style airtime unit exist if it exists
|
||||
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."
|
||||
loudCmd "systemctl disable ${old_service}.service"
|
||||
loudCmd "systemctl stop ${old_service}.service"
|
||||
|
@ -241,15 +242,15 @@ function systemInitInstall() {
|
|||
loudCmd "cp $source_path $target_path"
|
||||
else
|
||||
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
|
||||
if [[ $old_style_unit_exists == "t" ]]; then
|
||||
verbose "Maintaining compatibility with old systemd unit names"
|
||||
# Alias to old Airtime names
|
||||
loudCmd "ln -s $source_path $alt_path"
|
||||
fi
|
||||
chmod 0644 $target_path
|
||||
chown root:root $target_path
|
||||
chmod 0644 "$target_path"
|
||||
chown root:root "$target_path"
|
||||
verbose "Service ${service_name} installed into ${target_path}"
|
||||
# Enable and start the service
|
||||
loudCmd "systemctl enable ${service_name}.service"
|
||||
|
@ -273,7 +274,7 @@ function systemInitInstall() {
|
|||
;;
|
||||
esac
|
||||
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
|
||||
fi
|
||||
# Stop the service if it already exists
|
||||
|
@ -286,10 +287,10 @@ function systemInitInstall() {
|
|||
loudCmd "cp $source_path $target_path"
|
||||
else
|
||||
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
|
||||
chmod 0644 $target_path
|
||||
chown root:root $target_path
|
||||
chmod 0644 "$target_path"
|
||||
chown root:root "$target_path"
|
||||
verbose "Service ${service_name} installed into ${target_path}"
|
||||
loudCmd "initctl check-config $service_name"
|
||||
elif $has_systemv_init; then
|
||||
|
@ -313,7 +314,7 @@ function systemInitInstall() {
|
|||
;;
|
||||
esac
|
||||
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
|
||||
fi
|
||||
# Stop the service if it already exists
|
||||
|
@ -328,13 +329,13 @@ function systemInitInstall() {
|
|||
loudCmd "cp $source_config_path $target_config_path"
|
||||
else
|
||||
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
|
||||
chmod 0644 $target_path
|
||||
chown root:root $target_path
|
||||
chmod 0644 "$target_path"
|
||||
chown root:root "$target_path"
|
||||
if [[ -n $target_config_path ]]; then
|
||||
chmod 0644 $target_config_path
|
||||
chown root:root $target_config_path
|
||||
chmod 0644 "$target_config_path"
|
||||
chown root:root "$target_config_path"
|
||||
fi
|
||||
verbose "Service ${service_name} installed into ${target_path}"
|
||||
# Create symlinks for the appropriate runlevels
|
||||
|
@ -356,13 +357,13 @@ function systemInitCommand() {
|
|||
case "$command" in
|
||||
start | stop | status | reload | restart)
|
||||
if $has_systemd_init; then
|
||||
loudCmd "systemctl $command $@"
|
||||
loudCmd "systemctl $command $*"
|
||||
elif $has_upstart_init; then
|
||||
for svc_name in $@; do
|
||||
for svc_name in "$@"; do
|
||||
loudCmd "service $svc_name $command"
|
||||
done
|
||||
elif $has_systemv_init; then
|
||||
for svc_name in $@; do
|
||||
for svc_name in "$@"; do
|
||||
loudCmd "invoke-rc.d $svc_name $command"
|
||||
done
|
||||
fi
|
||||
|
@ -371,7 +372,7 @@ function systemInitCommand() {
|
|||
$has_systemd_init &&
|
||||
loudCmd "systemctl $command $1.service"
|
||||
if $has_systemv_init; then
|
||||
if [[ "$command" = "enable" ]]; then
|
||||
if [[ "$command" == "enable" ]]; then
|
||||
loudCmd "update-rc.d $1 defaults"
|
||||
else
|
||||
loudCmd "update-rc.d $1 enable"
|
||||
|
@ -385,7 +386,7 @@ function systemInitCommand() {
|
|||
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
|
||||
;;
|
||||
esac
|
||||
|
@ -477,7 +478,7 @@ while :; do
|
|||
;;
|
||||
--web-root)
|
||||
if [ "$2" ]; then
|
||||
web_root=$(readlink -f $2)
|
||||
web_root=$(readlink -f "$2")
|
||||
shift 2
|
||||
continue
|
||||
else
|
||||
|
@ -568,7 +569,7 @@ while :; do
|
|||
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."
|
||||
exit 1
|
||||
;;
|
||||
|
@ -582,7 +583,7 @@ while :; do
|
|||
shift
|
||||
done
|
||||
|
||||
if [ -z web_root -a ! -d web_root ]; then
|
||||
if [[ -z $web_root || ! -d $web_root ]]; then
|
||||
echo "$web_root doesn't exist!"
|
||||
exit 1
|
||||
fi
|
||||
|
@ -596,6 +597,7 @@ echo -e " \/ \/ \/ \/ \/\n"
|
|||
echo -e "Detecting distribution and release ..."
|
||||
if [ -e /etc/os-release ]; then
|
||||
# Access $ID, $VERSION_ID and $PRETTY_NAME
|
||||
# shellcheck disable=SC1091
|
||||
source /etc/os-release
|
||||
echo "Detected distribution id: $ID"
|
||||
echo "Detected distribution release id: $VERSION_ID"
|
||||
|
@ -605,7 +607,7 @@ else
|
|||
VERSION_ID=unknown
|
||||
PRETTY_NAME="Unknown distribution and release"
|
||||
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 "This is an unsupported distribution and/or version!" >&2
|
||||
exit 1
|
||||
|
@ -646,6 +648,7 @@ is_debian_buster=false
|
|||
is_ubuntu_dist=false
|
||||
is_ubuntu_bionic=false
|
||||
is_centos_dist=false
|
||||
# shellcheck disable=SC2034
|
||||
is_centos_7=false
|
||||
is_centos_8=false
|
||||
# Use specified distribution and release or detected otherwise.
|
||||
|
@ -685,6 +688,7 @@ case "${dist}-${code}" in
|
|||
raspbian-10 | 10)
|
||||
code="buster"
|
||||
dist="debian"
|
||||
# shellcheck disable=SC2034
|
||||
is_debian_dist=true
|
||||
is_debian_buster=true
|
||||
;;
|
||||
|
@ -697,6 +701,7 @@ case "${dist}-${code}" in
|
|||
;;
|
||||
centos-8)
|
||||
is_centos_dist=true
|
||||
# shellcheck disable=SC2034
|
||||
is_centos_8=true
|
||||
;;
|
||||
*)
|
||||
|
@ -926,9 +931,9 @@ fi
|
|||
|
||||
if [ "$icecast" = "f" -a ${_i} -eq 1 ]; then
|
||||
echo -e "Install default Airtime Icecast configuration? (Y/n): \c"
|
||||
read IN
|
||||
read -r IN
|
||||
IN=${IN:-$default_value}
|
||||
if [ "$IN" = "y" -o "$IN" = "Y" ]; then
|
||||
if [[ $IN == "y" || $IN == "Y" ]]; then
|
||||
icecast="t"
|
||||
fi
|
||||
fi
|
||||
|
@ -947,15 +952,15 @@ if [ "$icecast" = "t" ]; then
|
|||
icecast_unit_name="icecast"
|
||||
icecast_config="/etc/icecast.xml"
|
||||
fi
|
||||
systemInitCommand enable ${icecast_unit_name}
|
||||
systemInitCommand enable "${icecast_unit_name}"
|
||||
# only update icecast password if
|
||||
if [ ! -e "/etc/airtime/airtime.conf" ] && [ ! -e "/etc/airtime/airtime.conf.tmp" ]; then
|
||||
icecast_pass=$(tr -dc _A-Z-a-z-0-9 < /dev/urandom | head -c${1:-12})
|
||||
echo $icecast_pass > /tmp/icecast_pass
|
||||
icecast_pass=$(tr -dc _A-Z-a-z-0-9 < /dev/urandom | head -c"${1:-12}")
|
||||
echo "$icecast_pass" > /tmp/icecast_pass
|
||||
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/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/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/admin-password -v "$icecast_pass" "$icecast_config"
|
||||
fi
|
||||
# restart in case icecast was already started (like is the case on debian)
|
||||
systemInitCommand restart ${icecast_unit_name}
|
||||
|
@ -979,7 +984,7 @@ verbose "...Done"
|
|||
verbose "\n * Creating /run/airtime..."
|
||||
mkdir -p /run/airtime
|
||||
chmod 755 /run/airtime
|
||||
chown -R ${web_user}:${web_user} /run/airtime
|
||||
chown -R "${web_user}:${web_user}" /run/airtime
|
||||
verbose "...Done"
|
||||
|
||||
if [ ! -d /var/log/airtime ]; then
|
||||
|
@ -1003,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 "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/"
|
||||
systemInitInstall libretime-liquidsoap $web_user
|
||||
systemInitInstall libretime-playout $web_user
|
||||
systemInitInstall libretime-liquidsoap "$web_user"
|
||||
systemInitInstall libretime-playout "$web_user"
|
||||
verbose "...Done"
|
||||
|
||||
verbose "\n * Installing airtime-celery..."
|
||||
|
@ -1025,16 +1030,16 @@ verbose "...Done"
|
|||
|
||||
verbose "\n * Installing libretime-analyzer..."
|
||||
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 "\n * Installing API..."
|
||||
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
|
||||
sed -e "s@WEB_USER@${web_user}@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"
|
||||
verbose "...Done"
|
||||
|
||||
|
@ -1058,7 +1063,7 @@ php_conf_dirs=(
|
|||
"/etc/php5/apache2/conf.d" # Debian Stretch, Debian Jessie, Ubuntu Trusty
|
||||
"/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
|
||||
done
|
||||
if [[ -d $php_conf ]]; then
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
#!/usr/bin/env bash -e
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
#-e Causes bash script to exit if any of the installers
|
||||
#return with a non-zero return value.
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
|
||||
echo "Installing Ruby"
|
||||
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"
|
||||
|
||||
cd docs
|
||||
cd docs || (echo "Could not cd in docs" && exit 1)
|
||||
gem install jekyll bundler
|
||||
|
||||
# Running Jekyll
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
#!/usr/bin/env bash -xv
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -xv
|
||||
|
||||
post_file() {
|
||||
#kill process after 30 minutes (360*5=30 minutes)
|
||||
|
@ -35,7 +37,7 @@ post_file() {
|
|||
# -f is needed to make curl fail if there's an HTTP error code
|
||||
# -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}"; do
|
||||
retry_count=$(($retry_count + 1))
|
||||
retry_count=$((retry_count + 1))
|
||||
if [ $retry_count -ge $max_retry ]; then
|
||||
break
|
||||
fi
|
||||
|
|
|
@ -9,7 +9,7 @@ post_file() {
|
|||
retry_count=0
|
||||
|
||||
until curl --max-time 30 http://localhost/rest/media -u 3188BDIMPJROQP89Z0OX: -X POST -F "file=@${file_path}" -F "name=${filename}"; do
|
||||
retry_count=$(($retry_count + 1))
|
||||
retry_count=$((retry_count + 1))
|
||||
if [ $retry_count -ge $max_retry ]; then
|
||||
break
|
||||
fi
|
||||
|
|
40
uninstall
40
uninstall
|
@ -1,6 +1,6 @@
|
|||
#!/usr/bin/env bash -e
|
||||
# -e Causes bash script to exit if any of the steps
|
||||
# return with a non-zero return value.
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e # Exit if any of the steps fails.
|
||||
|
||||
if [[ $EUID -ne 0 ]]; then
|
||||
echo "Please run as root user."
|
||||
|
@ -8,20 +8,13 @@ if [[ $EUID -ne 0 ]]; then
|
|||
fi
|
||||
|
||||
getStorDirFromDatabase() {
|
||||
echo $(sudo -u postgres psql -d airtime -tAc "SELECT directory FROM cc_music_dirs WHERE type='stor'")
|
||||
sudo -u postgres psql -d airtime -tAc "SELECT directory FROM cc_music_dirs WHERE type='stor'"
|
||||
}
|
||||
|
||||
dropLibreTimeDatabase() {
|
||||
# here-doc to execute this block as postgres user
|
||||
su postgres << 'EOF'
|
||||
set +e
|
||||
# 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
|
||||
sudo -u postgres psql -d postgres -tAc "DROP DATABASE IF EXISTS airtime_test"
|
||||
sudo -u postgres psql -d postgres -tAc "DROP DATABASE IF EXISTS airtime"
|
||||
sudo -u postgres psql -d postgres -tAc "DROP USER IF EXISTS airtime"
|
||||
}
|
||||
|
||||
removeRabbitmqLibreTimeSettings() {
|
||||
|
@ -37,9 +30,6 @@ removeRabbitmqLibreTimeSettings() {
|
|||
rabbitmqctl delete_user ${RMQ_USER}
|
||||
}
|
||||
|
||||
SCRIPT_DIR="$( cd "$( dirname "$0")" && pwd)"
|
||||
AIRTIMEROOT=${SCRIPT_DIR}
|
||||
|
||||
STOR_DIR=$(getStorDirFromDatabase)
|
||||
|
||||
FILES=(
|
||||
|
@ -57,7 +47,7 @@ FILES=(
|
|||
|
||||
echo -e "The following files, directories, and services will be removed:\n"
|
||||
for i in ${FILES[*]}; do
|
||||
echo $i
|
||||
echo "$i"
|
||||
done
|
||||
echo "pip3 airtime-playout"
|
||||
|
||||
|
@ -65,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. \
|
||||
Any files in LibreTime directories and subdirectories will be deleted. Are you sure you want to proceed? [y/N]: \c"
|
||||
read IN
|
||||
if [[ ! ("$IN" = "y" || "$IN" = "Y") ]]; then
|
||||
read -r IN
|
||||
if [[ ! ($IN == "y" || $IN == "Y") ]]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
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"
|
||||
read IN
|
||||
if [[ ("$IN" = "y" || "$IN" = "Y") ]]; then
|
||||
read -r IN
|
||||
if [[ $IN == "y" || $IN == "Y" ]]; then
|
||||
rm -rf "${STOR_DIR}"
|
||||
fi
|
||||
else
|
||||
|
@ -87,12 +77,12 @@ removeRabbitmqLibreTimeSettings
|
|||
set -e
|
||||
|
||||
for i in ${FILES[*]}; do
|
||||
rm -rf $i
|
||||
rm -rf "$i"
|
||||
done
|
||||
|
||||
echo -e "\nDo you want to drop your current LibreTime database? [y/N]: \c"
|
||||
read IN
|
||||
if [[ "$IN" = "y" || "$IN" = "Y" ]]; then
|
||||
read -r IN
|
||||
if [[ $IN == "y" || $IN == "Y" ]]; then
|
||||
echo -e "\nDropping LibreTime database..."
|
||||
dropLibreTimeDatabase
|
||||
fi
|
||||
|
|
Loading…
Reference in New Issue