diff options
Diffstat (limited to 'create_image.sh')
-rwxr-xr-x | create_image.sh | 38 |
1 files changed, 25 insertions, 13 deletions
diff --git a/create_image.sh b/create_image.sh index 2da2d6f..3858dac 100755 --- a/create_image.sh +++ b/create_image.sh @@ -52,11 +52,20 @@ LOG_FILE="${IMAGE_WORK_PATH}/log.txt" TOOL_RES_PATH=${RUNNING_DIRECTORY}/res NUM_JOBS=$(( `grep -c processor /proc/cpuinfo`+1 )) -STAGE3_URL="http://distribution.hexxeh.net/gentoo/stage3-i686-latest.tar.bz2" -PORTAGE_URL="http://distribution.hexxeh.net/gentoo/portage-latest.tar.bz2" -BINHOST_URL="http://tinderbox.dev.gentoo.org/default-linux/x86" EMERGE_PROXY="${FLAGS_proxy}" +if [ -z ${STAGE3_URL} ]; then + STAGE3_URL="http://distribution.hexxeh.net/gentoo/stage3-i686-latest.tar.bz2" +fi + +if [ -z ${PORTAGE_URL} ]; then + PORTAGE_URL="http://distribution.hexxeh.net/gentoo/portage-latest.tar.bz2" +fi + +if [ -z ${BINHOST_URL} ]; then + BINHOST_URL="http://tinderbox.dev.gentoo.org/default-linux/x86" +fi + # Clean up old mounts cleanup_mounts() { sleep 2 @@ -191,19 +200,22 @@ linux32 chroot . /bin/bash /etc/profile &>> ${LOG_FILE} echo "Step 13: Setting timezone to ${TIMEZONE}" linux32 chroot . cp /usr/share/zoneinfo/${TIMEZONE} /etc/localtime &>> ${LOG_FILE} -echo "Step 14: Setting hostname to ${HOSTNAME}" +echo "Step 14: Setting keyboard layout to ${KEYBOARD}" +linux32 chroot . sed -i -e "s/keymap=.*/keymap=\"${KEYBOARD}\"/" /etc/conf.d/keymaps &>> ${LOG_FILE} + +echo "Step 15: Setting hostname to ${HOSTNAME}" linux32 chroot . /bin/bash -c "echo hostname='${HOSTNAME}' > /etc/conf.d/hostname" &>> ${LOG_FILE} linux32 chroot . /bin/bash -c "echo 127.0.0.1 ${HOSTNAME}.local ${HOSTNAME} localhost > /etc/hosts" &>> ${LOG_FILE} -echo "Step 15: Copying new fstab" +echo "Step 16: Copying new fstab" cp ${TOOL_RES_PATH}/fstab etc/fstab &>> ${LOG_FILE} -echo "Step 16: Setting up networking" +echo "Step 17: Setting up networking" echo 'config_eth0=( "dhcp" )' > etc/conf.d/net cp etc/init.d/net.lo etc/init.d/net.eth0 linux32 chroot . rc-update add net.eth0 default &>> ${LOG_FILE} -echo "Step 17: Setting up kernel" +echo "Step 18: Setting up kernel" # If we got the flag, used a cached kernel to reduce build times for testing if [[ ${FLAGS_cachedkernel} -eq ${FLAGS_TRUE} ]]; then echo "Using cached kernel" &>> ${LOG_FILE} @@ -227,16 +239,16 @@ else cp usr/src/linux/arch/i386/boot/bzImage boot/kernel &>> ${LOG_FILE} || handle_error "Error copying kernel" fi -echo "Step 18: Setting root password" +echo "Step 19: Setting root password" linux32 chroot . /bin/bash -c "echo 'root:${ROOT_PASSWORD}' | chpasswd" &>> ${LOG_FILE} || handle_error "Error setting root password" -echo "Step 19: Processing packages list" +echo "Step 20: Processing packages list" for PACKAGE in ${PACKAGES_LIST}; do echo "Installing ${PACKAGE}" &>> ${LOG_FILE} linux32 chroot . emerge --jobs=${NUM_JOBS} ${PACKAGE} &>> ${LOG_FILE} || handle_error "Error emerging ${PACKAGE}" done -echo "Step 20: Adding default user" +echo "Step 21: Adding default user" linux32 chroot . useradd -g users -G lp,wheel,audio,cdrom,portage -m ${DEFAULT_USERNAME} || handle_error "Error adding default user" linux32 chroot . /bin/bash -c "echo '${DEFAULT_USERNAME}:${DEFAULT_PASSWORD}' | chpasswd" &>> ${LOG_FILE} || handle_error "Error setting default user password" @@ -249,13 +261,13 @@ then linux32 chroot . usermod -a vboxguest ${DEFAULT_USERNAME} fi -echo "Step 21: Cleaning up make.conf" +echo "Step 22: Cleaning up make.conf" if [ -n ${EMERGE_PROXY} ]; then sed -i '/http_proxy/ d' etc/make.conf fi sed -i '/MAKEOPTS/ d' etc/make.conf -echo "Step 22: Installing extlinux" +echo "Step 23: Installing extlinux" extlinux --heads 255 --sectors 63 --install boot &>> ${LOG_FILE} || handle_error "Error installing extlinux" dd if=/usr/lib/extlinux/mbr.bin of=../${IMAGE_NAME} conv=notrunc &>> ${LOG_FILE} || handle_error "Error copying extlinux MBR" cp ${TOOL_RES_PATH}/extlinux.conf boot/ || handle_error "Error copying extlinux configuration" @@ -291,6 +303,6 @@ if [[ ${FLAGS_compress} -eq ${FLAGS_TRUE} ]]; then IMAGE_OUT="${BUILD_ID}.tar.gz" fi -echo "Step 23: Image build completed!" +echo "Step 24: Image build completed!" echo "Your image is here: ${IMAGES_OUTPUT_PATH}/${IMAGE_OUT}" echo "Your log file is here: ${IMAGES_OUTPUT_PATH}/${BUILD_ID}.log" |