fix: apt signing
This commit is contained in:
@@ -7,7 +7,9 @@ RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selectio
|
|||||||
ENV DEBIAN_FRONTEND noninteractive
|
ENV DEBIAN_FRONTEND noninteractive
|
||||||
RUN apt-get -qq update
|
RUN apt-get -qq update
|
||||||
RUN apt-get -qq install --no-install-recommends \
|
RUN apt-get -qq install --no-install-recommends \
|
||||||
software-properties-common sudo
|
software-properties-common \
|
||||||
|
wget \
|
||||||
|
sudo
|
||||||
|
|
||||||
# Create user with sudo priviledge
|
# Create user with sudo priviledge
|
||||||
RUN useradd -r -u 1001 --create-home -m "test-user"
|
RUN useradd -r -u 1001 --create-home -m "test-user"
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
# Utility functions for common tasks
|
# Utility functions for common tasks
|
||||||
|
|
||||||
|
ARCH=$(dpkg --print-architecture)
|
||||||
|
|
||||||
# @arg $1 URL to download
|
# @arg $1 URL to download
|
||||||
# @arg $2 Path to file
|
# @arg $2 Path to file
|
||||||
function download_file {
|
function download_file {
|
||||||
@@ -52,14 +54,23 @@ function install {
|
|||||||
# * components - apt components
|
# * components - apt components
|
||||||
function add_repository {
|
function add_repository {
|
||||||
key=$(jq -r ".key" <<<"$1")
|
key=$(jq -r ".key" <<<"$1")
|
||||||
repository=$(jq -r ".repository" <<<"$1")
|
echo "Updating apt repository ${key}..."
|
||||||
|
|
||||||
signingKey=$(jq -r ".signingKey" <<<"$1")
|
signingKey=$(jq -r ".signingKey" <<<"$1")
|
||||||
|
repository=$(jq -r ".repository" <<<"$1")
|
||||||
components=$(jq -r ".components" <<<"$1")
|
components=$(jq -r ".components" <<<"$1")
|
||||||
source="deb [arch=$(dpkg --print-architecture)] ${repository} ${components}"
|
|
||||||
echo "$source" | sudo tee "/etc/apt/sources.list.d/${key}.list" >/dev/null
|
signingKeyPath="/etc/apt/keyrings/${key}.gpg"
|
||||||
|
sourcesListPath="/etc/apt/sources.list.d/${key}.list"
|
||||||
|
source="deb [signed-by=${signingKeyPath} arch=${ARCH}] ${repository} ${components}"
|
||||||
|
|
||||||
|
sudo mkdir -p /etc/apt/keyrings
|
||||||
|
sudo mkdir -p /etc/apt/sources.list.d
|
||||||
|
|
||||||
|
echo "$source" | sudo tee "$sourcesListPath" >/dev/null
|
||||||
wget -O- "$signingKey" |
|
wget -O- "$signingKey" |
|
||||||
gpg --dearmor |
|
gpg --dearmor |
|
||||||
sudo tee "/etc/apt/keyrings/${key}.gpg" >/dev/null
|
sudo tee "$signingKeyPath" >/dev/null
|
||||||
}
|
}
|
||||||
|
|
||||||
# @arg $1 package list file to install
|
# @arg $1 package list file to install
|
||||||
|
|||||||
Reference in New Issue
Block a user