diff options
author | Martin Dengler <martin@martindengler.com> | 2009-06-29 21:31:30 (GMT) |
---|---|---|
committer | Martin Dengler <martin@martindengler.com> | 2009-06-30 11:35:31 (GMT) |
commit | 0ae1da97a8da1f25c8d4cba1135e1f4cc9b17db8 (patch) | |
tree | 10e97b686c618c651be009ecb288865145240c25 /bootable-tree-to-xo.sh | |
parent | 628648f8d89fe8322e2867a5a56a673900683206 (diff) |
refactor build process into smaller, more sensible, more restartable scripts
Diffstat (limited to 'bootable-tree-to-xo.sh')
-rwxr-xr-x | bootable-tree-to-xo.sh | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/bootable-tree-to-xo.sh b/bootable-tree-to-xo.sh new file mode 100755 index 0000000..2ba138b --- /dev/null +++ b/bootable-tree-to-xo.sh @@ -0,0 +1,41 @@ +#!/bin/bash + +set -x +set -e + +PATH=$PATH:/usr/sbin + +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 |