@@ -10,27 +10,32 @@ OBJECT_STORAGE_ENDPOINT="https://object.storage.eu01.onstackit.cloud"
1010APT_BUCKET_NAME=" stackit-cli-apt"
1111PUBLIC_KEY_BUCKET_NAME=" stackit-public-key"
1212PUBLIC_KEY_FILE=" key.gpg"
13- CUSTOM_KEYRING=" custom-keyring"
13+ CUSTOM_KEYRING_FILE=" aptly-keyring.gpg"
14+ DISTRIBUTION=" stackit"
1415APTLY_CONFIG_FILE_PATH=" ./.aptly.conf"
1516GORELEASER_PACKAGES_FOLDER=" dist/"
1617
18+ # We need to disable the key database daemon (keyboxd)
19+ # This can be done by removing "use-keyboxd" from ~/.gnupg/common.conf (see https://github.com/gpg/gnupg/blob/master/README)
20+ echo -n > ~/.gnupg/common.conf
21+
1722# Create a local mirror of the current state of the remote APT repository
1823printf " >>> Creating mirror \n"
1924curl ${OBJECT_STORAGE_ENDPOINT} /${PUBLIC_KEY_BUCKET_NAME} /${PUBLIC_KEY_FILE} > public.asc
20- gpg --no-default-keyring --keyring ./ ${CUSTOM_KEYRING} .gpg --import public.asc
21- aptly mirror create -keyring=" ${CUSTOM_KEYRING} .gpg " current " ${OBJECT_STORAGE_ENDPOINT} /${APT_BUCKET_NAME} " stackit
25+ gpg --no-default-keyring --keyring= ${CUSTOM_KEYRING_FILE} --import public.asc
26+ aptly mirror create -config " ${APTLY_CONFIG_FILE_PATH} " - keyring=" ${CUSTOM_KEYRING_FILE} " current " ${OBJECT_STORAGE_ENDPOINT} /${APT_BUCKET_NAME} " ${DISTRIBUTION}
2227
2328# Update the mirror to the latest state
2429printf " \n>>> Updating mirror \n"
25- aptly mirror update current
30+ aptly mirror update -keyring= " ${CUSTOM_KEYRING_FILE} " current
2631
2732# Create a snapshot of the mirror
2833printf " \n>>> Creating snapshop from mirror \n"
2934aptly snapshot create current-snapshot from mirror current
3035
3136# Create a new fresh local APT repo
3237printf " \n>>> Creating fresh local repo \n"
33- aptly repo create -distribution=" stackit-cli " new-repo
38+ aptly repo create -distribution=" ${DISTRIBUTION} " new-repo
3439
3540# Add new generated .deb packages to the new local repo
3641printf " \n>>> Adding new packages to local repo \n"
@@ -42,8 +47,8 @@ aptly snapshot create new-snapshot from repo new-repo
4247
4348# Merge new-snapshot into current-snapshot creating a new snapshot updated-snapshot
4449printf " \n>>> Merging snapshots \n"
45- aptly snapshot pull -no-remove -architectures=" amd64,i386,arm64" current-snapshot new-snapshot updated-snapshot stackit
50+ aptly snapshot pull -no-remove -architectures=" amd64,i386,arm64" current-snapshot new-snapshot updated-snapshot ${DISTRIBUTION}
4651
4752# Publish the new snapshot to the remote repo
4853printf " \n>>> Publishing updated snapshot \n"
49- aptly publish switch - gpg-key=" ${GPG_PRIVATE_KEY_ID } " -passphrase " ${GPG_PASSPHRASE} " -config " ${APTLY_CONFIG_FILE_PATH} " stackit " s3:${APT_BUCKET_NAME} :" updated-snapshot
54+ aptly publish snapshot -keyring= " ${CUSTOM_KEYRING_FILE} " - gpg-key=" ${GPG_PRIVATE_KEY_FINGERPRINT } " -passphrase " ${GPG_PASSPHRASE} " -config " ${APTLY_CONFIG_FILE_PATH} " updated-snapshot " s3:${APT_BUCKET_NAME} :"
0 commit comments