@@ -76,6 +76,9 @@ Options:
7676 to add to the chroot (comma separated). Signing keys for the
7777 repository will be imported if they exist as <filename>.gpg,
7878 <filename>.asc or <filename>.arm.
79+ -H Use repository lists from the host. Useful to make sure
80+ compiler/runner versions will be the same when using a custom
81+ image.
7982 -p <url> HTTP(S) Proxy URL to use during package install.
8083 -m <url> Debian or Ubuntu mirror URL to be used for package installation.
8184 -y Force overwriting the chroot dir and installing debootstrap.
@@ -110,7 +113,7 @@ FORCEYES=0
110113FORCEDOWNLOAD=0
111114
112115# Read command-line parameters:
113- while getopts ' a:d:D:R:i:r:l:s:p:m:yfh ' OPT ; do
116+ while getopts ' a:d:D:R:i:r:l:s:p:m:Hyfh ' OPT ; do
114117 case $OPT in
115118 a) ARCH=$OPTARG ;;
116119 d) CHROOTDIR=$OPTARG ;;
@@ -122,6 +125,7 @@ while getopts 'a:d:D:R:i:r:l:s:p:m:yfh' OPT ; do
122125 s) REPOLISTS=$OPTARG ;;
123126 p) DEBPROXY=$OPTARG ;;
124127 m) DEBMIRROR=$OPTARG ;;
128+ H) HOSTLISTS=1 ;;
125129 y) FORCEYES=1 ;;
126130 f) FORCEDOWNLOAD=1 ;;
127131 h) SHOWHELP=1 ;;
@@ -411,6 +415,14 @@ if [ "$DISTRO" = 'Ubuntu' ]; then
411415 in_chroot " ln -s /bin/true /sbin/initctl"
412416fi
413417
418+ # Use the repositories from the host
419+ if [ -n " $HOSTLISTS " ]; then
420+ for files in ' sources.list' ' sources.list.d' ' keyrings' ' trusted.gpg.d' ; do
421+ cp -r " /etc/apt/${files} " " $CHROOTDIR /etc/apt/"
422+ done
423+ in_chroot " apt-get update && apt-get install ca-certificates"
424+ fi
425+
414426# Add additional repository lists to the chroot for upstream repos
415427if [ -n " $REPOLISTS " ]; then
416428 in_chroot " apt-get install ca-certificates"
0 commit comments