-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·47 lines (37 loc) · 1.63 KB
/
install.sh
File metadata and controls
executable file
·47 lines (37 loc) · 1.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/bin/bash
set -e
echo "Activating AWS CLI custom aliases feature..."
# Install fzf dependency
apt-get update
apt-get install -y --no-install-recommends fzf
apt-get clean
rm -rf /var/lib/apt/lists/*
# Use devcontainer environment variables with fallbacks
USER_HOME="${_REMOTE_USER_HOME:-/root}"
USER_NAME="${_REMOTE_USER:-root}"
# Ensure AWS CLI config directory exists
# Ensure AWS CLI config and alias directories exist
mkdir -p "$USER_HOME/.aws" "$USER_HOME/.aws/cli"
# Copy the custom alias file into the AWS CLI aliases directory
FEATURE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cp "${FEATURE_DIR}/alias" "$USER_HOME/.aws/cli/alias"
# Copy the AWS JIT configuration script to shared location
cp "${FEATURE_DIR}/scripts/configure-aws-jit.sh" /usr/local/share/aws-cli-configure-jit.sh
chmod +x /usr/local/share/aws-cli-configure-jit.sh
# Write feature options to config file for use during onCreate lifecycle hook
mkdir -p /usr/local/etc
cat <<EOF > /usr/local/etc/aws-cli-feature.conf
JIT="${JIT:-false}"
JITADMIN="${JITADMIN:-false}"
JITINTERACTIVE="${JITINTERACTIVE:-false}"
EOF
chmod 644 /usr/local/etc/aws-cli-feature.conf
# Set proper permissions on the alias file and AWS config directory
chmod 644 "$USER_HOME/.aws/cli/alias"
chown -R "$USER_NAME:$USER_NAME" "$USER_HOME/.aws" 2>/dev/null || true
# Copy helpers and on-create script to shared location
cp "${FEATURE_DIR}/helpers.sh" /usr/local/share/aws-cli-helpers.sh
chmod 644 /usr/local/share/aws-cli-helpers.sh
cp "${FEATURE_DIR}/on-create.sh" /usr/local/share/aws-cli-on-create.sh
chmod +x /usr/local/share/aws-cli-on-create.sh
echo "AWS CLI custom aliases installed successfully!"