diff options
-rw-r--r-- | TODO | 6 | ||||
-rwxr-xr-x | bootable-tree-to-removable-img.sh | 8 | ||||
-rwxr-xr-x | build | 43 | ||||
-rwxr-xr-x | image-digestor.sh | 72 | ||||
-rwxr-xr-x | livecd-iso-to-bootable-tree.sh | 3 |
5 files changed, 80 insertions, 52 deletions
@@ -1 +1,5 @@ -switch to using Makefile instead of build +add minimal build script to make, report differences, and frob "latestbuild" files +fix dbus errors on startup (probably console/ConsoleKit-related) +add cjb's screencast +diagnose powerd/rtcwake hangs + diff --git a/bootable-tree-to-removable-img.sh b/bootable-tree-to-removable-img.sh index 7ec8c7b..f78ff19 100755 --- a/bootable-tree-to-removable-img.sh +++ b/bootable-tree-to-removable-img.sh @@ -20,13 +20,13 @@ trap exitclean SIGINT SIGTERM PATH=/sbin:/usr/sbin:$PATH ROOT=$1 -output_stem=${2:-soas} +output=${2:-soas} -echo "Making removable image $ROOT --> $output_stem" +echo "Making removable image $ROOT --> $output" TMP_MNT=$(mktemp -d ./removable.XXXXXX) -device=`../make_fake_device.sh ${output_stem}.img` +device=`../make_fake_device.sh $output` mount -t ext2 $device $TMP_MNT cp -a $ROOT/* $TMP_MNT @@ -35,8 +35,6 @@ cp ../olpc.fth.bootmenu $TMP_MNT/boot/olpc.fth umount $TMP_MNT losetup -d $device -tar cf - ${output_stem}.img | lzma -1 > ${output_stem}.img.tar.lzma - echo "Done making removable image $ROOT --> $output_stem" cleanup @@ -1,43 +0,0 @@ -#!/bin/bash - -set -e -set -o pipefail - -livecd-creator --skip-compression --cache=../cache --fslabel soasxo -c ../mtd.ks - -stem=`ls -t *.iso | head -1 | sed -e "s/.iso//;"` - -../livecd-iso-to-bootable-tree.sh ${stem}.iso $stem - -echo "archiving bootable tree -> tarball..." -tar -c -C $stem . | lzma -1 > ${stem}-files.tar.lzma - -../bootable-tree-to-removable-img.sh $stem ${stem}-removable - -../bootable-tree-to-xo.sh $stem ${stem}.img - - -$(dirname $(dirname $PWD))/xo-image-digestor/image-digestor.sh ${stem}.img - - -## -## Report stats -## - -diff -U 0 images{.prev,}/*.packages.txt | grep ^[-+] > package_changes.txt - -oldsize=$(du -sk ../images.prev/Soas2-???????????? | cut -f 1) -newsize=$(du -sk Soas2-???????????? | cut -f 1) -sizechange=$(expr $newsize - $oldsize) -echo "uncompressed size change $sizechange ($oldsize --> $newsize)" > size_changes.txt - -oldsize=$(du -sk ../images.prev/*.img | cut -f 1) -newsize=$(du -sk *.img | cut -f 1) -sizechange=$(expr $newsize - $oldsize) -echo "XO size change $sizechange ($oldsize --> $newsize)" >> size_changes.txt - -oldsize=$(du -sk ../images.prev/removable.img.tar.lzma | cut -f 1) -newsize=$(du -sk removable.img.tar.lzma | cut -f 1) -sizechange=$(expr $newsize - $oldsize) -echo "LZMA size change $sizechange ($oldsize --> $newsize)" >> size_changes.txt - 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/livecd-iso-to-bootable-tree.sh b/livecd-iso-to-bootable-tree.sh index 317ec70..40f18e5 100755 --- a/livecd-iso-to-bootable-tree.sh +++ b/livecd-iso-to-bootable-tree.sh @@ -41,8 +41,5 @@ chmod a+rx $ROOT/. cp -a $EXTMNT/* $ROOT -echo "Generating package list" -chroot $ROOT rpm -qa | sort > ${ROOT}.packages.txt - echo "Done." cleanup |