Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lxc: fix template scripts #3374

Open
BarryLhm opened this issue Dec 31, 2024 · 6 comments
Open

lxc: fix template scripts #3374

BarryLhm opened this issue Dec 31, 2024 · 6 comments

Comments

@BarryLhm
Copy link
Contributor

there's incompatible tools and patterns in template scripts like system sed + gnu sed syntax and system getopt + ugetopt syntax...

@q66
Copy link
Member

q66 commented Dec 31, 2024

that's not a specific issue

@q66 q66 closed this as completed Dec 31, 2024
@q66 q66 reopened this Dec 31, 2024
@q66
Copy link
Member

q66 commented Dec 31, 2024

either post patches or at least some actual specific information

@BarryLhm
Copy link
Contributor Author

BarryLhm commented Dec 31, 2024

$> lxc-create -n test -t download -- --server mirrors.tuna.tsinghua.edu.cn/lxc-images
getopt: unrecognized option: l

and sed reports unexpected EOF while waiting '}'

@BarryLhm
Copy link
Contributor Author

BarryLhm commented Dec 31, 2024

a patch:
/usr/share/lxc/templates/lxc-download

< 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:,\
416c416
< 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"
419c419
< 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"
474,478c474,478
<   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}"
484c484
<   sed -i 's|mingetty|mingetty --nohangup|' "${LXC_ROOTFS}/etc/init/tty.conf"
---
>   gsed -i 's|mingetty|mingetty --nohangup|' "${LXC_ROOTFS}/etc/init/tty.conf"```

@BarryLhm
Copy link
Contributor Author

replacing sed and getopt solves the problem.

@BarryLhm
Copy link
Contributor Author

BarryLhm commented Dec 31, 2024

maybe correcting the pattern is a better solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants