#!/bin/bash##Exit on error in scriptset-e# This script will add a deb to the 'building' APT repository, using repreproREPREPRO=$(which reprepro)DUP="$(which dupload)"if[[$# -lt 3 ]];thenecho"Usage: ${0} <repo-dir> <change-file-path> <distro>"exit-1fiexport REPO_DIR=${1}export CHANGESFILE=${2}export DISTRO=${3}export UPLOAD=${4}PACKAGES_SOURCE=`cat$CHANGESFILE |grep Source:| awk'{ s = ""; for (i = 2; i <= NF; i++) s = s $i " "; print s }'`PACKAGES=`cat$CHANGESFILE |grep Binary:| awk'{ s = ""; for (i = 2; i <= NF; i++) s = s $i " "; print s }'`if[$UPLOAD=="upload"];thenecho"Upload parameter found running dupload"$DUP$CHANGESFILEelseecho"=====Listing Packages====="echo$PACKAGES$PACKAGES_SOURCEecho"=========================="echo"=====Removing Packages====="$REPREPRO-VVb$REPO_DIR remove $DISTRO$PACKAGES$PACKAGES_SOURCEecho"==========================="echo"=====Deploying Packages====="$REPREPRO-VVb$REPO_DIR include $DISTRO$CHANGESFILEecho"============================"fi