github.com/pojntfx/hydrapp/hydrapp@v0.0.0-20240516002902-d08759d6ca9f/pkg/builders/deb/entrypoint.sh (about) 1 #!/bin/bash 2 3 set -e 4 5 # Setup PGP 6 echo "${PGP_KEY_PASSWORD}" | base64 -d >'/tmp/pgp-pass' 7 mkdir -p "${HOME}/.gnupg" 8 cat >"${HOME}/.gnupg/gpg.conf" <<EOT 9 yes 10 passphrase-file /tmp/pgp-pass 11 pinentry-mode loopback 12 EOT 13 14 echo "${PGP_KEY}" | base64 -d >'/tmp/private.pgp' 15 gpg --import /tmp/private.pgp 16 17 # Prepare build environment 18 export BASEDIR="${PWD}/${GOMAIN}" 19 20 # Build chroot and source package 21 export PACKAGE="${APP_ID}_${PACKAGE_VERSION}~${BRANCH_TIMESTAMP_UNIX}" 22 23 if [ ! -d debian ]; then 24 cp -r "${BASEDIR}/debian" debian 25 fi 26 27 dpkg-source -b . 28 29 pbuilder --create --mirror "${MIRRORSITE}" --components "${COMPONENTS}" $([ "${DEBOOTSTRAPOPTS}" != "" ] && echo --debootstrapopts "${DEBOOTSTRAPOPTS}") 30 pbuilder build --mirror "${MIRRORSITE}" --components "${COMPONENTS}" $([ "${DEBOOTSTRAPOPTS}" != "" ] && echo --debootstrapopts "${DEBOOTSTRAPOPTS}") "../${PACKAGE}.dsc" 31 32 for FILE in "/var/cache/pbuilder/${OS}-${DISTRO}-${ARCHITECTURE}/result/"*; do 33 mv "${FILE}" "${FILE//_${ARCHITECTURE}/_${OS}_${DISTRO}_${ARCHITECTURE}}" || : 34 done 35 36 mkdir -p "/hydrapp/dst/pool/main" 37 cp "/var/cache/pbuilder/${OS}-${DISTRO}-${ARCHITECTURE}/result/"* "/hydrapp/dst/pool/main" || : 38 39 cd '/hydrapp/dst' || exit 1 40 41 mkdir -p "main/binary-${ARCHITECTURE}" 42 43 mkdir -p "main/source" 'cache' 44 45 cat >'apt-ftparchive.conf' <<EOT 46 Dir { 47 ArchiveDir "${OS}"; 48 CacheDir "cache"; 49 }; 50 Default { 51 Packages::Compress ". gzip bzip2"; 52 Sources::Compress ". gzip bzip2"; 53 Contents::Compress ". gzip bzip2"; 54 }; 55 TreeDefault { 56 BinCacheDB "packages-\$(SECTION)-\$(ARCHITECTURE).db"; 57 Directory "pool/\$(SECTION)"; 58 Packages "\$(DISTRO)/\$(SECTION)/binary-\$(ARCHITECTURE)/Packages"; 59 SrcDirectory "pool/\$(SECTION)"; 60 Sources "\$(DISTRO)/\$(SECTION)/source/Sources"; 61 Contents "\$(DISTRO)/Contents-\$(ARCHITECTURE)"; 62 }; 63 Tree "." { 64 Sections "main"; 65 ARCHITECTURE "${ARCHITECTURE} source"; 66 } 67 EOT 68 69 apt-ftparchive generate 'apt-ftparchive.conf' 70 71 cat >"${OS}-${DISTRO}.conf" <<EOT 72 APT::FTPArchive::Release::Codename "${DISTRO}"; 73 APT::FTPArchive::Release::Origin "hydrapp APT repo"; 74 APT::FTPArchive::Release::Components "main"; 75 APT::FTPArchive::Release::Label "Packages for hydrapp"; 76 APT::FTPArchive::Release::ARCHITECTURE "${ARCHITECTURE} source"; 77 APT::FTPArchive::Release::Suite "${DISTRO}"; 78 EOT 79 80 apt-ftparchive -c "${OS}-${DISTRO}.conf" release "." >"Release" 81 82 gpg --output "repo.asc" --armor --export 83 84 gpg --output "Release.gpg" -ba "Release" 85 86 if [ "${DST_UID}" != "" ] && [ "${DST_GID}" != "" ]; then 87 chown -R "${DST_UID}:${DST_GID}" /hydrapp/dst 88 fi