File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -86,8 +86,17 @@ curl -sfL https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/inst
8686# Verify installation
8787trivy --version
8888
89- # Set up shared TRIVY_HOME so plugins are available to all users
89+ # Set up shared TRIVY_HOME so plugins are available to all users.
90+ # Create a wrapper script that ensures TRIVY_HOME is always set, regardless
91+ # of how trivy is invoked (login shell, non-interactive sh -c, etc.).
9092mkdir -p " ${TRIVY_HOME} "
93+ mv /usr/local/bin/trivy /usr/local/bin/trivy-real
94+ cat > /usr/local/bin/trivy << WRAPPER
95+ #!/bin/sh
96+ export TRIVY_HOME="\$ {TRIVY_HOME:-${TRIVY_HOME} }"
97+ exec /usr/local/bin/trivy-real "\$ @"
98+ WRAPPER
99+ chmod +x /usr/local/bin/trivy
91100export TRIVY_HOME
92101
93102# Install plugins if specified
@@ -96,9 +105,6 @@ if [ -n "${TRIVY_PLUGINS}" ]; then
96105 install_plugins " ${TRIVY_PLUGINS} "
97106fi
98107
99- # Ensure TRIVY_HOME is set for all users at runtime
100- echo " export TRIVY_HOME=${TRIVY_HOME} " > /etc/profile.d/trivy.sh
101- chmod +x /etc/profile.d/trivy.sh
102108chmod -R a+rX " ${TRIVY_HOME} "
103109
104110# Clean up
You can’t perform that action at this time.
0 commit comments