mirror of
https://hubproxy.babadafafafafa.cn/https://github.com/docker-easyconnect/docker-easyconnect.git
synced 2026-09-20 08:03:33 +08:00
Since non-amd64 deb packages of EasyConnect are proved to exist (https://github.com/Hagb/docker-easyconnect/issues/25#issuecomment-1233369467), the deb package should not be assume to be amd64 and architecture specific code should be rewritten: - Add EC_HOST build argument to tell Dockerfile the architecture of EasyConnect package - Whether to install cross toolchain and qemu-user and which package should be install, is determined by EC_HOST and the local architecture now, more specifically by build-scripts/get-echost-names.sh (no longer hard-code amd64 cross toolchain) - fake-hwaddr.so should follow the architecture of the EC deb, so fake-hwaddr/Makefile uses CC envirnoment variable instead of hard-coded x86_64-linux-gnu-gcc as c compiler now - qemu_args is removed now. It was used to pass LD_PRELOAD to foreign binaries under qemu-user, but now we pass LD_PRELOAD to the qemu wrapper and wrapper will pass the LD_PRELOAD to the simulated binaries
24 lines
862 B
Bash
Executable File
24 lines
862 B
Bash
Executable File
#!/bin/sh
|
||
. /tmp/build-scripts/get-echost-names.sh &&
|
||
{
|
||
! is_echost_foreign ||
|
||
for exec in CSClient ECAgent svpnservice $extra_bins; do
|
||
exec_path=/usr/share/sangfor/EasyConnect/resources/bin/$exec &&
|
||
mkdir -p /usr/local/libexec/qemu-hack/ &&
|
||
qemu_path=/usr/local/libexec/qemu-hack/$exec &&
|
||
|
||
mv ${exec_path} ${exec_path}-origin &&
|
||
|
||
# 一个让 qemu 产生的进程名字和原生运行时名字一致的 hack(便于 killall 杀进程):使 qemu 的文件名和被模拟程序文件名一致
|
||
ln -s /usr/bin/${ecqemu} ${qemu_path} &&
|
||
|
||
# 将原可执行文件用 qemu 封装起来
|
||
printf '%s\n%s' \
|
||
'#!/bin/sh' \
|
||
"LD_PRELOAD= exec ${qemu_path} -E LD_PRELOAD=\"\${LD_PRELOAD}\" ${exec_path}-origin \"\$@\"" > ${exec_path} &&
|
||
chown --reference=${exec_path}-origin ${exec_path} &&
|
||
chmod --reference=${exec_path}-origin ${exec_path} ||
|
||
exit 1
|
||
done
|
||
}
|