NEXS build script

From OLPC
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

The following script is used to build the NEXS .iso image:

#!/bin/bash
#mkdir /tmp/pakcages
#cd /tmp/packages 
###### WE need to place all the needed rpms and the iso image in this directory itself
echo 'Please make sure that the OLPC_XS_O_4.is and all the necessary rpms are present in /tmp/pakcages'
echo "Downloading XS ISO"
#/usr/bin/wget -c http://xs-dev.laptop.org/xs/OLPC_XS_0_4.iso
echo "done "
echo "Installing needed rpms"
/usr/bin/yum -y install squashfs-tools livecd-tools > /dev/null 2>&1
echo 'executing mkdir /mnt/t '
mkdir /mnt/t
echo ' Mounting original iso image at /mnt/t :  mount -o loop,ro -t iso9660 OLPC_XS_0_4.iso  /mnt/t'
mount -o loop,ro -t iso9660 OLPC_XS_0_4.iso  /mnt/t
echo
echo ' making temporary directory -> /tmp/work'
mkdir /tmp/work
echo " Copying  the contents of the ISO images to  /tmp/work by executing cp -varfp /mnt/t/* /root/work/  command "
cp -varfp /mnt/t/* /tmp/work/ > /dev/null 2>&1 
echo ' Unmounting original iso image at /mnt/t :  umount /mnt/t'
umount /mnt/t
cd /tmp/work
echo 'Unsuqashing squashfs.img'
/usr/sbin/unsquashfs squashfs.img > /dev/null 2>&1 
echo "Creating /mnt/os and mounting the os.img file in /mnt/os  in r/w mode"
mkdir -p /mnt/os 
mount -o loop,rw squashfs-root/os.img /mnt/os
echo 'Installing  RPMS : dansguardian-2.10.0.1-1.fc7.i386.rpm mysql-libs-5.0.45-1.fc7.i386.rpm  pcre-devel-7.0-2.i386.rpm
            php-mysql5.2.4-1.fc7.i386.rpm'
rpm -ivh /tmp/packages/*.rpm --root /mnt/os/ > /dev/null 2>&1 
echo " Done "
cd /tmp/packages/
echo  "Copying httpd.conf file"
/bin/cp -varf httpd.conf /mnt/os/etc/httpd/conf/httpd.conf 
echo "Copying moodle data"
########## Tony will make changes here:::
## currently i am copying old contents to test the script
#tar -zxpf www.tar.gz 
#/bin/cp -varfp www/* /mnt/os/var/www/
chown apache:apache -R /mnt/os/var/www/*
########
echo "Configuring squid/dansguardian/ejabberd"
/bin/cp ejabberd.cfg /mnt/os/etc/ejabberd/ejabberd.cfg
/bin/cp -varf rc.local /mnt/os/etc/
cp squid-xs.conf /mnt/os/etc/squid/
mkdir /mnt/os/library/cache
chown squid:squid /mnt/os/library/cache
mkdir -p /mnt/os/var/log/dansguardian
touch /mnt/os/var/log/dansguardian/access.log
#tar -jxpvf blacklists.tar.bz2 -C /mnt/os/etc/dansguardian/
###/bin/cp -varfp dansguardian*conf /mnt/os/etc/dansguardian/
chown nobody: -R /mnt/os/var/log/dansguardian/*
echo " DONE "
echo "Copying post installation scripts"
/bin/cp -varf  anaconda-ks.cfg /mnt/os/root/
/bin/cp -varf  squid-xs.conf /mnt/os/root/
/bin/cp -varf  ejabberd.cfg /mnt/os/root
/bin/cp -varf  install.sh /mnt/os/root/
/bin/cp -varf  mysql.dump.latest.sql /mnt/os/root/
echo " DONE "
echo "Unmounting temporary filesystem"
/bin/umount /mnt/os/
/bin/rm -rf /tmp/work/squashfs.img 
cd /tmp/work/
echo "Creating NEW squashfs.img "
mksquashfs squashfs-root squashfs.img 
rm -rf squashfs-root
echo "Creating New ISO image"
mkisofs -o ./live.iso -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -J -r -hide-rr-moved -V
  "OLPC_XS_0_4" .
echo "DONE"
echo "Please check /tmp/work for the ISO Image called live.iso"
echo "Cleaning up /tmp/packages"
###/bin/rm -rf /tmp/packages