mirror of
https://github.com/trycua/computer.git
synced 2026-01-02 19:40:18 -06:00
Merge pull request #137 from trycua/fix/lume/sudo-install-script
[Lume] Update lume install location
This commit is contained in:
@@ -44,7 +44,7 @@
|
||||
If you only need the virtualization capabilities:
|
||||
|
||||
```bash
|
||||
sudo /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/trycua/cua/main/libs/lume/scripts/install.sh)"
|
||||
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/trycua/cua/main/libs/lume/scripts/install.sh)"
|
||||
```
|
||||
|
||||
For Lume usage instructions, refer to the [Lume documentation](./libs/lume/README.md).
|
||||
@@ -54,7 +54,7 @@ If you want to use AI agents with virtualized environments:
|
||||
|
||||
1. Install the Lume CLI:
|
||||
```bash
|
||||
sudo /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/trycua/cua/main/libs/lume/scripts/install.sh)"
|
||||
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/trycua/cua/main/libs/lume/scripts/install.sh)"
|
||||
```
|
||||
|
||||
2. Pull the latest macOS CUA image:
|
||||
|
||||
@@ -10,25 +10,75 @@ NORMAL=$(tput sgr0)
|
||||
RED=$(tput setaf 1)
|
||||
GREEN=$(tput setaf 2)
|
||||
BLUE=$(tput setaf 4)
|
||||
YELLOW=$(tput setaf 3)
|
||||
|
||||
# Default installation directory
|
||||
DEFAULT_INSTALL_DIR="/usr/local/bin"
|
||||
# Default installation directory (user-specific, doesn't require sudo)
|
||||
DEFAULT_INSTALL_DIR="$HOME/.local/bin"
|
||||
INSTALL_DIR="${INSTALL_DIR:-$DEFAULT_INSTALL_DIR}"
|
||||
|
||||
# GitHub info
|
||||
GITHUB_REPO="trycua/cua"
|
||||
LATEST_RELEASE_URL="https://api.github.com/repos/$GITHUB_REPO/releases/latest"
|
||||
|
||||
# Parse command line arguments
|
||||
while [ "$#" -gt 0 ]; do
|
||||
case "$1" in
|
||||
--install-dir=*)
|
||||
INSTALL_DIR="${1#*=}"
|
||||
;;
|
||||
--help)
|
||||
echo "${BOLD}${BLUE}Lume Installer${NORMAL}"
|
||||
echo "Usage: $0 [OPTIONS]"
|
||||
echo ""
|
||||
echo "Options:"
|
||||
echo " --install-dir=DIR Install to the specified directory (default: $DEFAULT_INSTALL_DIR)"
|
||||
echo " --help Display this help message"
|
||||
echo ""
|
||||
echo "Examples:"
|
||||
echo " $0 # Install to $DEFAULT_INSTALL_DIR"
|
||||
echo " $0 --install-dir=/usr/local/bin # Install to system directory (may require root privileges)"
|
||||
echo " INSTALL_DIR=/opt/lume $0 # Install to /opt/lume (legacy env var support)"
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
echo "${RED}Unknown option: $1${NORMAL}"
|
||||
echo "Use --help for usage information"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
echo "${BOLD}${BLUE}Lume Installer${NORMAL}"
|
||||
echo "This script will install Lume to your system."
|
||||
|
||||
# Check if we're running with appropriate permissions
|
||||
check_permissions() {
|
||||
if [ "$INSTALL_DIR" = "$DEFAULT_INSTALL_DIR" ] && [ "$(id -u)" != "0" ]; then
|
||||
echo "${RED}Error: Installing to $INSTALL_DIR requires root privileges.${NORMAL}"
|
||||
echo "Please run with sudo or specify a different directory with INSTALL_DIR environment variable."
|
||||
echo "Example: INSTALL_DIR=\$HOME/.local/bin $0"
|
||||
exit 1
|
||||
# System directories that typically require root privileges
|
||||
SYSTEM_DIRS=("/usr/local/bin" "/usr/bin" "/bin" "/opt")
|
||||
|
||||
NEEDS_ROOT=false
|
||||
for DIR in "${SYSTEM_DIRS[@]}"; do
|
||||
if [[ "$INSTALL_DIR" == "$DIR"* ]] && [ ! -w "$INSTALL_DIR" ]; then
|
||||
NEEDS_ROOT=true
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
if [ "$NEEDS_ROOT" = true ]; then
|
||||
echo "${YELLOW}Warning: Installing to $INSTALL_DIR may require root privileges.${NORMAL}"
|
||||
echo "Consider these alternatives:"
|
||||
echo " • Install to a user-writable location: $0 --install-dir=$HOME/.local/bin"
|
||||
echo " • Create the directory with correct permissions first:"
|
||||
echo " sudo mkdir -p $INSTALL_DIR && sudo chown $(whoami) $INSTALL_DIR"
|
||||
echo ""
|
||||
|
||||
# Check if we already have write permission (might have been set up previously)
|
||||
if [ ! -w "$INSTALL_DIR" ] && [ ! -w "$(dirname "$INSTALL_DIR")" ]; then
|
||||
echo "${RED}Error: You don't have write permission to $INSTALL_DIR${NORMAL}"
|
||||
echo "Please choose a different installation directory or ensure you have the proper permissions."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -123,8 +173,8 @@ install_binary() {
|
||||
|
||||
# Check if the installation directory is in PATH
|
||||
if [ -n "${PATH##*$INSTALL_DIR*}" ]; then
|
||||
echo "${RED}Warning: $INSTALL_DIR is not in your PATH.${NORMAL}"
|
||||
echo "You may need to add it to your shell profile:"
|
||||
echo "${YELLOW}Warning: $INSTALL_DIR is not in your PATH.${NORMAL}"
|
||||
echo "To add it, run one of these commands based on your shell:"
|
||||
echo " For bash: echo 'export PATH=\"\$PATH:$INSTALL_DIR\"' >> ~/.bash_profile"
|
||||
echo " For zsh: echo 'export PATH=\"\$PATH:$INSTALL_DIR\"' >> ~/.zshrc"
|
||||
echo " For fish: echo 'fish_add_path $INSTALL_DIR' >> ~/.config/fish/config.fish"
|
||||
|
||||
@@ -67,7 +67,7 @@
|
||||
"For installing the standalone lume binary, run the following command from a terminal:\n",
|
||||
"\n",
|
||||
"```bash\n",
|
||||
"sudo /bin/bash -c \"$(curl -fsSL https://raw.githubusercontent.com/trycua/cua/main/libs/lume/scripts/install.sh)\"\n",
|
||||
"/bin/bash -c \"$(curl -fsSL https://raw.githubusercontent.com/trycua/cua/main/libs/lume/scripts/install.sh)\"\n",
|
||||
"```"
|
||||
]
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user