#!/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-update.sh [-h] [REPO_PATH TEMP_DIR] Deploys packages for you. Possible values for the arguments: REPO_PATH path of the repositpry TEMP_DIR path of the temporary folder Dependencies: - " exit 0 fi if [ $# -lt 2 ]; then echo "Mandatory arguments: 'REPO_PATH', 'TEMP_DIR'. Aborting..." exit 1 fi REPO_PATH="${1}" TEMP_DIR="${2}" initial_position="$(pwd)" cd "${REPO_PATH}" apt-ftparchive packages . > "${TEMP_DIR}/Packages" cd "${initial_position}" gzip -k -f "${TEMP_DIR}/Packages" --to-stdout > "${TEMP_DIR}/Packages.gz" apt-ftparchive release "${TEMP_DIR}" > "${TEMP_DIR}/Release"