mirror of
https://github.com/certbot/certbot.git
synced 2026-01-26 07:41:33 +03:00
48 lines
1.6 KiB
Bash
Executable File
48 lines
1.6 KiB
Bash
Executable File
#!/bin/bash
|
|
set -e
|
|
|
|
# This code is based on snapcraft's own patch to work around this problem at
|
|
# https://github.com/snapcore/snapcraft/blob/a97fb5c7ea553a1bd20f4887a7c3393e75761890/patches/ctypes_init.diff.
|
|
# We may not build the Certbot snap for all of these architectures (and as of
|
|
# writing this we do not), but we keep the code for them to avoid having to
|
|
# solve this problem again in the future if we add support for new
|
|
# architectures.
|
|
case "${SNAP_ARCH}" in
|
|
'arm64')
|
|
ARCH_TRIPLET='aarch64-linux-gnu';;
|
|
'armhf')
|
|
ARCH_TRIPLET='arm-linux-gnueabihf';;
|
|
'i386')
|
|
ARCH_TRIPLET='i386-linux-gnu';;
|
|
'ppc64el')
|
|
ARCH_TRIPLET='powerpc64le-linux-gnu';;
|
|
'powerpc')
|
|
ARCH_TRIPLET='powerpc-linux-gnu';;
|
|
'amd64')
|
|
ARCH_TRIPLET='x86_64-linux-gnu';;
|
|
's390x')
|
|
ARCH_TRIPLET='s390x-linux-gnu';;
|
|
*)
|
|
echo "Unrecongized value of SNAP_ARCH: ${SNAP_ARCH}" >&2
|
|
exit 1
|
|
esac
|
|
|
|
PARTIAL_LIBRARY_PATH="${SNAP}/usr/lib/${ARCH_TRIPLET}/"
|
|
export LD_LIBRARY_PATH="${PARTIAL_LIBRARY_PATH}:${LD_LIBRARY_PATH}"
|
|
export CERTBOT_AUGEAS_PATH="${PARTIAL_LIBRARY_PATH}libaugeas.so.0"
|
|
|
|
join() {
|
|
sep=$1
|
|
first=$2
|
|
if [ "$first" != "" ]; then
|
|
shift 2
|
|
echo -n "${first}"
|
|
for item in "$@"; do echo -n "${sep}${item}"; done
|
|
echo
|
|
fi
|
|
}
|
|
|
|
paths=$(for plugin_snap in $(snap connections certbot|sed -n '2,$p'|awk '$1=="content[certbot-1]"{print $3}'|cut -d: -f1); do echo /snap/$plugin_snap/current/lib/python3.8/site-packages; done)
|
|
export CERTBOT_PLUGIN_PATH=$(join : $paths)
|
|
exec certbot "$@"
|