Skip to content

Commit

Permalink
user/lxc: bump version to 6.0.3 and fix lxc-create template scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
BarryLhm committed Jan 1, 2025
1 parent fa519ae commit 3d399cc
Show file tree
Hide file tree
Showing 5 changed files with 129 additions and 2 deletions.
11 changes: 11 additions & 0 deletions user/lxc/patches/lxc-busybox.in.patch
Original file line number Diff line number Diff line change
@@ -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
48 changes: 48 additions & 0 deletions user/lxc/patches/lxc-download.in.patch
Original file line number Diff line number Diff line change
@@ -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
55 changes: 55 additions & 0 deletions user/lxc/patches/lxc-local.in.patch
Original file line number Diff line number Diff line change
@@ -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
}

11 changes: 11 additions & 0 deletions user/lxc/patches/lxc-oci.in.patch
Original file line number Diff line number Diff line change
@@ -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
6 changes: 4 additions & 2 deletions user/lxc/template.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
pkgname = "lxc"
pkgver = "6.0.2"
pkgver = "6.0.3"
pkgrel = 0
build_style = "meson"
configure_args = [
Expand All @@ -23,6 +23,8 @@
"openssl-devel",
]
depends = [
"ugetopt",
"gsed",
"xz",
"wget2",
]
Expand All @@ -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"]
Expand Down

0 comments on commit 3d399cc

Please sign in to comment.