2019-01-11 17:49:46 -07:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
source ../common.build.sh
|
|
|
|
|
2019-02-05 16:41:02 -07:00
|
|
|
keep_artifacts="${1}"
|
|
|
|
|
|
|
|
WORKDIR="$( pwd )"
|
|
|
|
VERSION="$( grep -A1 '^Version:' ${WORKDIR}/pkg-src/jellyfin.spec | awk '{ print $NF }' )"
|
|
|
|
|
|
|
|
package_temporary_dir="${WORKDIR}/pkg-dist-tmp"
|
|
|
|
package_source_dir="${WORKDIR}/pkg-src"
|
|
|
|
output_dir="${WORKDIR}/pkg-dist"
|
|
|
|
current_user="$( whoami )"
|
2019-02-08 18:44:41 -07:00
|
|
|
image_name="jellyfin-fedora-build"
|
2019-02-05 16:41:02 -07:00
|
|
|
|
|
|
|
rm -f "${package_source_dir}/jellyfin-${VERSION}.tar.gz" &>/dev/null \
|
|
|
|
|| sudo rm -f "${package_source_dir}/jellyfin-${VERSION}.tar.gz" &>/dev/null
|
2019-01-23 13:14:10 -07:00
|
|
|
|
2019-02-05 16:41:02 -07:00
|
|
|
rm -rf "${package_temporary_dir}" &>/dev/null \
|
|
|
|
|| sudo rm -rf "${package_temporary_dir}" &>/dev/null
|
|
|
|
|
|
|
|
rm -rf "${output_dir}" &>/dev/null \
|
|
|
|
|| sudo rm -rf "${output_dir}" &>/dev/null
|
|
|
|
|
|
|
|
if [[ ${keep_artifacts} == 'n' ]]; then
|
|
|
|
docker_sudo=""
|
|
|
|
if [[ ! -z $(id -Gn | grep -q 'docker') ]] \
|
|
|
|
&& [[ ! ${EUID:-1000} -eq 0 ]] \
|
|
|
|
&& [[ ! ${USER} == "root" ]] \
|
|
|
|
&& [[ ! -z $( echo "${OSTYPE}" | grep -q "darwin" ) ]]; then
|
|
|
|
docker_sudo=sudo
|
|
|
|
fi
|
|
|
|
${docker_sudo} docker image rm ${image_name} --force
|
|
|
|
fi
|