Add chown to set deployed files to current user instead of leaving them owned by root. This matches the original copy_to_apt.sh behavior. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
43 lines
1.1 KiB
Bash
Executable File
43 lines
1.1 KiB
Bash
Executable File
#!/bin/bash
|
|
set -e
|
|
|
|
DEPLOY_DIR="${1:-/opt/jrunner}"
|
|
|
|
# Prevent deleting critical system directories
|
|
case "${DEPLOY_DIR}" in
|
|
/|/bin|/boot|/dev|/etc|/lib|/lib64|/proc|/root|/run|/sbin|/sys|/usr|/var)
|
|
echo "Error: Cannot deploy to system directory: ${DEPLOY_DIR}"
|
|
exit 1
|
|
;;
|
|
esac
|
|
|
|
if [ ! -d "${DEPLOY_DIR}" ]; then
|
|
echo "Error: Directory does not exist: ${DEPLOY_DIR}"
|
|
echo "Create it first: sudo mkdir -p ${DEPLOY_DIR}"
|
|
exit 1
|
|
fi
|
|
|
|
echo "Building jrunner..."
|
|
./gradlew build
|
|
|
|
echo "Extracting to temporary location..."
|
|
sudo rm -rf /tmp/jrunner
|
|
sudo unzip -q jrunner/build/distributions/jrunner.zip -d /tmp/
|
|
|
|
echo "Deploying to ${DEPLOY_DIR}..."
|
|
sudo rm -rf "${DEPLOY_DIR}"/*
|
|
sudo mv /tmp/jrunner/* "${DEPLOY_DIR}"/
|
|
sudo rm -rf /tmp/jrunner
|
|
|
|
echo "Fixing ownership..."
|
|
sudo chown -R $USER:$USER "${DEPLOY_DIR}"
|
|
|
|
# Only create symlink for /opt/jrunner
|
|
if [ "${DEPLOY_DIR}" = "/opt/jrunner" ]; then
|
|
echo "Creating symlink..."
|
|
sudo ln -sf /opt/jrunner/bin/jrunner /usr/local/bin/jrunner
|
|
fi
|
|
|
|
echo "✅ Deployed to ${DEPLOY_DIR}"
|
|
echo "Run '${DEPLOY_DIR}/bin/jrunner --help' to test"
|