diff --git a/build.sh b/build.sh index e6892a5..870b65e 100755 --- a/build.sh +++ b/build.sh @@ -51,28 +51,5 @@ READY_SUFFIX=".ready" mkdir -p "${INCOMING_DIR}" ./deploy.sh "${DIST_DIR}" "${INCOMING_DIR}" "${READY_SUFFIX}" -echo "Moving package(s) to the repo..." -mkdir -p "${MAIN_DIR}" -./movedebs.sh "${MAIN_DIR}" "${INCOMING_DIR}" "${READY_SUFFIX}" - -echo "Installing repository build dependencies (apt)..." -apt-get -qq -y --no-install-recommends install apt-utils > /dev/null - -echo "Updating the repo..." -REPO_PATH="repo" -TEMP_DIR="$(mktemp -d)" -./repo-update.sh "${REPO_PATH}" "${TEMP_DIR}" - -apt-get -qq -y --no-install-recommends install gpg gpg-agent - -echo "Checking if is possible to sign the repo..." -mkdir -p keys -chmod 600 keys -export GNUPGHOME="${PWD}/keys" - -./repo-sign.sh "${REPO_PATH}" - -echo "Committing changes..." -mv "${TEMP_DIR}"/* "${REPO_PATH}"/ - -#echo "deb file:/repo /" > /etc/apt/sources.list.d/custom-repo.list +echo "##### REPOSITORY STUFF #####" +./repo-main.sh "${MAIN_DIR}" "${INCOMING_DIR}" "${READY_SUFFIX}" diff --git a/repo-main.sh b/repo-main.sh new file mode 100755 index 0000000..f159cdc --- /dev/null +++ b/repo-main.sh @@ -0,0 +1,59 @@ +#!/bin/sh + +set -e + +if [ $# -eq 0 ]; then + echo "No arguments provided. Aborting..." + exit 1 +fi + +if [ "$1" = "-h" ] || [ "$1" = "--help" ]; then + echo "usage: ./repo-main.sh [-h] [MAIN_DIR INCOMING_DIR READY_SUFFIX] + +Wrapper script for the repository. + +Possible values for the arguments: + +MAIN_DIR path of the directory inside the repository where the packages will be storaged +INCOMING_DIR local path of the 'incoming' directory +READY_SUFFIX suffix used to flag a complete transfer of a file + +Dependencies: - +" + exit 0 +fi + +if [ $# -lt 3 ]; then + echo "Mandatory arguments: 'MAIN_DIR', 'INCOMING_DIR', 'INCOMING_DIR'. Aborting..." + exit 1 +fi + +MAIN_DIR="${1}" +INCOMING_DIR="${2}" +READY_SUFFIX="${3}" + +echo "Moving package(s) to the repo..." +mkdir -p "${MAIN_DIR}" +./movedebs.sh "${MAIN_DIR}" "${INCOMING_DIR}" "${READY_SUFFIX}" + +echo "Installing repository build dependencies (apt)..." +apt-get -qq -y --no-install-recommends install apt-utils > /dev/null + +echo "Updating the repo..." +REPO_PATH="repo" +TEMP_DIR="$(mktemp -d)" +./repo-update.sh "${REPO_PATH}" "${TEMP_DIR}" + +apt-get -qq -y --no-install-recommends install gpg gpg-agent + +echo "Checking if is possible to sign the repo..." +mkdir -p keys +chmod 600 keys +export GNUPGHOME="${PWD}/keys" + +./repo-sign.sh "${REPO_PATH}" + +echo "Committing changes..." +mv "${TEMP_DIR}"/* "${REPO_PATH}"/ + +#echo "deb file:/repo /" > /etc/apt/sources.list.d/custom-repo.list