Nightly Rawhide LiveCD script

Warren Togami warren at togami.com
Tue Jul 28 01:32:07 UTC 2009


Somebody asked for my crappy script to generate a rawhide LiveCD that 
can be scheduled in cron.  This script sucks.  Suggest improvements if 
you want.

One big improvement that could be written is a rawhide timestamp 
checker, so the script would run more often in cron and detect when the 
rawhide tree had actually changed, and only then generate new images. 
Otherwise you can only schedule it daily and generate images of whatever 
happens to be in rawhide at that moment, even if it hasn't changed since 
the previous day or rawhide compose hasn't finished yet.

#!/bin/bash

# Check for running livecd-creator and abort if it is running
if ps -ef |grep -v grep |grep -q livecd-creator; then
     echo "ERROR: Another livecd-creator is still running.  Aborting."
     exit 255
fi

if [ ! -d /root/spin-kickstarts/ ]; then
     cd /root
     git clone http://git.fedorahosted.org/git/spin-kickstarts.git
fi

cd /root/spin-kickstarts/
git reset --hard
git pull
sed -i 's/^-fedora-logos/fedora-logos/' fedora-livecd-desktop.ks
sed -i 's/^generic-logos//' fedora-livecd-desktop.ks

# Separate --cache directories because they will otherwise confuse each 
other
DATE=`date +%Y%m%d.%H`
cd /var/www/html/images/nightly/
setarch i386 livecd-creator --cache=/var/cache/i386/ \
                -c /root/spin-kickstarts/fedora-livecd-desktop.ks -f 
desktop-i386-$DATE    > log/desktop-i386-$DATE.log 2>&1
if [ $? -ne 0 ]; then
     echo "ERROR: Desktop i386 live image failed to compose."
     exit 255
fi
livecd-creator --cache=/var/cache/x86_64/ \
                -c /root/spin-kickstarts/fedora-livecd-desktop.ks -f 
desktop-x86_64-$DATE    > log/desktop-x86_64-$DATE.log 2>&1
if [ $? -ne 0 ]; then
     echo "ERROR: Desktop x86_64 live image failed to compose."
     exit 255
fi

# Delete nightly images older than 15 days
find /var/www/html/images/nightly/ -name 'desktop-*' -mtime 15 -exec rm 
-f '{}' \;

# Allow apache to read the generated images
restorecon -R /var/www/html/images/nightly




More information about the fedora-devel-list mailing list