Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Dengler <martin@martindengler.com>2009-08-24 10:28:13 (GMT)
committer Martin Dengler <martin@martindengler.com>2009-08-24 10:28:13 (GMT)
commite813dfb576a6dc6439dac1facf2c2adc77a210dc (patch)
tree80c0b7b494ff4c2e4935ce88277302214ff5cef8
parentd0c03585a49c0e439160e628cdf170b790bad4df (diff)
parent124bc767b635c2d57750e16b86e17d88f0e26e24 (diff)
merge branch xo-strawberry with mainline
-rw-r--r--BUGS.txt15
-rw-r--r--Makefile33
-rwxr-xr-xbootable-tree-to-removable-img.sh42
-rwxr-xr-xbootable-tree-to-xo.sh41
-rwxr-xr-xbuild27
-rwxr-xr-ximage-digestor.sh72
-rw-r--r--live.py44
-rwxr-xr-xlivecd-iso-to-bootable-tree.sh45
-rwxr-xr-xmake_fake_device.sh71
-rw-r--r--soas-aslo-and-content.ks98
-rw-r--r--soas-xo.ks489
11 files changed, 931 insertions, 46 deletions
diff --git a/BUGS.txt b/BUGS.txt
new file mode 100644
index 0000000..31182e1
--- /dev/null
+++ b/BUGS.txt
@@ -0,0 +1,15 @@
+
+Caveats/Known Issues:
+
+- Camera doesn't work
+ https://bugzilla.redhat.com/show_bug.cgi?id=498900
+
+- SD boots sometimes fail (mount: unknown filesystem type: 'jffs2')
+ https://bugzilla.redhat.com/show_bug.cgi?id=500196
+
+Please reply or comment on the Fedora/Redhat bug report if you see any
+of these.
+
+Before reporting bugs, it'd be nice if one could search the fedora
+bugzilla; start with this bug:
+https://bugzilla.redhat.com/show_bug.cgi?id=461806
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..ac07efe
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,33 @@
+%.done: %.iso %.removable.img.tar.lzma %.tree.tar.lzma %.img %.plc
+ touch $@
+%.iso:
+ livecd-creator --skip-compression --cache=../cache --fslabel $* -c ../soas-xo.ks
+ md5sum $@ > $@.md5sum
+ sha1sum $@ > $@.sha1sum
+%.tree: %.iso
+ ../livecd-iso-to-bootable-tree.sh $^ $@
+ du -sk $@ | cut -f 1 > $@.size.txt
+ chroot $@ rpm -qa | sort > $@.packages.txt
+ chroot $@ rpm -qa --queryformat="%10{SIZE}\t%{NAME}\n" | sort -k1,1n > $@.packages-sizes.txt
+%.tree.tar.lzma: %.tree
+ tar -c -C $^ . | lzma -1 > $@
+ md5sum $@ > $@.md5sum
+ sha1sum $@ > $@.sha1sum
+%.removable.img: %.tree
+ ../bootable-tree-to-removable-img.sh $^ $@
+ du -sk $@ | cut -f 1 > $@.size.txt
+%.removable.img.tar.lzma: %.removable.img
+ tar -c $^ | lzma -1 > $@
+ md5sum $@ > $@.md5sum
+ sha1sum $@ > $@.sha1sum
+%.img: %.tree
+ ../bootable-tree-to-xo.sh $^ $@
+ du -sk $@ | cut -f 1 > $@.size.txt
+ md5sum $@ > $@.md5sum
+ sha1sum $@ > $@.sha1sum
+%.plc: %.img
+ ../image-digestor.sh $^
+
+.PRECIOUS: %.iso %.removable.img %.removable.img.tar.lzma %.tree %.tree.tar.lzma %.img %.plc
+
+
diff --git a/bootable-tree-to-removable-img.sh b/bootable-tree-to-removable-img.sh
new file mode 100755
index 0000000..182345a
--- /dev/null
+++ b/bootable-tree-to-removable-img.sh
@@ -0,0 +1,42 @@
+#!/bin/bash
+
+set -x
+set -e
+set -o pipefail
+
+
+cleanup() {
+ [ -d "$TMP_MNT" ] && rm -rf $TMP_MNT
+}
+
+exitclean() {
+ echo "Cleaning up to exit..."
+ cleanup
+ exit 1
+}
+
+trap exitclean SIGINT SIGTERM
+
+PATH=/sbin:/usr/sbin:$PATH
+
+ROOT=$1
+output=${2:-soas}
+
+echo "Making removable image $ROOT --> $output"
+
+TMP_MNT=$(mktemp -d ./removable.XXXXXX)
+
+device=`../make_fake_device.sh $output`
+mount -t ext2 $device $TMP_MNT
+
+cp -a $ROOT/* $TMP_MNT
+
+umount $TMP_MNT
+losetup -d $device
+
+echo "Done making removable image $ROOT --> $output_stem"
+cleanup
+
+
+
+
diff --git a/bootable-tree-to-xo.sh b/bootable-tree-to-xo.sh
new file mode 100755
index 0000000..c105c43
--- /dev/null
+++ b/bootable-tree-to-xo.sh
@@ -0,0 +1,41 @@
+#!/bin/bash
+
+set -x
+set -e
+
+PATH=/sbin:/usr/sbin:$PATH
+
+cleanup() {
+ [ -d "$TMP_MNT" ] && rm -rf $TMP_MNT
+}
+
+exitclean() {
+ echo "Cleaning up to exit..."
+ cleanup
+ exit 1
+}
+
+trap exitclean SIGINT SIGTERM
+
+
+echo "Build jffs2 image $IMG"
+
+ROOT=$1
+IMG=${2:-${ROOT}.img}
+
+TMP_MNT=$(mktemp -d ./jffs2.XXXXXX)
+
+chmod a+rx $TMP_MNT/.
+
+cp -al $ROOT/* $TMP_MNT
+
+echo "(removing livesys scripts from image because they'll really foul it up if they run)"
+rm -f $TMP_MNT/etc/init.d/livesys*
+
+mkfs.jffs2 -n -e128KiB -r $TMP_MNT -o $IMG.tmp
+sumtool -n -p -e 128KiB -i $IMG.tmp -o $IMG
+rm $IMG.tmp
+crcimg $IMG
+
+echo "Done building jffs2 image $IMG"
+cleanup
diff --git a/build b/build
index c99a9dc..7351332 100755
--- a/build
+++ b/build
@@ -1,7 +1,30 @@
#!/bin/bash
set -e
-set -o pipefail
-python live.py
+pushd images
+
+prevbuild=$(<lastbuild)
+buildstem=$(python -c "print '$prevbuild'.split('.')[0][:-2];")
+nextbuild=$(python -c "print '%0.2d' % (int('$prevbuild'.split('.')[0][-2:]) + 1);")
+buildname=$buildstem$nextbuild
+
+date ; date >> ${buildname}.buildlog
+echo building $buildname ; echo building $buildname >> ${buildname}.buildlog
+/usr/bin/time nice setarch i586 \
+ make -j 3 -f ../Makefile ${buildname}.done >> ${buildname}.buildlog 2>&1
+
+for ext in tree removable.img img ; do
+ prevsize=$(< $prevbuild.$ext.size.txt)
+ nextsize=$(< $buildname.$ext.size.txt)
+ python -c "oldk = $prevsize ; newk = $nextsize ; print '%0.2fM / %dK /' % (newk / 1024.0, newk - oldk)" > $buildname.$ext.size-change.txt
+done
+
+diff -U 1 $prevbuild.tree.packages.txt $buildname.tree.packages.txt | grep -v ^@@ > $buildname.tree.package-changes.txt
+
+echo $buildname > lastbuild
+date ; date >> ${buildname}.buildlog
+
+popd
+
python appliance.py
diff --git a/image-digestor.sh b/image-digestor.sh
new file mode 100755
index 0000000..793342a
--- /dev/null
+++ b/image-digestor.sh
@@ -0,0 +1,72 @@
+#!/bin/bash -e
+#
+# Copyright © 2008 Andres Salomon <dilinger@queued.net>
+#
+# This file is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+check_for_cmds()
+{
+ for cmd in $@; do
+ which $cmd >/dev/null || {
+ echo "Missing required command '$cmd'!" 1>&2
+ return 1
+ }
+ done
+
+ return 0
+}
+
+check_for_cmds dd sha256sum
+
+usage()
+{
+ echo "" 1>&2
+ echo "Usage: $0 <img>" 1>&2
+ echo "Produces <img_basename>.plc"
+ echo "For use in secure reflash, the resulting placement control file"
+ echo "(*.plc) must be included as data.img in an OLPC-signed fs.zip."
+ echo "" 1>&2
+ exit 1
+}
+
+if [ "$#" != "1" ]; then
+ usage
+fi
+
+IMAGE_FILE_NAME=$1
+IMAGE_FILE_BASENAME=`basename $IMAGE_FILE_NAME`
+PLACEMENT_CONTROL_FILE=${IMAGE_FILE_BASENAME/.img/.plc}
+
+
+do_sha256()
+{
+ f=$1
+ eblocks=$((`stat --printf "%s\n" $f` / (128*1024)))
+ for b in $(seq 0 $(($eblocks - 1))); do
+ sha=$(dd status=noxfer bs=128KiB skip=$b count=1 if=$f 2>/dev/null | sha256sum | cut -d\ -f1)
+ echo "eblock: `printf '%x' $b` sha256 $sha" >> ${PLACEMENT_CONTROL_FILE}
+ done
+}
+
+cat >${PLACEMENT_CONTROL_FILE}<<EOF
+data: ${IMAGE_FILE_BASENAME}
+erase-all
+mark-pending: 0
+EOF
+do_sha256 "${IMAGE_FILE_NAME}"
+cat >>${PLACEMENT_CONTROL_FILE}<<EOF
+cleanmarkers
+mark-complete: 0
+EOF
diff --git a/live.py b/live.py
deleted file mode 100644
index 56f8c41..0000000
--- a/live.py
+++ /dev/null
@@ -1,44 +0,0 @@
-#!/usr/bin/python
-
-import logging
-import os
-import sys
-from time import gmtime, strftime
-
-import imgcreate
-
-base_dir = os.path.dirname(__file__)
-images_dir = os.path.join(base_dir, 'images')
-cache_dir = os.path.join(base_dir, 'cache')
-last_file = os.path.join(images_dir, 'last')
-
-def main():
-
- if not os.path.exists(images_dir):
- os.mkdir(images_dir)
-
- image_date = strftime("%Y%m%d%H%M", gmtime())
- image_name = 'SoaS3-%s' % image_date
- if os.path.exists(os.path.join(images_dir, image_name + '.iso')):
- print 'Image %s exists already' % image_name
- sys.exit(2)
-
- ks = imgcreate.read_kickstart(os.path.join(base_dir, 'soas-sugar.ks'))
- creator = imgcreate.LiveImageCreator(ks, image_name, image_name)
-
- try:
- creator.mount(cachedir=cache_dir)
- creator.install()
- creator.configure()
- creator.unmount()
- creator.package(destdir=images_dir)
- except imgcreate.CreatorError, e:
- logging.error("Error creating Live CD : %s" % e)
- return 1
- finally:
- creator.cleanup()
-
- return 0
-
-if __name__ == "__main__":
- sys.exit(main())
diff --git a/livecd-iso-to-bootable-tree.sh b/livecd-iso-to-bootable-tree.sh
new file mode 100755
index 0000000..40f18e5
--- /dev/null
+++ b/livecd-iso-to-bootable-tree.sh
@@ -0,0 +1,45 @@
+#!/bin/bash
+
+set -e
+
+cleanup() {
+ [ -d "$EXTMNT" ] && umount $EXTMNT && rmdir $EXTMNT
+ [ -d "$SQUASHMNT" ] && umount $SQUASHMNT && rmdir $SQUASHMNT
+ [ -d "$ISOMNT" ] && umount $ISOMNT && rmdir $ISOMNT
+}
+
+exitclean() {
+ echo "Cleaning up to exit..."
+ cleanup
+ exit 1
+}
+
+trap exitclean SIGINT SIGTERM
+
+PATH=/sbin:/usr/sbin:$PATH
+
+ISO=$(readlink -f "$1")
+ROOT=$(readlink -f "$2")
+
+ISOMNT=$(mktemp -d /media/isotmp.XXXXXX)
+mount -o loop,ro "$ISO" $ISOMNT || exitclean
+
+EXTIMG=$ISOMNT/LiveOS/ext3fs.img
+if [ -e $ISOMNT/LiveOS/squashfs.img ] ; then
+ SQUASHMNT=$(mktemp -d /media/squashtmp.XXXXXX)
+ mount -o loop,ro $ISOMNT/LiveOS/squashfs.img $SQUASHMNT || exitclean
+ EXTIMG=$SQUASHMNT/LiveOS/ext3fs.img
+fi
+
+EXTMNT=$(mktemp -d /media/exttmp.XXXXXX)
+mount -o loop,ro $EXTIMG $EXTMNT || exitclean
+
+echo "Create root filesystem..."
+
+mkdir -p $ROOT
+chmod a+rx $ROOT/.
+
+cp -a $EXTMNT/* $ROOT
+
+echo "Done."
+cleanup
diff --git a/make_fake_device.sh b/make_fake_device.sh
new file mode 100755
index 0000000..c44a0e0
--- /dev/null
+++ b/make_fake_device.sh
@@ -0,0 +1,71 @@
+#!/bin/bash
+
+set -e
+set -o pipefail
+
+PATH=/usr/sbin:/sbin:$PATH
+
+SAFE_SIZE_4G=3758096384 #3584mb
+SAFE_SIZE_2G=1879048192 #1/2 4g safe size
+SAFE_SIZE_1G=939524096 #1/2 2g safe size
+
+DISK_SIZE=$SAFE_SIZE_4G
+LOOP_DEV=$(losetup -f)
+
+usage() {
+ echo "make_fake_device.sh [--4G|--2G|--1G] <loop device backing store filename>"
+ echo " outputs a loop device whose backing store is a partitioned disk "
+ echo " image using a sparse file of the specified size (default is --4G)"
+ exit 1
+}
+
+while [ $# -gt 1 ]; do
+ case $1 in
+ --4G)
+ DISK_SIZE=$SAFE_SIZE_4G
+ shift
+ ;;
+ --2G)
+ DISK_SIZE=$SAFE_SIZE_2G
+ shift
+ ;;
+ --1G)
+ DISK_SIZE=$SAFE_SIZE_2G
+ shift
+ ;;
+ *)
+ usage
+ ;;
+ esac
+done
+IMG=$1
+
+
+BLOCK_SIZE=512
+NUM_HEADS=16
+NUM_SECTORS_PER_TRACK=62
+NUM_BLOCKS=$(($DISK_SIZE / $BLOCK_SIZE))
+NUM_CYLINDERS=$(($NUM_BLOCKS / $NUM_HEADS / $NUM_SECTORS_PER_TRACK))
+IMAGE_SIZE=$(($NUM_CYLINDERS * $NUM_HEADS * $NUM_SECTORS_PER_TRACK * $BLOCK_SIZE))
+OS_PART1_BEGIN=$(($NUM_SECTORS_PER_TRACK * $BLOCK_SIZE))
+
+dd if=/dev/zero of=$IMG bs=$BLOCK_SIZE count=0 seek=$(($IMAGE_SIZE / $BLOCK_SIZE)) > /dev/null 2>&1 || exitclean
+/sbin/fdisk -b $BLOCK_SIZE -C $NUM_CYLINDERS -S $NUM_SECTORS_PER_TRACK -H $NUM_HEADS $IMG > /dev/null 2>&1 <<EOF
+n
+p
+1
+
+
+t
+83
+p
+w
+q
+EOF
+
+losetup -d $LOOP_DEV > /dev/null 2>&1 || /bin/true
+losetup -o $OS_PART1_BEGIN $LOOP_DEV $IMG
+
+mke2fs -O dir_index -L OLPCRoot -F $LOOP_DEV > /dev/null 2>&1 || exitclean
+echo $LOOP_DEV
+
diff --git a/soas-aslo-and-content.ks b/soas-aslo-and-content.ks
new file mode 100644
index 0000000..b4326f3
--- /dev/null
+++ b/soas-aslo-and-content.ks
@@ -0,0 +1,98 @@
+
+%post --nochroot
+
+# activities.sugarlabs.org (ASLO) installed-packages
+
+# Fructose
+ASLO="$ASLO http://activities.sugarlabs.org/en-US/sugar/downloads/file/25894/browse-103.xo" # browse # latest is 0.82, so can't use that
+ASLO="$ASLO http://activities.sugarlabs.org/en-US/sugar/downloads/latest/4027" # turtleart
+ASLO="$ASLO http://activities.sugarlabs.org/en-US/sugar/downloads/latest/4028" # read
+ASLO="$ASLO http://activities.sugarlabs.org/en-US/sugar/downloads/latest/4032" # imageviewer
+ASLO="$ASLO http://activities.sugarlabs.org/en-US/sugar/downloads/latest/4035" # read e-texts
+ASLO="$ASLO http://activities.sugarlabs.org/en-US/sugar/downloads/latest/4041" # pippy
+ASLO="$ASLO http://activities.sugarlabs.org/en-US/sugar/downloads/latest/4043" # terminal
+ASLO="$ASLO http://activities.sugarlabs.org/en-US/sugar/downloads/latest/4045" # jukebox
+ASLO="$ASLO http://activities.sugarlabs.org/en-US/sugar/downloads/latest/4056" # log
+ASLO="$ASLO http://activities.sugarlabs.org/en-US/sugar/downloads/latest/4069" # chat
+ASLO="$ASLO http://activities.sugarlabs.org/en-US/sugar/downloads/latest/4076" # calculator
+ASLO="$ASLO http://activities.sugarlabs.org/en-US/sugar/downloads/latest/4201" # write
+
+# Honey subset
+ASLO="$ASLO http://activities.sugarlabs.org/en-US/sugar/downloads/latest/4029" # IRC
+ASLO="$ASLO http://activities.sugarlabs.org/en-US/sugar/downloads/latest/4034" # Moon
+ASLO="$ASLO http://activities.sugarlabs.org/en-US/sugar/downloads/latest/4037" # CartoonBuilder
+ASLO="$ASLO http://activities.sugarlabs.org/en-US/sugar/downloads/latest/4038" # Speak
+ASLO="$ASLO http://activities.sugarlabs.org/en-US/sugar/downloads/latest/4039" # ViewSlides
+ASLO="$ASLO http://activities.sugarlabs.org/en-US/sugar/downloads/latest/4042" # InfoSlicer
+ASLO="$ASLO http://activities.sugarlabs.org/en-US/sugar/downloads/latest/4044" # FlipSticks
+ASLO="$ASLO http://activities.sugarlabs.org/en-US/sugar/downloads/latest/4046" # JigsawPuzzle
+ASLO="$ASLO http://activities.sugarlabs.org/en-US/sugar/downloads/latest/4047" # SliderPuzzle
+ASLO="$ASLO http://activities.sugarlabs.org/en-US/sugar/downloads/latest/4050" # Colors
+ASLO="$ASLO http://activities.sugarlabs.org/en-US/sugar/downloads/latest/4054" # FreeCell
+ASLO="$ASLO http://activities.sugarlabs.org/en-US/sugar/downloads/latest/4058" # Develop
+ASLO="$ASLO http://activities.sugarlabs.org/en-US/sugar/downloads/latest/4059" # TamTamEdit
+ASLO="$ASLO http://activities.sugarlabs.org/en-US/sugar/downloads/latest/4060" # TamTamJam
+ASLO="$ASLO http://activities.sugarlabs.org/en-US/sugar/downloads/latest/4061" # TamTamMini
+ASLO="$ASLO http://activities.sugarlabs.org/en-US/sugar/downloads/latest/4062" # TamTamSynth Lab
+ASLO="$ASLO http://activities.sugarlabs.org/en-US/sugar/downloads/latest/4063" # Memorize
+ASLO="$ASLO http://activities.sugarlabs.org/en-US/sugar/downloads/latest/4064" # JokeMachine
+ASLO="$ASLO http://activities.sugarlabs.org/en-US/sugar/downloads/latest/4071" # Maze
+ASLO="$ASLO http://activities.sugarlabs.org/en-US/sugar/downloads/latest/4073" # StoryBuilder
+ASLO="$ASLO http://activities.sugarlabs.org/en-US/sugar/downloads/latest/4074" # Poll
+ASLO="$ASLO http://activities.sugarlabs.org/en-US/sugar/downloads/latest/4078" # Labyrinth
+ASLO="$ASLO http://activities.sugarlabs.org/en-US/sugar/downloads/latest/4081" # Record
+ASLO="$ASLO http://activities.sugarlabs.org/en-US/sugar/downloads/latest/4082" # Paint
+ASLO="$ASLO http://activities.sugarlabs.org/en-US/sugar/downloads/latest/4088" # Tux Paint
+ASLO="$ASLO http://activities.sugarlabs.org/en-US/sugar/downloads/latest/4089" # Library
+ASLO="$ASLO http://activities.sugarlabs.org/en-US/sugar/downloads/latest/4193" # Physics
+ASLO="$ASLO http://activities.sugarlabs.org/en-US/sugar/downloads/latest/4204" # Arithmetic
+
+WD=$PWD
+BUNDLES_DIR=$INSTALL_ROOT/usr/share/sugar/bundles
+
+mkdir -p $BUNDLES_DIR
+cd $BUNDLES_DIR
+
+CACHE_DIR=$WD/../cache/aslo
+mkdir -p $CACHE_DIR
+
+for url in $ASLO ; do
+ remote_file=$(basename $(curl -4 -s -L -w %{url_effective} -I $url | tail -1))
+ bundle=$CACHE_DIR/$remote_file
+ if [ ! -f $bundle ] ; then
+ curl -4 -L $url > $bundle
+ fi
+ cp -p $bundle $BUNDLES_DIR
+done
+
+# pull sample content for the journal
+PDFS=south_america.pdf
+PDFS="$PDFS africa.pdf"
+PDFS="$PDFS asia.pdf"
+PDFS="$PDFS central_america.pdf"
+PDFS="$PDFS europe.pdf"
+PDFS="$PDFS middle_east.pdf"
+PDFS="$PDFS north_america.pdf"
+PDFS="$PDFS oceania.pdf"
+PDFS="$PDFS southeast_asia.pdf"
+
+for pdf in $PDFS ; do
+ url=http://dev.sugarlabs.org/raw-attachment/ticket/840/$pdf
+ remote_file=$(basename $(curl -4 -s -L -w %{url_effective} -I $url | tail -1))
+ bundle=$CACHE_DIR/$remote_file
+ if [ ! -f $bundle ] ; then
+ curl -s -4 -L $url > $bundle
+ fi
+ cp -p $bundle $BUNDLES_DIR
+done
+
+# get the script to install the activities
+cp -p $WD/../install-activity.py .
+
+# get sample content setup script directly from git
+cp -p $WD/../copy-to-datastore.py .
+
+chown -R 500:500 $BUNDLES_DIR
+cd $WD
+
+%end
diff --git a/soas-xo.ks b/soas-xo.ks
new file mode 100644
index 0000000..2cb44ed
--- /dev/null
+++ b/soas-xo.ks
@@ -0,0 +1,489 @@
+%include soas-sugar.ks
+%include soas-aslo-and-content.ks
+
+##repo --name=olpc-kernel-xo-1 --cost=5 --baseurl=http://dev.laptop.org/~mdengler/xo-1
+#repo --name=olpc-kernel --cost=5 --baseurl=http://dev.laptop.org/~dilinger/olpc-2.6.30-xo1
+repo --name=olpc --cost=3 --baseurl=http://dev.laptop.org/~dsd/xo1-rpms
+
+%packages --excludedocs --instLangs en:es:ar:pl:pt_BR:pt:it:fr:ht:el:mn:mr_IN:th:am_ET:km_KH:ne_NP:ur_PK:rw:ja:de:tr:te:ps:fa_AF:si
+
+libertas-usb8388-firmware
+
+ntpdate
+xcompmgr
+
+# sound backend
+-alsa-plugins-pulseaudio
+-pulseaudio
+
+yum-presto
+
+%end
+
+%post
+
+
+
+##################
+# BEGIN olpc.fth
+cat > /boot/olpc.fth <<EOF
+\ olpc.fth
+
+: set-path-macros ( -- )
+ button-o game-key? if " \boot-alt" else " \boot" then pn-buf place
+
+ " /chosen" find-package if ( phandle )
+ " bootpath" rot get-package-property 0= if ( propval$ )
+ get-encoded-string ( bootpath$ )
+ [char] \ left-parse-string 2nip ( dn$ )
+ dn-buf place ( )
+ then
+ then
+
+ " nand" dn-buf count sindex 0>= if
+ " root=mtd0 rootfstype=jffs2"
+ else
+ " root=LABEL=OLPCRoot"
+ then
+ " ROOTDEV" \$set-macro
+;
+
+: olpc-fth-boot-me
+ set-path-macros
+ " ro \${ROOTDEV} console=ttyS0,115200 console=tty0 fbcon=font:SUN12x22" expand$ to boot-file
+ " \${DN}\${PN}\vmlinuz" expand$ to boot-device
+ " \${DN}\${PN}\initrd.img" expand$ to ramdisk
+
+ setup-smbios
+ unfreeze
+ dcon-unfreeze
+ visible
+
+ boot
+;
+
+olpc-fth-boot-me
+
+EOF
+
+# END olpc.fth
+##################
+
+
+
+##################
+# BEGIN dcon-unfreeze-failsafe
+
+
+cat > /etc/event.d/dcon-unfreeze-failsafe <<EOF
+# this service unfreezes the DCON
+# Sugar should do this but a) it might not; and b) we might not be running Sugar
+#
+
+
+description "unfreeze DCON"
+author "Martin Dengler <martin@martindengler.com>"
+
+start on started prefdm
+stop on stopping prefdm
+stop on starting shutdown
+
+stop on runlevel 0
+stop on runlevel 1
+stop on runlevel 6
+
+script
+echo 0 > /sys/devices/platform/dcon/freeze
+end script
+EOF
+
+chmod a+rx /etc/event.d/dcon-unfreeze-failsafe
+
+# END dcon-unfreeze-failsafe
+##################
+
+
+
+CREATE_USERNAME=liveuser
+
+##################
+# BEGIN avoid livesys script at every boot
+
+
+cat >> /etc/fstab <<EOF
+/tmp /tmp tmpfs rw 0 0
+none /ofw promfs defaults 0 0
+EOF
+
+mkdir /ofw
+
+
+/usr/sbin/useradd -m -c "SoaS user" -G audio,wheel $CREATE_USERNAME
+/usr/bin/passwd -d $CREATE_USERNAME
+
+# allow sudo for olpc user
+echo "%wheel ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
+
+# permanently set %__dbi_cdb rpm macro to work around jffs2's lack of writeable mmap()
+mkdir -p /etc/rpm
+echo "%__dbi_cdb create private nommap" > /etc/rpm/macros.rpmdb
+
+
+# amend build
+sed -i -e 's/SoaS/SoaS-XO/g' /etc/fedora-release
+
+
+# disable screensaver locking
+gconftool-2 --direct --config-source=xml:readwrite:/etc/gconf/gconf.xml.defaults -s -t bool /apps/gnome-screensaver/lock_enabled false >/dev/null
+
+
+# disable the logout menu item in Sugar
+gconftool-2 --direct --config-source=xml:readwrite:/etc/gconf/gconf.xml.defaults -s -t bool /desktop/sugar/show_logout false >/dev/null
+
+
+# nicer console font for our little screen
+# FIXME: olpc-configure sets this up too, but it's too late for first boot.
+# but perhaps we could fix that so that it gets applied.
+echo "SYSFONT=sun12x22" >> /etc/sysconfig/i18n
+
+
+# make sure the fonts are not too big in GNOME
+# FIXME: remove when http://dev.laptop.org/ticket/9331 is fixed
+gconftool-2 --direct --config-source=xml:readwrite:/etc/gconf/gconf.xml.defaults -s -t float /desktop/gnome/font_rendering/dpi 201 >/dev/null
+
+
+# make sure the fonts are not too big in Sugar
+# FIXME: remove when http://dev.laptop.org/ticket/9331 is fixed
+echo "Xft.dpi: 201" > /home/$CREATE_USERNAME/.Xresources
+chown $CREATE_USERNAME:$CREATE_USERNAME /home/$CREATE_USERNAME/.Xresources
+
+
+# use smaller font size for XO
+# FIXME: fix upstream at http://dev.sugarlabs.org/ticket/954
+sed -i -e 's/Sans Serif 10/Sans Serif 7/g' /usr/share/sugar/data/sugar-100.gtkrc
+
+
+# install activities
+BUNDLES_DIR=/usr/share/sugar/bundles
+ACTIVITIES_DIR=/home/$CREATE_USERNAME/Activities
+chown -R $CREATE_USERNAME:$CREATE_USERNAME $BUNDLES_DIR
+mkdir /home/$CREATE_USERNAME/Activities
+chown -R $CREATE_USERNAME:$CREATE_USERNAME $ACTIVITIES_DIR
+cd $BUNDLES_DIR
+chmod a+x install-activity.py
+for file in *.xo; do
+ su $CREATE_USERNAME -c "./install-activity.py $file"
+done
+rm -f install-activity.py
+
+# execute sample content script and clean up afterwards
+chmod a+x copy-to-datastore.py
+su $CREATE_USERNAME -c ./copy-to-datastore.py
+rm -f *.pdf copy-to-datastore.py
+
+
+# add more activities to the favorites
+cat > /usr/share/sugar/data/activities.defaults << FOE
+com.garycmartin.Moon
+org.laptop.AbiWordActivity
+org.laptop.Calculate
+org.laptop.Chat
+org.laptop.Memorize
+org.laptop.Pippy
+org.laptop.TurtleArtActivity
+org.laptop.WebActivity
+org.vpri.EtoysActivity
+org.laptop.Oficina
+org.laptop.RecordActivity
+org.gnome.Labyrinth
+org.laptop.physics
+vu.lux.olpc.Speak
+org.worldwideworkshop.olpc.JigsawPuzzle
+FOE
+
+# END avoid livesys scripts at every boot
+##################
+
+
+##################
+# BEGIN liveuser .xsession
+
+cat >> /home/$CREATE_USERNAME/.xsession <<EOF
+
+# full debugging on
+export LM_DEBUG=net
+export GABBLE_DEBUG=all
+export GABBLE_LOGFILE=/home/$CREATE_USERNAME/.sugar/default/logs/telepathy-gabble.log
+export SALUT_DEBUG=all
+export SALUT_LOGFILE=/home/$CREATE_USERNAME/.sugar/default/logs/telepathy-salut.log
+export GIBBER_DEBUG=all
+export PRESENCESERVICE_DEBUG=1
+export SUGAR_LOGGER_LEVEL=debug
+
+# Uncomment the following line to enable core dumps
+#ulimit -c unlimited
+
+# Uncomment the following line to debug sugar startup problems
+#exec xterm
+
+# If you drop out of this script, the normal olpc-session will proceed
+# Uncomment the following line to prevent it
+#exit 0
+
+
+# xcompmgr is disabled in SoaS Strawberry because it is lightly tested
+# and known to cause undesired visual artifacts; for example, palettes
+# can fail to disappear often enough to be very annoying
+#
+#(sleep 5 ; xcompmgr ) &
+
+
+# unset dpms and screensaver (blanking) to avoid confusion and
+# conflict with olpc-powerd, which is taking care of that type of
+# behavior
+xset -dpms s off
+
+
+EOF
+
+# END olpc .xsession
+##################
+
+
+
+##################
+# BEGIN ntpdate
+
+ntpdate_file=/etc/NetworkManager/dispatcher.d/42-ntpdate
+if [ ! -e $ntpdate_file ] ; then
+ cat > $ntpdate_file <<EOF
+#!/bin/bash
+
+if [ "\$2" = "up" ] ; then
+ sleep 5
+ /usr/sbin/ntpdate 0.pool.ntp.org >> /tmp/ntpdate.log 2>&1
+fi
+EOF
+
+chmod u+rx $ntpdate_file
+
+fi
+
+# END ntpdate
+##################
+
+
+
+##################
+# BEGIN smolt
+
+smolt_file=/etc/NetworkManager/dispatcher.d/43-smolt
+if [ ! -e $smolt_file ] ; then
+ cat > $smolt_file <<EOF
+#!/bin/bash
+
+export PATH=/bin:/usr/bin
+
+if [ "\$2" = "up" ] ; then
+ sleep 15
+ ( nice /usr/bin/smoltSendProfile -a --submitOnly -b -c || /usr/sbin/smoltSendProfile -a --submitOnly -b ) >> /tmp/smolt.log 2>&1
+fi
+EOF
+
+fi
+
+chmod u+rx $smolt_file
+
+# END smolt
+##################
+
+
+##################
+# BEGIN make sugar default
+cat > /home/$CREATE_USERNAME/.dmrc <<EOF
+[Desktop]
+Layout=olpc
+Session=sugar
+EOF
+# END make sugar default
+##################
+
+
+
+##################
+# BEGIN set sugar power management on
+gconftool-2 --direct --config-source=xml:readwrite:/etc/gconf/gconf.xml.defaults -s -t bool /desktop/sugar/power/automatic True >/dev/null
+# END set sugar power management on
+##################
+
+
+
+##################
+# BEGIN enable serial console
+
+echo ttyS0 >> /etc/securetty
+
+cat > /etc/event.d/ttyS0 <<EOF
+# ttyS0 - serial console
+start on stopped rc2
+start on stopped rc3
+start on stopped rc4
+start on stopped prefdm
+
+stop on runlevel 0
+stop on runlevel 1
+stop on runlevel 6
+
+respawn
+exec agetty ttyS0 115200
+EOF
+
+# END enable serial console
+##################
+
+
+
+##################
+# BEGIN make /var/log/messages a+r so Log activity can see it
+chmod a+r /var/log/messages
+# END make /var/log/messages a+r so Log activity can see it
+##################
+
+
+##################
+# BEGIN add yum repos
+cat >> /etc/yum.repos.d/sugar.repo << FOE
+[sugar]
+name=Sugar
+failovermethod=priority
+baseurl=http://download.sugarlabs.org/soas/repositories/2/
+enabled=1
+gpgcheck=0
+FOE
+
+cat >> /etc/yum.repos.d/olpc-xo-1.repo << FOE
+[olpc-xo-1]
+name=OLPC XO-1
+failovermethod=priority
+baseurl=http://dev.laptop.org/~mdengler/xo-1
+enabled=1
+gpgcheck=0
+FOE
+
+cat >> /etc/yum.repos.d/olpc.repo << FOE
+[olpc]
+name=OLPC XO-1
+failovermethod=priority
+baseurl=http://dev.laptop.org/~dsd/xo1-rpms
+enabled=1
+gpgcheck=0
+FOE
+
+# END add yum repos
+##################
+
+
+##################
+# BEGIN setup services
+for service in auditd cpuspeed cups dnsmasq exim firstboot iptables ip6tables irda mdmonitor netfs network nfs nfslock nscd portreserve rpcbind rpcgssd rpcidmapd ; do
+ /sbin/chkconfig --level 2345 $service off
+done
+
+##################
+# BEGIN configure powerd
+
+#FIXME olpc-utils needs a patch to fix ttyS0 not starting, without which rtcwake is broken
+# see http://lists.sugarlabs.org/archive/sugar-devel/2009-August/018378.html
+sed -i -e 's/start on stopped prefdm/start on stopped prefdm\n\n#FIXME remove when olpc-utils is patched or\n# http:\/\/lists.sugarlabs.org\/archive\/sugar-devel\/2009-August\/018378.html\n# is otherwise fixed\nstart on runlevel [2345]/' /etc/event.d/ttyS0
+
+mv /etc/powerd/powerd.conf /etc/powerd/standard.conf
+ln -s soas.conf /etc/powerd/powerd.conf
+cat > /etc/powerd/soas.conf <<FOE
+#
+# Config file for powerd
+#
+# config_BATTERY_TIME_{DIM,SLEEP,BLANK}
+# config_EBOOK_TIME_{DIM,SLEEP,BLANK}
+# config_PLUGGED_TIME_{DIM,SLEEP,BLANK}
+# These are the time in seconds (measured from last user
+# activity) until a) the laptop screen dims, b) the laptop
+# sleeps, and c) the laptop screen blanks. All three can be
+# scheduled in any order.
+#
+# config_MAX_SLEEP_BEFORE_SHUTDOWN
+# Once the laptop sleeps and the screen is blank, it will shut
+# down after this amount of time.
+#
+# config_ALLOW_SHUTDOWN_WHEN_PLUGGED
+# If this is disabled, the laptop will never automatically shut
+# down when using external power. (It may still sleep, however.)
+#
+# config_IDLE_DIM_LEVEL
+# Brightness level when the screen is automatically dimmed. Set
+# to 15 to prevent dimming. Set to 0 to allow the backlight to
+# go off completely.
+#
+# config_CONFIRM_SECONDS
+# How long the shutdown/suspend confirmation splash screen stays
+# visible before the laptop automatically suspends.
+#
+# config_WAKE_ON_WLAN
+# Allows wireless to continue operating when the laptop is
+# sleeping. Note that the wireless configuration may allow
+# shutting down the wireless entirely (e.g., with
+# "echo 0 >/sys/power/wlan-enabled"), which may override this
+# setting.
+#
+# config_CPU_IDLE_LIMIT
+# If the cpu is idle less than this percentage, then the laptop
+# won't suspend.
+#
+# config_SLEEP_WHEN_LID_CLOSED
+# This is normally left enabled, and causes the laptop to go to sleep
+# when closed. If disabled, it will stay awake when the lid is
+# closed, and will only sleep because of other timeouts.
+#
+config_BATTERY_TIME_DIM="180"
+config_BATTERY_TIME_SLEEP="360"
+config_BATTERY_TIME_BLANK="99999"
+config_EBOOK_TIME_DIM="99999"
+config_EBOOK_TIME_SLEEP="20"
+config_EBOOK_TIME_BLANK="99999"
+config_PLUGGED_TIME_DIM="99999"
+config_PLUGGED_TIME_SLEEP="99999"
+config_PLUGGED_TIME_BLANK="99999"
+config_IDLE_DIM_LEVEL="0"
+config_MESH_DURING_SUSPEND="no"
+config_MAX_SLEEP_BEFORE_SHUTDOWN="99999"
+config_ALLOW_SHUTDOWN_WHEN_PLUGGED="no"
+config_CONFIRM_SECONDS="7"
+config_CPU_IDLE_LIMIT="10"
+config_SLEEP_WHEN_LID_CLOSED="yes"
+FOE
+
+
+
+for service in avahi-daemon sshd ; do
+ /sbin/chkconfig --level 2345 $service on
+done
+# something triggers prompting, so just turn it off with a big hammer
+sed -i -e 's/PROMPT=yes/PROMPT=no/;' /etc/sysconfig/init
+# END setup services
+##################
+
+%end
+
+
+##################
+# FIXME: remove when it's clear why non-OLPC kernel's being installed
+# (and installed second)
+%post --nochroot
+cp -p ../cache/olpc*/packages/kernel-2.6.30_xo1*.rpm $INSTALL_ROOT
+%end
+%post
+set -x
+ls -l /boot
+rpm -ivh --force $(/bin/ls /kernel-2.6.30_xo1*.rpm | tail -1)
+ls -l /boot
+%end
+##################