|
|
@ -45,21 +45,49 @@ echo "App packaged successfully." |
|
|
|
cd .. |
|
|
|
cd .. |
|
|
|
|
|
|
|
|
|
|
|
echo "Package(s) deploy..." |
|
|
|
echo "Package(s) deploy..." |
|
|
|
mkdir pkg |
|
|
|
INCOMING_DIR="repo/incoming" |
|
|
|
cp project/dist/*.deb pkg/ |
|
|
|
|
|
|
|
|
|
|
|
mkdir -p ${INCOMING_DIR} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
READY_SUFFIX=".ready" |
|
|
|
|
|
|
|
DIST_DIR="project/dist" |
|
|
|
|
|
|
|
for ENTRY in "${DIST_DIR}"/*.deb; do |
|
|
|
|
|
|
|
# If is not a file skip |
|
|
|
|
|
|
|
if [ -f "${ENTRY}" ]; then |
|
|
|
|
|
|
|
FILENAME=$(basename "${ENTRY}") |
|
|
|
|
|
|
|
#scp "${ENTRY}" reposerver:"${INCOMING_DIR}/${FILENAME}" |
|
|
|
|
|
|
|
#scp "${ENTRY}" reposerver:"${INCOMING_DIR}/${FILENAME}${READY_SUFFIX}" |
|
|
|
|
|
|
|
cp "${ENTRY}" "${INCOMING_DIR}/${FILENAME}" |
|
|
|
|
|
|
|
cp "${ENTRY}" "${INCOMING_DIR}/${FILENAME}${READY_SUFFIX}" |
|
|
|
|
|
|
|
fi |
|
|
|
|
|
|
|
done |
|
|
|
|
|
|
|
|
|
|
|
echo "Moving package(s) to the repo..." |
|
|
|
echo "Moving package(s) to the repo..." |
|
|
|
mkdir -p repo |
|
|
|
MAIN_DIR="repo/main" |
|
|
|
mv pkg/*.deb repo/ |
|
|
|
mkdir -p "${MAIN_DIR}" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for ENTRY in "${INCOMING_DIR}"/*"${READY_SUFFIX}"; do |
|
|
|
|
|
|
|
# If is not a file skip |
|
|
|
|
|
|
|
if [ -f "${ENTRY}" ]; then |
|
|
|
|
|
|
|
FILENAME_DEB=$(basename --suffix="${READY_SUFFIX}" "${ENTRY}") |
|
|
|
|
|
|
|
BASEDIRPATH=$(dirname "${ENTRY}") |
|
|
|
|
|
|
|
mv "${BASEDIRPATH}/${FILENAME_DEB}" "${MAIN_DIR}/${FILENAME_DEB}" |
|
|
|
|
|
|
|
rm "${ENTRY}" |
|
|
|
|
|
|
|
fi |
|
|
|
|
|
|
|
done |
|
|
|
|
|
|
|
|
|
|
|
cd repo |
|
|
|
echo "Installing repository build dependencies (apt)..." |
|
|
|
|
|
|
|
apt-get -qq -y --no-install-recommends install apt-utils > /dev/null |
|
|
|
|
|
|
|
|
|
|
|
echo "Updating the repo..." |
|
|
|
TEMP_DIR="$(mktemp -d)" |
|
|
|
apt-ftparchive packages . > Packages |
|
|
|
|
|
|
|
gzip -k -f Packages |
|
|
|
|
|
|
|
apt-ftparchive release . > Release |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cd .. |
|
|
|
echo "Updating the repo..." |
|
|
|
|
|
|
|
initial_position="$(pwd)" |
|
|
|
|
|
|
|
cd repo |
|
|
|
|
|
|
|
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" |
|
|
|
|
|
|
|
|
|
|
|
apt-get -qq -y --no-install-recommends install gpg gpg-agent |
|
|
|
apt-get -qq -y --no-install-recommends install gpg gpg-agent |
|
|
|
|
|
|
|
|
|
|
@ -101,15 +129,17 @@ if [ -z ${GPG_SUBKEY_ID+x} ]; then |
|
|
|
GPG_SUBKEY_ID="$(gpg --list-secret-key --with-subkey-fingerprint --with-colons | awk -F: '$1 == "fpr" {print $10;}' | sed -n '2 p')" |
|
|
|
GPG_SUBKEY_ID="$(gpg --list-secret-key --with-subkey-fingerprint --with-colons | awk -F: '$1 == "fpr" {print $10;}' | sed -n '2 p')" |
|
|
|
fi |
|
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
if [ ! -f repo/KEY.pub ];then |
|
|
|
if [ ! -f repo/key.pub.asc ];then |
|
|
|
echo "Public key not published. Generating and publishing it..." |
|
|
|
echo "Public key not published. Generating and publishing it..." |
|
|
|
gpg --armor --export "${GPG_SUBKEY_ID}" > repo/KEY.pub |
|
|
|
gpg --armor --export "${GPG_SUBKEY_ID}" > repo/key.pub.asc |
|
|
|
fi |
|
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
echo "Signing the repo..." |
|
|
|
echo "Signing the repo..." |
|
|
|
gpg --passphrase-file keys/passphrase --pinentry-mode loopback --default-key "${GPG_SUBKEY_ID}" -abs -o - repo/Release > repo/Release.gpg |
|
|
|
gpg --passphrase-file keys/passphrase --pinentry-mode loopback --default-key "${GPG_SUBKEY_ID}" -abs -o - "${TEMP_DIR}/Release" > "${TEMP_DIR}/Release.gpg" |
|
|
|
gpg --passphrase-file keys/passphrase --pinentry-mode loopback --default-key "${GPG_SUBKEY_ID}" --clearsign -o - repo/Release > repo/InRelease |
|
|
|
gpg --passphrase-file keys/passphrase --pinentry-mode loopback --default-key "${GPG_SUBKEY_ID}" --clearsign -o - "${TEMP_DIR}/Release" > "${TEMP_DIR}/InRelease" |
|
|
|
echo "Done." |
|
|
|
echo "Done." |
|
|
|
|
|
|
|
|
|
|
|
#echo "deb file:/repo /" > /etc/apt/sources.list.d/custom-repo.list |
|
|
|
echo "Committing changes..." |
|
|
|
|
|
|
|
mv "${TEMP_DIR}"/* repo/ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#echo "deb file:/repo /" > /etc/apt/sources.list.d/custom-repo.list |
|
|
|