Remove output suppression from install script
- All commands now show their output for debugging - Use PATH-based e2fsck/resize2fs instead of hardcoded /usr/sbin/ - Add error checks with meaningful messages at each step - set -e in chroot to fail fast on errors Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -237,15 +237,15 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|||||||
|
|
||||||
log "Installing npm dependencies..."
|
log "Installing npm dependencies..."
|
||||||
cd "$SCRIPT_DIR"
|
cd "$SCRIPT_DIR"
|
||||||
npm install --silent 2>/dev/null
|
npm install || err "npm install failed"
|
||||||
ok "Dependencies installed"
|
ok "Dependencies installed"
|
||||||
|
|
||||||
log "Building TypeScript..."
|
log "Building TypeScript..."
|
||||||
npm run build 2>/dev/null
|
npm run build || err "npm run build failed"
|
||||||
ok "Build complete"
|
ok "Build complete"
|
||||||
|
|
||||||
log "Linking global command..."
|
log "Linking global command..."
|
||||||
sudo npm link 2>/dev/null
|
sudo npm link || err "npm link failed"
|
||||||
ok "fireclaw command available globally"
|
ok "fireclaw command available globally"
|
||||||
|
|
||||||
log "Running fireclaw setup (kernel + base rootfs + bridge + SSH keys)..."
|
log "Running fireclaw setup (kernel + base rootfs + bridge + SSH keys)..."
|
||||||
@@ -264,20 +264,26 @@ else
|
|||||||
log "Creating 1G agent rootfs from Alpine base..."
|
log "Creating 1G agent rootfs from Alpine base..."
|
||||||
cp "$FIRECLAW_DIR/base-rootfs.ext4" /tmp/agent-build.ext4
|
cp "$FIRECLAW_DIR/base-rootfs.ext4" /tmp/agent-build.ext4
|
||||||
truncate -s 1G /tmp/agent-build.ext4
|
truncate -s 1G /tmp/agent-build.ext4
|
||||||
sudo /usr/sbin/e2fsck -fy /tmp/agent-build.ext4 >/dev/null 2>&1
|
|
||||||
sudo /usr/sbin/resize2fs /tmp/agent-build.ext4 >/dev/null 2>&1
|
log " Checking filesystem..."
|
||||||
|
sudo e2fsck -fy /tmp/agent-build.ext4 || err "e2fsck failed. Is e2fsprogs installed?"
|
||||||
|
|
||||||
|
log " Resizing to 1G..."
|
||||||
|
sudo resize2fs /tmp/agent-build.ext4 || err "resize2fs failed."
|
||||||
ok "Image resized to 1G"
|
ok "Image resized to 1G"
|
||||||
|
|
||||||
mkdir -p /tmp/agent-build-mnt
|
mkdir -p /tmp/agent-build-mnt
|
||||||
sudo mount /tmp/agent-build.ext4 /tmp/agent-build-mnt
|
sudo mount /tmp/agent-build.ext4 /tmp/agent-build-mnt || err "Failed to mount agent rootfs"
|
||||||
|
|
||||||
log "Installing packages (openssh, python3, podman, curl, jq, bash)..."
|
log "Installing Alpine packages (openssh, python3, podman, curl, jq, bash)..."
|
||||||
|
log " This may take a minute..."
|
||||||
sudo chroot /tmp/agent-build-mnt sh -c '
|
sudo chroot /tmp/agent-build-mnt sh -c '
|
||||||
apk update >/dev/null 2>&1
|
set -e
|
||||||
apk add --no-cache openssh-server ca-certificates curl jq python3 bash openrc podman iptables >/dev/null 2>&1
|
apk update
|
||||||
rc-update add sshd default 2>/dev/null
|
apk add --no-cache openssh-server ca-certificates curl jq python3 bash openrc podman iptables
|
||||||
rc-update add cgroups boot 2>/dev/null
|
rc-update add sshd default
|
||||||
ssh-keygen -A 2>/dev/null
|
rc-update add cgroups boot
|
||||||
|
ssh-keygen -A
|
||||||
echo "PermitRootLogin prohibit-password" >> /etc/ssh/sshd_config
|
echo "PermitRootLogin prohibit-password" >> /etc/ssh/sshd_config
|
||||||
adduser -D -h /home/agent -s /bin/bash agent
|
adduser -D -h /home/agent -s /bin/bash agent
|
||||||
echo "root:100000:65536" > /etc/subuid
|
echo "root:100000:65536" > /etc/subuid
|
||||||
@@ -289,7 +295,7 @@ else
|
|||||||
echo "netns = \"host\"" >> /etc/containers/containers.conf
|
echo "netns = \"host\"" >> /etc/containers/containers.conf
|
||||||
echo "[storage]" > /etc/containers/storage.conf
|
echo "[storage]" > /etc/containers/storage.conf
|
||||||
echo "driver = \"vfs\"" >> /etc/containers/storage.conf
|
echo "driver = \"vfs\"" >> /etc/containers/storage.conf
|
||||||
'
|
' || err "Failed to install packages in chroot"
|
||||||
ok "Alpine packages installed"
|
ok "Alpine packages installed"
|
||||||
|
|
||||||
log "Installing agent script and config..."
|
log "Installing agent script and config..."
|
||||||
|
|||||||
Reference in New Issue
Block a user