package.sh 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #!/usr/bin/env bash
  2. source ../common.build.sh
  3. ARCH="$( arch )"
  4. WORKDIR="$( pwd )"
  5. package_temporary_dir="${WORKDIR}/pkg-dist-tmp"
  6. output_dir="${WORKDIR}/pkg-dist"
  7. current_user="$( whoami )"
  8. image_name="jellyfin-ubuntu_arm64-build"
  9. # Determine if sudo should be used for Docker
  10. if [[ ! -z $(id -Gn | grep -q 'docker') ]] \
  11. && [[ ! ${EUID:-1000} -eq 0 ]] \
  12. && [[ ! ${USER} == "root" ]] \
  13. && [[ ! -z $( echo "${OSTYPE}" | grep -q "darwin" ) ]]; then
  14. docker_sudo="sudo"
  15. else
  16. docker_sudo=""
  17. fi
  18. # Determine which Dockerfile to use
  19. case $ARCH in
  20. 'x86_64')
  21. DOCKERFILE="Dockerfile.amd64"
  22. ;;
  23. 'armv7l')
  24. DOCKERFILE="Dockerfile.arm64"
  25. ;;
  26. esac
  27. # Prepare temporary package dir
  28. mkdir -p "${package_temporary_dir}"
  29. # Set up the build environment Docker image
  30. ${docker_sudo} docker build ../.. -t "${image_name}" -f ./${DOCKERFILE}
  31. # Build the DEBs and copy out to ${package_temporary_dir}
  32. ${docker_sudo} docker run --rm -v "${package_temporary_dir}:/dist" "${image_name}"
  33. # Move the DEBs to the output directory
  34. mkdir -p "${output_dir}"
  35. mv "${package_temporary_dir}"/deb/* "${output_dir}"