Skip to content

Commit

Permalink
add versions
Browse files Browse the repository at this point in the history
  • Loading branch information
badra001 committed Feb 2, 2026
1 parent 8deb8cd commit 62dcdde
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 14 deletions.
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
#!/bin/bash

THIS=$(basename $0 .sh)
VERSION="1.0.5"

# --- Configuration ---
APP_DIR="/apps/ansible"
APP_DIR="${1:-/apps/ansible}"
PYTHON_VERSION="3.13"
MAKE_RELOCATABLE=0
VERSION="1.0.5"
OWNER="root"
GROUP="root"
UMASK="022"
# ---------------------

THIS=$(basename $0 .sh)
if [ ! -z "$1" ]
if [ $(id -u) == 0 ]
then
APP_DIR="$1"
IS_ROOT=1
else
IS_ROOT=0
fi

echo "Initializing Ansible Distribution v$VERSION..."
Expand All @@ -26,9 +29,12 @@ export UV_NATIVE_TLS=true

# 1. Prepare Directory
mkdir -p "$APP_DIR"
umask $UMASK
#chown $OWNER:$GROUP "$APP_DIR"
if [ ! -z "$UMASK" ]
then
umask $UMASK
fi
cd "$APP_DIR"
# chown $OWNER:$GROUP "$APP_DIR"

# 2. Initialize project
uv init --no-workspace --app
Expand Down Expand Up @@ -81,7 +87,9 @@ ln -snf .venv/bin bin
# 9. Create /etc/profile.d script
cat <<EOF > ansible_path.sh
# Ansible Distribution Path Configuration
# Copy this to /etc/profile.d/ansible.sh
# version $VERSION
# Copy or link this to /etc/profile.d/ansible.sh
if [ -d "$APP_DIR/bin" ]; then
export PATH="$APP_DIR/bin:\$PATH"
fi
Expand Down
26 changes: 20 additions & 6 deletions local-app/python-tools/build-ansible-distribution/manage_uv.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

THIS=$(basename $0 .sh)
VERSION="1.0.0"
VERSION="1.0.1"

# --- Configuration ---
BASE_DIR="${1:-/apps/uv}"
Expand All @@ -12,14 +12,26 @@ OWNER="root"
GROUP="root"
UMASK="022"

if [ $(id -u) == 0 ]
then
IS_ROOT=1
else
IS_ROOT=0
fi

echo "Initializing Ansible Distribution v$VERSION..."

# Version to install (defaulting to latest if not provided)
UV_VERSION=$(curl -s https://api.github.com/repos/astral-sh/uv/releases/latest | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')
# ---------------------

echo "Installing/Updating uv to version $UV_VERSION in $BASE_DIR..."

# 1. Create Directory Structure
umask $UMASK
if [ ! -z "$UMASK" ]
then
umask $UMASK
fi
mkdir -p "$BASE_DIR/$UV_VERSION" "$CACHE_DIR" "$PYTHON_INST_DIR" "$BIN_DIR"
# chown -R $OWNER:$GROUP "$BASE_DIR"

Expand All @@ -38,6 +50,8 @@ ln -snf "$BASE_DIR/$UV_VERSION/uvx" "$BIN_DIR/uvx"
# 4. Create Environment Configuration File
cat <<EOF > "$BASE_DIR/uv_env.sh"
# uv Environment Configuration
# version $VERSION
export PATH="$BIN_DIR:\$PATH"
export SSL_CERT_FILE=/etc/pki/tls/certs/ca-bundle.crt
export UV_PYTHON_INSTALL_DIR="$PYTHON_INST_DIR"
Expand All @@ -49,10 +63,10 @@ export UV_PYTHON_PREFERENCE=managed
EOF

# 5. Create profile.d entry
cat <<EOF | tee $BASE_DIR/uv.sh > /dev/null
# Load uv settings for all users
source "$BASE_DIR/uv_env.sh"
EOF
#if [ $IS_ROOT == 1 ]
#then
# ln -sf $BASE_DIR/uv_env.sh /etc/profile.d/
#fi

echo "------------------------------------------------"
echo "uv $UV_VERSION installed successfully."
Expand Down

0 comments on commit 62dcdde

Please sign in to comment.