extract.sh 656 Bytes
Newer Older
noplanman's avatar
noplanman committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
#!/usr/bin/env bash

# Usage: ./extract.sh <arch> [<binary_save_location>]

BORG_ARCH=${1:-aarch64}
BORG_BINARY=${2:-borg-${BORG_ARCH}}

#if [[ "$(docker images -q "borg:${BORG_ARCH}" 2> /dev/null)" == "" ]]; then
if ! docker inspect "borg:${BORG_ARCH}" >/dev/null 2>&1; then
    echo "Couldn't find the 'borg:${BORG_ARCH}' image!"
    echo "Create the image first, using './build.sh ${BORG_ARCH}'"
    exit 1
fi

#docker run -v "${PWD}":"/opt/mount" --rm --entrypoint \
#    cp "borg:${BORG_ARCH}" "/usr/bin/borg" "/opt/mount/${BORG_BINARY}"

docker run --rm --entrypoint cat "borg:${BORG_ARCH}" /usr/bin/borg > "${BORG_BINARY}"
chmod +x "${BORG_BINARY}"