Skip to content

Commit

Permalink
Add option to build chroot based on host image
Browse files Browse the repository at this point in the history
Useful for the WFs where the image is non-standard and uses additional
ppa's so the mirror is not enough.
  • Loading branch information
vmcj committed Sep 13, 2024
1 parent 72b3b49 commit 3f7298f
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion misc-tools/dj_make_chroot.in
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ Options:
to add to the chroot (comma separated). Signing keys for the
repository will be imported if they exist as <filename>.gpg,
<filename>.asc or <filename>.arm.
-H Use repository lists from the host. Useful to make sure
compiler/runner versions will be the same when using a custom
image.
-p <url> HTTP(S) Proxy URL to use during package install.
-m <url> Debian or Ubuntu mirror URL to be used for package installation.
-y Force overwriting the chroot dir and installing debootstrap.
Expand Down Expand Up @@ -110,7 +113,7 @@ FORCEYES=0
FORCEDOWNLOAD=0

# Read command-line parameters:
while getopts 'a:d:D:R:i:r:l:s:p:m:yfh' OPT ; do
while getopts 'a:d:D:R:i:r:l:s:p:m:Hyfh' OPT ; do
case $OPT in
a) ARCH=$OPTARG ;;
d) CHROOTDIR=$OPTARG ;;
Expand All @@ -122,6 +125,7 @@ while getopts 'a:d:D:R:i:r:l:s:p:m:yfh' OPT ; do
s) REPOLISTS=$OPTARG ;;
p) DEBPROXY=$OPTARG ;;
m) DEBMIRROR=$OPTARG ;;
H) HOSTLISTS=1 ;;
y) FORCEYES=1 ;;
f) FORCEDOWNLOAD=1 ;;
h) SHOWHELP=1 ;;
Expand Down Expand Up @@ -411,6 +415,14 @@ if [ "$DISTRO" = 'Ubuntu' ]; then
in_chroot "ln -s /bin/true /sbin/initctl"
fi

# Use the repositories from the host
if [ -n "$HOSTLISTS" ]; then
for files in 'sources.list' 'sources.list.d' 'keyrings' 'trusted.gpg.d'; do
cp -r "/etc/apt/${files}" "$CHROOTDIR/etc/apt/"
done
in_chroot "apt-get update && apt-get install ca-certificates"
fi

# Add additional repository lists to the chroot for upstream repos
if [ -n "$REPOLISTS" ]; then
in_chroot "apt-get install ca-certificates"
Expand Down

0 comments on commit 3f7298f

Please sign in to comment.