support full s6v3 images

This commit is contained in:
aptalca
2022-10-02 21:13:54 -04:00
parent 099c2309f3
commit 404fb22814
@@ -8,11 +8,23 @@ if [ -f /usr/bin/npm ]; then
echo "setting npm to global folder in /config"
npm config set prefix '/config/npm-global'
if grep -q "/config/npm-global/bin" "/etc/services.d/code-server/run"; then
echo "npm-global already in PATH"
else
if grep -q "/config/npm-global/bin" "/etc/services.d/code-server/run" 2>/dev/null || \
grep -q "/config/npm-global/bin" "/etc/services.d/openvscode-server/run" 2>/dev/null || \
grep -q "/config/npm-global/bin" "/etc/s6-overlay/s6-rc.d/svc-code-server/run" 2>/dev/null || \
grep -q "/config/npm-global/bin" "/etc/s6-overlay/s6-rc.d/svc-openvscode-server/run" 2>/dev/null; then
echo "npm-global already in PATH"
elif [ -f "/etc/services.d/code-server/run" ]; then
echo "ensuring npm-global is in PATH"
sed -i '/^#!\/usr\/bin/a \\n# Added by codeserver-npmglobal\nexport PATH=/config/npm-global/bin:$PATH' /etc/services.d/code-server/run
elif [ -f "/etc/services.d/openvscode-server/run" ]; then
echo "ensuring npm-global is in PATH"
sed -i '/^#!\/usr\/bin/a \\n# Added by codeserver-npmglobal\nexport PATH=/config/npm-global/bin:$PATH' /etc/services.d/openvscode-server/run
elif [ -f "/etc/s6-overlay/s6-rc.d/svc-code-server/run" ]; then
echo "ensuring npm-global is in PATH"
sed -i '/^#!\/usr\/bin/a \\n# Added by codeserver-npmglobal\nexport PATH=/config/npm-global/bin:$PATH' /etc/s6-overlay/s6-rc.d/svc-code-server/run
elif [ -f "/etc/s6-overlay/s6-rc.d/svc-openvscode-server/run" ]; then
echo "ensuring npm-global is in PATH"
sed -i '/^#!\/usr\/bin/a \\n# Added by codeserver-npmglobal\nexport PATH=/config/npm-global/bin:$PATH' /etc/s6-overlay/s6-rc.d/svc-openvscode-server/run
fi
else
echo "**** npm not installed, skipping npmglobal install ****"