2019-01-10 11:45:21 -07:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
source ../common.build.sh
|
|
|
|
|
2019-02-05 16:40:50 -07:00
|
|
|
keep_artifacts="${1}"
|
2019-01-10 11:45:21 -07:00
|
|
|
|
2019-02-05 16:40:50 -07:00
|
|
|
WORKDIR="$( pwd )"
|
|
|
|
VERSION="$( grep '^jellyfin' ${WORKDIR}/pkg-src/changelog | head -1 | awk -F '[()]' '{ print $2 }' )"
|
|
|
|
|
|
|
|
package_temporary_dir="${WORKDIR}/pkg-dist-tmp"
|
|
|
|
output_dir="${WORKDIR}/pkg-dist"
|
|
|
|
current_user="$( whoami )"
|
|
|
|
image_name="jellyfin-debian-build"
|
|
|
|
|
|
|
|
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
|