Skip to content

Commit 0998a77

Browse files
committed
rootfs: allow APA to handle GPG keys when it is active during the build
this is a small first step to mainlining APA into core and let it handle some packaging and distribution logic
1 parent 7acfd96 commit 0998a77

File tree

1 file changed

+19
-15
lines changed

1 file changed

+19
-15
lines changed

lib/functions/rootfs/distro-specific.sh

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@ function create_sources_list_and_deploy_repo_key() {
8080

8181
declare distro=""
8282

83+
APT_SIGNING_KEY_FILE="/usr/share/keyrings/armbian-archive-keyring.gpg"
84+
8385
# Drop deboostrap sources leftovers
8486
rm -f "${basedir}/etc/apt/sources.list"
8587

@@ -157,21 +159,23 @@ function create_sources_list_and_deploy_repo_key() {
157159
;;
158160
esac
159161

160-
# add armbian key
161-
display_alert "Adding Armbian repository and authentication key" "${when} :: /etc/apt/sources.list.d/armbian.sources" "info"
162-
mkdir -p "${basedir}"/usr/share/keyrings
163-
# change to binary form
164-
APT_SIGNING_KEY_FILE="/usr/share/keyrings/armbian-archive-keyring.gpg"
165-
gpg --dearmor < "${SRC}"/config/armbian.key > "${basedir}${APT_SIGNING_KEY_FILE}"
166-
167-
# lets link to the old file as armbian-config uses it and we can't set there to new file
168-
# we user force linking as some old caches still exists
169-
chroot "${basedir}" /bin/bash -c "ln -fs armbian-archive-keyring.gpg /usr/share/keyrings/armbian.gpg"
170-
171-
# lets keep old way for old distributions
172-
if [[ "${RELEASE}" =~ (focal|bullseye) ]]; then
173-
cp "${SRC}"/config/armbian.key "${basedir}"
174-
chroot "${basedir}" /bin/bash -c "cat armbian.key | apt-key add - > /dev/null 2>&1"
162+
# code to be made obsolete by making APA part of Armbian Core. #XXX
163+
if [ ! $APA_IS_ACTIVE = "true" ]; then
164+
# add armbian key
165+
display_alert "Adding Armbian repository and authentication key" "${when} :: /etc/apt/sources.list.d/armbian.sources" "info"
166+
mkdir -p "${basedir}"/usr/share/keyrings
167+
# change to binary form
168+
gpg --dearmor < "${SRC}"/config/armbian.key > "${basedir}${APT_SIGNING_KEY_FILE}"
169+
170+
# lets link to the old file as armbian-config uses it and we can't set there to new file
171+
# we user force linking as some old caches still exists
172+
chroot "${basedir}" /bin/bash -c "ln -fs armbian-archive-keyring.gpg /usr/share/keyrings/armbian.gpg"
173+
174+
# lets keep old way for old distributions
175+
if [[ "${RELEASE}" =~ (focal|bullseye) ]]; then
176+
cp "${SRC}"/config/armbian.key "${basedir}"
177+
chroot "${basedir}" /bin/bash -c "cat armbian.key | apt-key add - > /dev/null 2>&1"
178+
fi
175179
fi
176180

177181
# Add Armbian APT repository

0 commit comments

Comments
 (0)