#!/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