1
0
mirror of https://github.com/lxc/lxc-templates.git synced 2025-08-21 12:20:54 +00:00

Compare commits

..

1 Commits

Author SHA1 Message Date
zhaixiaojuan@loongson.cn
5af60f83ca
Merge e0d8f58995d58e4bcd337e80e37ba1ebe29558a2 into a0745c836a89c7776bf27dfbe5a8c9a0a9aec28b 2024-01-30 11:48:33 +08:00
2 changed files with 9 additions and 22 deletions

View File

@ -238,14 +238,7 @@ write_sourceslist()
if [ "$mainonly" = 1 ]; then if [ "$mainonly" = 1 ]; then
non_main='' non_main=''
else else
case "$release" in
wheezy|jessie|stretch|buster|bullseye)
non_main=' contrib non-free' non_main=' contrib non-free'
;;
*)
non_main=' contrib non-free non-free-firmware'
;;
esac
fi fi
cat >> "${rootfs}/etc/apt/sources.list" << EOF cat >> "${rootfs}/etc/apt/sources.list" << EOF
@ -698,8 +691,8 @@ Options :
-S, --auth-key=KEYFILE SSH public key to inject into the container as the root user. -S, --auth-key=KEYFILE SSH public key to inject into the container as the root user.
-a, --arch=ARCH The container architecture. Can be one of: i686, x86_64, -a, --arch=ARCH The container architecture. Can be one of: i686, x86_64,
amd64, armhf, armel, powerpc. Defaults to host arch. amd64, armhf, armel, powerpc. Defaults to host arch.
-r, --release=RELEASE Debian release. Can be one of: wheezy, jessie, stretch, buster, -r, --release=RELEASE Debian release. Can be one of: wheezy, jessie, stretch, buster, sid.
bullseye, bookworm, trixie, sid. Defaults to current stable. Defaults to current stable.
--mirror=MIRROR Debian mirror to use during installation. Overrides the MIRROR --mirror=MIRROR Debian mirror to use during installation. Overrides the MIRROR
environment variable (see below). environment variable (see below).
--keyring=KEYRING GPG keyring to authenticate the repository against. --keyring=KEYRING GPG keyring to authenticate the repository against.
@ -710,7 +703,7 @@ Options :
--packages=PACKAGE_NAME1,PACKAGE_NAME2,... --packages=PACKAGE_NAME1,PACKAGE_NAME2,...
List of additional packages to install. Comma separated, without space. List of additional packages to install. Comma separated, without space.
-c, --clean only clean up the cache and terminate -c, --clean only clean up the cache and terminate
--enable-non-free include also Debian's contrib, non-free and non-free-firmware repositories. --enable-non-free include also Debian's contrib and non-free repositories.
-I|--interpreter-path=INTERPRETER-PATH -I|--interpreter-path=INTERPRETER-PATH
Path of the binfmt interpreter to copy to the rootfs Path of the binfmt interpreter to copy to the rootfs
-F | --flush-cache Flush the debian release cache -F | --flush-cache Flush the debian release cache

View File

@ -224,18 +224,13 @@ write_sourceslist()
if [ "$mainonly" = 1 ]; then if [ "$mainonly" = 1 ]; then
non_main='' non_main=''
else else
non_main=' contrib non-free non-free-firmware' non_main=' contrib non-free'
fi fi
cat >> "${rootfs}/etc/apt/sources.list" << EOF cat >> "${rootfs}/etc/apt/sources.list" << EOF
${prefix} $MIRROR ${release} main${non_main} ${prefix} $MIRROR ${release} main${non_main}
EOF EOF
}
apt_update_packages(){
local apt_update_args="update"
chroot "${rootfs}" apt-get $apt_update_args
return $?
} }
install_packages() install_packages()
@ -243,10 +238,9 @@ install_packages()
local rootfs="$1"; shift local rootfs="$1"; shift
local packages="$*" local packages="$*"
if [ -n "${packages}" ] && apt_update_packages; then chroot "${rootfs}" apt-get update
chroot "${rootfs}" apt-get install -y --no-install-recommends ${packages} if [ -n "${packages}" ]; then
elif [ -n "${packages}" ]; then chroot "${rootfs}" apt-get install --force-yes -y --no-install-recommends ${packages}
echo "Apt update failed, not downloading packages"
fi fi
} }
@ -644,7 +638,7 @@ Options :
--packages=PACKAGE_NAME1,PACKAGE_NAME2,... --packages=PACKAGE_NAME1,PACKAGE_NAME2,...
List of additional packages to install. Comma separated, without space. List of additional packages to install. Comma separated, without space.
-c, --clean only clean up the cache and terminate -c, --clean only clean up the cache and terminate
--enable-non-free include also Kali's contrib, non-free and non-free-firmware repositories. --enable-non-free include also Kali's contrib and non-free repositories.
-I|--interpreter-path=INTERPRETER-PATH -I|--interpreter-path=INTERPRETER-PATH
Path of the binfmt interpreter to copy to the rootfs Path of the binfmt interpreter to copy to the rootfs
-F | --flush-cache Flush the kali release cache -F | --flush-cache Flush the kali release cache