updates
This commit is contained in:
61
docs/default-prep.sh
Executable file
61
docs/default-prep.sh
Executable file
@@ -0,0 +1,61 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
echo "Preparing standard golden image..."
|
||||
|
||||
# NOTE: This script runs inside virt-customize (offline mode)
|
||||
# Cannot use systemctl, firewall-cmd, or other D-Bus dependent commands
|
||||
# Use systemctl enable only (works offline), or direct file manipulation
|
||||
|
||||
# Update system (optional - can be slow)
|
||||
# Uncomment if you want latest packages:
|
||||
# dnf update -y
|
||||
|
||||
# Install common testing dependencies including Raku/Sparrowdo
|
||||
dnf install -y \
|
||||
perl \
|
||||
git \
|
||||
wget \
|
||||
tar \
|
||||
openssh-server \
|
||||
vim \
|
||||
rakudo \
|
||||
rakudo-zef
|
||||
|
||||
# Enable services (these work in offline mode)
|
||||
# systemctl enable works by creating symlinks, no D-Bus needed
|
||||
systemctl enable sshd
|
||||
|
||||
# Create rocky user (standard non-root user for Rocky Linux)
|
||||
useradd -m rocky 2>/dev/null || true
|
||||
echo "rocky:rockypass" | chpasswd
|
||||
|
||||
# Add rocky user to sudoers
|
||||
echo "rocky ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers.d/rocky
|
||||
chmod 0440 /etc/sudoers.d/rocky
|
||||
|
||||
# Install Sparrowdo for rocky user
|
||||
# Note: This needs to run as rocky user, but we're in offline mode
|
||||
# So we prepare the environment, and actual Sparrowdo install happens on first boot
|
||||
mkdir -p /home/rocky/.sparrowdo-bootstrap
|
||||
cat > /home/rocky/.sparrowdo-bootstrap/install.sh << 'BOOTSTRAP_EOF'
|
||||
#!/bin/bash
|
||||
# This script will be run on first boot by rocky user
|
||||
if [ ! -f /home/rocky/.sparrowdo-installed ]; then
|
||||
zef install --/test Sparrowdo
|
||||
touch /home/rocky/.sparrowdo-installed
|
||||
fi
|
||||
BOOTSTRAP_EOF
|
||||
chmod +x /home/rocky/.sparrowdo-bootstrap/install.sh
|
||||
chown -R rocky:rocky /home/rocky/.sparrowdo-bootstrap
|
||||
|
||||
# Create testuser for backward compatibility
|
||||
useradd -m testuser 2>/dev/null || true
|
||||
echo "testuser:testpass" | chpasswd
|
||||
|
||||
# Add testuser to sudoers
|
||||
echo "testuser ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers.d/testuser
|
||||
chmod 0440 /etc/sudoers.d/testuser
|
||||
|
||||
echo "Golden image preparation complete!"
|
||||
echo "NOTE: Sparrowdo will be installed on first SSH connection by rocky user"
|
||||
Reference in New Issue
Block a user