create a rootful, privileged distrobox container (#47)
This commit is contained in:
@@ -122,6 +122,8 @@ if ! distrobox list 2>/dev/null | grep -q "$CONTAINER"; then
|
|||||||
distrobox create \
|
distrobox create \
|
||||||
--image docker.io/library/archlinux:latest \
|
--image docker.io/library/archlinux:latest \
|
||||||
--name "$CONTAINER" \
|
--name "$CONTAINER" \
|
||||||
|
--root \
|
||||||
|
--additional-flags "--privileged --security-opt seccomp=unconfined" \
|
||||||
--pre-init-hooks "sed -i 's/^SigLevel.*/SigLevel = Never/' /etc/pacman.conf && pacman -Sy --noconfirm archlinux-keyring && pacman-key --init && pacman-key --populate archlinux && sed -i 's/^SigLevel.*/SigLevel = Required DatabaseOptional/' /etc/pacman.conf"
|
--pre-init-hooks "sed -i 's/^SigLevel.*/SigLevel = Never/' /etc/pacman.conf && pacman -Sy --noconfirm archlinux-keyring && pacman-key --init && pacman-key --populate archlinux && sed -i 's/^SigLevel.*/SigLevel = Required DatabaseOptional/' /etc/pacman.conf"
|
||||||
log_success "Container '$CONTAINER' created"
|
log_success "Container '$CONTAINER' created"
|
||||||
else
|
else
|
||||||
@@ -130,7 +132,7 @@ fi
|
|||||||
|
|
||||||
# Install packages inside the container
|
# Install packages inside the container
|
||||||
log_info "Installing packages inside container (this may take a few minutes)..."
|
log_info "Installing packages inside container (this may take a few minutes)..."
|
||||||
distrobox enter "$CONTAINER" -- bash -c '
|
distrobox enter --root "$CONTAINER" -- bash -c '
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
# Install build dependencies
|
# Install build dependencies
|
||||||
@@ -181,19 +183,19 @@ mkdir -p "$BIN_DIR"
|
|||||||
|
|
||||||
cat > "$BIN_DIR/start-simd" << 'EOF'
|
cat > "$BIN_DIR/start-simd" << 'EOF'
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
exec distrobox enter simracing -- simd "$@"
|
exec distrobox enter --root simracing -- simd "$@"
|
||||||
EOF
|
EOF
|
||||||
chmod +x "$BIN_DIR/start-simd"
|
chmod +x "$BIN_DIR/start-simd"
|
||||||
|
|
||||||
cat > "$BIN_DIR/start-monocoque" << 'EOF'
|
cat > "$BIN_DIR/start-monocoque" << 'EOF'
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
exec distrobox enter simracing -- monocoque play "$@"
|
exec distrobox enter --root simracing -- monocoque play "$@"
|
||||||
EOF
|
EOF
|
||||||
chmod +x "$BIN_DIR/start-monocoque"
|
chmod +x "$BIN_DIR/start-monocoque"
|
||||||
|
|
||||||
cat > "$BIN_DIR/test-monocoque" << 'EOF'
|
cat > "$BIN_DIR/test-monocoque" << 'EOF'
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
exec distrobox enter simracing -- monocoque test -vv "$@"
|
exec distrobox enter --root simracing -- monocoque test -vv "$@"
|
||||||
EOF
|
EOF
|
||||||
chmod +x "$BIN_DIR/test-monocoque"
|
chmod +x "$BIN_DIR/test-monocoque"
|
||||||
|
|
||||||
|
|||||||
@@ -72,9 +72,9 @@ if [ -d "$INSTALL_DIR" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Remove distrobox container
|
# Remove distrobox container
|
||||||
if distrobox list 2>/dev/null | grep -q "$CONTAINER"; then
|
if distrobox list --root 2>/dev/null | grep -q "$CONTAINER"; then
|
||||||
log_info "Removing distrobox container '$CONTAINER'..."
|
log_info "Removing distrobox container '$CONTAINER'..."
|
||||||
distrobox rm --force "$CONTAINER"
|
distrobox rm --root --force "$CONTAINER"
|
||||||
log_success "Container '$CONTAINER' removed"
|
log_success "Container '$CONTAINER' removed"
|
||||||
else
|
else
|
||||||
log_info "Container '$CONTAINER' not found, skipping"
|
log_info "Container '$CONTAINER' not found, skipping"
|
||||||
|
|||||||
Reference in New Issue
Block a user