From 3d399cc99c73a806c9234e5cec4df8d5d6f9a277 Mon Sep 17 00:00:00 2001 From: BarryLhm Date: Tue, 31 Dec 2024 23:42:49 +0800 Subject: [PATCH] user/lxc: bump version to 6.0.3 and fix lxc-create template scripts --- user/lxc/patches/lxc-busybox.in.patch | 11 ++++++ user/lxc/patches/lxc-download.in.patch | 48 ++++++++++++++++++++++ user/lxc/patches/lxc-local.in.patch | 55 ++++++++++++++++++++++++++ user/lxc/patches/lxc-oci.in.patch | 11 ++++++ user/lxc/template.py | 6 ++- 5 files changed, 129 insertions(+), 2 deletions(-) create mode 100644 user/lxc/patches/lxc-busybox.in.patch create mode 100644 user/lxc/patches/lxc-download.in.patch create mode 100644 user/lxc/patches/lxc-local.in.patch create mode 100644 user/lxc/patches/lxc-oci.in.patch diff --git a/user/lxc/patches/lxc-busybox.in.patch b/user/lxc/patches/lxc-busybox.in.patch new file mode 100644 index 0000000000..0e560704de --- /dev/null +++ b/user/lxc/patches/lxc-busybox.in.patch @@ -0,0 +1,11 @@ +--- a/templates/lxc-busybox.in ++++ b/templates/lxc-busybox.in +@@ -260,7 +260,7 @@ EOF + return 0 + } + +-if ! options=$(getopt -o hp:n: -l help,rootfs:,path:,name:,mapped-uid:,mapped-gid:,busybox-path: -- "$@"); then ++if ! options=$(ugetopt -o hp:n: -l help,rootfs:,path:,name:,mapped-uid:,mapped-gid:,busybox-path: -- "$@"); then + usage + exit 1 + fi diff --git a/user/lxc/patches/lxc-download.in.patch b/user/lxc/patches/lxc-download.in.patch new file mode 100644 index 0000000000..1ec6cae5b9 --- /dev/null +++ b/user/lxc/patches/lxc-download.in.patch @@ -0,0 +1,48 @@ +--- a/templates/lxc-download.in ++++ b/templates/lxc-download.in +@@ -137,7 +137,7 @@ EOF + return 0 + } + +-if ! options=$(getopt -o d:r:a:hl -l dist:,release:,arch:,help,list,variant:,\ ++if ! options=$(ugetopt -o d:r:a:hl -l dist:,release:,arch:,help,list,variant:,\ + server:,flush-cache,force-cache,verbose,name:,path:,\ + rootfs:,mapped-uid:,mapped-gid: -- "$@"); then + usage +@@ -413,10 +413,10 @@ if [ ! -e "${configfile}" ]; then + fi + + ## Extract all the network config entries +-sed -i -e "/lxc.net.0/{w ${LXC_PATH}/config-network" -e "d}" "${LXC_PATH}/config" ++gsed -i -e "/lxc.net.0/{w ${LXC_PATH}/config-network" -e "d}" "${LXC_PATH}/config" + + ## Extract any other config entry +-sed -i -e "/lxc./{w ${LXC_PATH}/config-auto" -e "d}" "${LXC_PATH}/config" ++gsed -i -e "/lxc./{w ${LXC_PATH}/config-auto" -e "d}" "${LXC_PATH}/config" + + ## Append the defaults + { +@@ -471,17 +471,17 @@ OLD_IFS=${IFS} + IFS=";" + for file in ${TEMPLATE_FILES}; do + [ ! -f "${file}" ] && continue +- sed -i "s#LXC_NAME#${LXC_NAME}#g" "${file}" +- sed -i "s#LXC_PATH#${LXC_PATH}#g" "${file}" +- sed -i "s#LXC_ROOTFS#${LXC_ROOTFS}#g" "${file}" +- sed -i "s#LXC_TEMPLATE_CONFIG#${LXC_TEMPLATE_CONFIG}#g" "${file}" +- sed -i "s#LXC_HOOK_DIR#${LXC_HOOK_DIR}#g" "${file}" ++ gsed -i "s#LXC_NAME#${LXC_NAME}#g" "${file}" ++ gsed -i "s#LXC_PATH#${LXC_PATH}#g" "${file}" ++ gsed -i "s#LXC_ROOTFS#${LXC_ROOTFS}#g" "${file}" ++ gsed -i "s#LXC_TEMPLATE_CONFIG#${LXC_TEMPLATE_CONFIG}#g" "${file}" ++ gsed -i "s#LXC_HOOK_DIR#${LXC_HOOK_DIR}#g" "${file}" + done + IFS=${OLD_IFS} + + # prevent mingetty from calling vhangup(2) since it fails with userns on CentOS / Oracle + if [ -f "${LXC_ROOTFS}/etc/init/tty.conf" ]; then +- sed -i 's|mingetty|mingetty --nohangup|' "${LXC_ROOTFS}/etc/init/tty.conf" ++ gsed -i 's|mingetty|mingetty --nohangup|' "${LXC_ROOTFS}/etc/init/tty.conf" + fi + + if [ -n "${LXC_MAPPED_UID}" ] && [ "${LXC_MAPPED_UID}" != "-1" ]; then diff --git a/user/lxc/patches/lxc-local.in.patch b/user/lxc/patches/lxc-local.in.patch new file mode 100644 index 0000000000..f8ab023aae --- /dev/null +++ b/user/lxc/patches/lxc-local.in.patch @@ -0,0 +1,55 @@ +--- a/templates/lxc-local.in ++++ b/templates/lxc-local.in +@@ -72,7 +72,7 @@ EOF + } + + # Show usage and exit if invalid arguments are passed +-if ! options=$(getopt -o hm:f: -l help,metadata:,fstree:,no-dev:,name:,path:,rootfs:,mapped-uid:,mapped-gid: -- "$@"); then ++if ! options=$(ugetopt -o hm:f: -l help,metadata:,fstree:,no-dev:,name:,path:,rootfs:,mapped-uid:,mapped-gid: -- "$@"); then + usage + exit 1 + fi +@@ -184,7 +184,7 @@ extract_config() { + # The config will be merged later. + + # Extract all the network config entries +- sed -i -e "/lxc.net.0/{w ${LXC_PATH}/config-network" -e "d}" "${LXC_PATH}/config" ++ gsed -i -e "/lxc.net.0/{w ${LXC_PATH}/config-network" -e "d}" "${LXC_PATH}/config" + + if [ -e "${LXC_PATH}/config-network" ]; then + echo "Extracted network config to: ${LXC_PATH}/config-network" +@@ -192,7 +192,7 @@ extract_config() { + fi + + # Extract any other config entry +- sed -i -e "/lxc./{w ${LXC_PATH}/config-extra" -e "d}" "${LXC_PATH}/config" ++ gsed -i -e "/lxc./{w ${LXC_PATH}/config-extra" -e "d}" "${LXC_PATH}/config" + + if [ -e "${LXC_PATH}/config-extra" ]; then + echo "Extracted additional config to: ${LXC_PATH}/config-extra" +@@ -342,11 +342,11 @@ replace_template_vars() { + for file in ${TEMPLATE_FILES}; do + [ ! -f "${file}" ] && continue + +- sed -i "s#LXC_NAME#${LXC_NAME}#g" "${file}" +- sed -i "s#LXC_PATH#${LXC_PATH}#g" "${file}" +- sed -i "s#LXC_ROOTFS#${LXC_ROOTFS}#g" "${file}" +- sed -i "s#LXC_TEMPLATE_CONFIG#${LXC_TEMPLATE_CONFIG}#g" "${file}" +- sed -i "s#LXC_HOOK_DIR#${LXC_HOOK_DIR}#g" "${file}" ++ gsed -i "s#LXC_NAME#${LXC_NAME}#g" "${file}" ++ gsed -i "s#LXC_PATH#${LXC_PATH}#g" "${file}" ++ gsed -i "s#LXC_ROOTFS#${LXC_ROOTFS}#g" "${file}" ++ gsed -i "s#LXC_TEMPLATE_CONFIG#${LXC_TEMPLATE_CONFIG}#g" "${file}" ++ gsed -i "s#LXC_HOOK_DIR#${LXC_HOOK_DIR}#g" "${file}" + done + IFS=${OLD_IFS} + } +@@ -355,7 +355,7 @@ fix_tty() { + # prevent mingetty from calling vhangup(2) since it fails with userns on CentOS / Oracle + if [ -f "${LXC_ROOTFS}/etc/init/tty.conf" ]; then + echo "Patching ${LXC_ROOTFS}/etc/init/tty.conf to prevent mingetty from calling vhangup." +- sed -i 's|mingetty|mingetty --nohangup|' "${LXC_ROOTFS}/etc/init/tty.conf" ++ gsed -i 's|mingetty|mingetty --nohangup|' "${LXC_ROOTFS}/etc/init/tty.conf" + fi + } + diff --git a/user/lxc/patches/lxc-oci.in.patch b/user/lxc/patches/lxc-oci.in.patch new file mode 100644 index 0000000000..9c809c335b --- /dev/null +++ b/user/lxc/patches/lxc-oci.in.patch @@ -0,0 +1,11 @@ +--- a/templates/lxc-oci.in ++++ b/templates/lxc-oci.in +@@ -250,7 +250,7 @@ EOF + return 0 + } + +-if ! options=$(getopt -o u:h -l help,url:,username:,password:,no-cache,dhcp,name:,path:,rootfs:,mapped-uid:,mapped-gid:,mount-helper: -- "$@"); then ++if ! options=$(ugetopt -o u:h -l help,url:,username:,password:,no-cache,dhcp,name:,path:,rootfs:,mapped-uid:,mapped-gid:,mount-helper: -- "$@"); then + usage + exit 1 + fi diff --git a/user/lxc/template.py b/user/lxc/template.py index 38e0b8702e..40df7c3d8a 100644 --- a/user/lxc/template.py +++ b/user/lxc/template.py @@ -1,5 +1,5 @@ pkgname = "lxc" -pkgver = "6.0.2" +pkgver = "6.0.3" pkgrel = 0 build_style = "meson" configure_args = [ @@ -23,6 +23,8 @@ "openssl-devel", ] depends = [ + "ugetopt", + "gsed", "xz", "wget2", ] @@ -31,7 +33,7 @@ license = "GPL-2.0-only AND LGPL-2.1-only" url = "https://linuxcontainers.org" source = f"{url}/downloads/lxc/lxc-{pkgver}.tar.gz" -sha256 = "1930aa10d892db8531d1353d15f7ebf5913e74a19e134423e4d074c07f2d6e8b" +sha256 = "adac0837d2abfd2903916eaf56f60756f131327311f4f25ad917f6a71f73f98c" file_modes = {"usr/libexec/lxc/lxc-user-nic": ("root", "root", 0o4755)} # symlinks to _lxc options = ["!lintcomp"]