switch to hybrid

This commit is contained in:
aptalca 2022-07-28 13:34:38 -04:00
parent 5367cecf05
commit dbd098b254
11 changed files with 105 additions and 0 deletions

View File

@ -0,0 +1,64 @@
#!/usr/bin/with-contenv bash
# Determine if setup is needed
if [ -d /dotnet ]; then
# install deps
echo "**** Adding dotnet dependencies to package install list ****"
source /etc/lsb-release
if [ "${DISTRIB_CODENAME}" == "focal" ]; then
echo "libicu66" >> /mod-repo-packages-to-install.list
elif [ "${DISTRIB_CODENAME}" == "jammy" ]; then
echo "libicu70" >> /mod-repo-packages-to-install.list
fi
# remove existing install if updating
if ls -d /dotnet_* >/dev/null 2>&1; then
echo "deleting" $(ls -d /dotnet_*)
rm -rf /dotnet_*
fi
DOTNET_VERSIONS=$(cat /dotnet/versions.txt)
ARCH=$(uname -m)
for i in $DOTNET_VERSIONS; do
mkdir -p "/dotnet_${i}"
tar xzf "/dotnet/dotnetsdk_${i}_${ARCH}.tar.gz" -C "/dotnet_${i}"
done
rm -rf /dotnet
# symlink latest dotnet binary
DOTNET_LATEST=$(echo "$DOTNET_VERSIONS" | awk '{print $1}')
rm -rf /usr/local/bin/dotnet
ln -s /dotnet_${DOTNET_LATEST}/dotnet /usr/local/bin/dotnet
echo "
****************************************************
****************************************************
**
**
DOTNET SDK versions installed:
$(echo $DOTNET_VERSIONS | sed 's| |\n |g')
**
**
Binary locations are:"
for i in $DOTNET_VERSIONS; do
echo " /dotnet_${i}/dotnet"
done
echo " **
**
Version $DOTNET_LATEST is symlinked from /usr/local/bin/dotnet and can be called from anywhere via \"dotnet\"
**
**
****************************************************
****************************************************"
# symlink other dotnet installs for access through latest binary
for i in {2..5}; do
DOTNET_OTHER_SDK_VERSION="$(echo $DOTNET_VERSIONS | awk -v var=${i} '{print $var}')"
if [ -n "$DOTNET_OTHER_SDK_VERSION" ]; then
DOTNET_OTHER_RUNTIME_VERSION="$(ls /dotnet_${DOTNET_OTHER_SDK_VERSION}/shared/Microsoft.NETCore.App)"
echo "**** Symlinking sdk version ${DOTNET_OTHER_SDK_VERSION} and runtime version ${DOTNET_OTHER_RUNTIME_VERSION} ****"
ln -s "/dotnet_${DOTNET_OTHER_SDK_VERSION}/shared/Microsoft.NETCore.App/${DOTNET_OTHER_RUNTIME_VERSION}" "/dotnet_${DOTNET_LATEST}/shared/Microsoft.NETCore.App/${DOTNET_OTHER_RUNTIME_VERSION}"
ln -s "/dotnet_${DOTNET_OTHER_SDK_VERSION}/shared/Microsoft.AspNetCore.App/${DOTNET_OTHER_RUNTIME_VERSION}" "/dotnet_${DOTNET_LATEST}/shared/Microsoft.AspNetCore.App/${DOTNET_OTHER_RUNTIME_VERSION}"
ln -s "/dotnet_${DOTNET_OTHER_SDK_VERSION}/sdk/${DOTNET_OTHER_SDK_VERSION}" "/dotnet_${DOTNET_LATEST}/sdk/${DOTNET_OTHER_SDK_VERSION}"
else
break
fi
done
else
echo "**** Existing dotnet install is up to date, skipping ****"
fi

View File

@ -0,0 +1 @@
oneshot

View File

@ -0,0 +1 @@
/etc/s6-overlay/s6-rc.d/init-mod-code-server-dotnet-add-package/run

View File

@ -0,0 +1,37 @@
#!/usr/bin/with-contenv bash
if [ -f "/mod-repo-packages-to-install.list" ]; then
echo "**** Installing all mod packages ****"
if [ -f /usr/bin/apt ]; then
DEBIAN_FRONTEND="noninteractive"
apt-get update
apt-get install -y \
$(cat /mod-repo-packages-to-install.list)
elif [ -f /usr/bin/apk ]; then
apk add --no-cache \
$(cat /mod-repo-packages-to-install.list)
fi
else
echo "**** No repo packages to install, skipping ****"
fi
if [ -f "/mod-pip-packages-to-install.list" ]; then
echo "**** Installing all pip packages ****"
python3 -m pip install -U pip wheel setuptools
if [ -f /usr/bin/apt ]; then
PIP_ARGS="-f https://wheel-index.linuxserver.io/ubuntu/"
elif [ -f /usr/bin/apk ]; then
ALPINE_VER=$(cat /etc/apk/repositories | grep main | sed 's|.*alpine/v||' | sed 's|/main.*||')
if [ "${ALPINE_VER}" = "3.14" ]; then
PIP_ARGS="-f https://wheel-index.linuxserver.io/alpine/"
else
PIP_ARGS="-f https://wheel-index.linuxserver.io/alpine-${ALPINE_VER}/"
fi
fi
python3 -m pip install ${PIP_ARGS} \
$(cat /mod-pip-packages-to-install.list)
fi
rm -rf \
/mod-repo-packages-to-install.list \
/mod-pip-packages-to-install.list

View File

@ -0,0 +1 @@
oneshot

View File

@ -0,0 +1 @@
/etc/s6-overlay/s6-rc.d/init-mod-package-install/run