merge ext2/3 image generation code from lp:~mcasadevall/livecd-rootfs/ext-image-generation

ubuntu/precise
Oliver Grawert 15 years ago
commit 18d73cf6ff

@ -27,27 +27,19 @@ fi
ARCH=$(dpkg --print-architecture) ARCH=$(dpkg --print-architecture)
SUBARCH="" SUBARCH=""
SUBARCHARG="" SUBARCHARG=""
DEFAULTSUITE="karmic" NEWSUITE="maverick"
NEWSUITE=""
SUITES="" SUITES=""
PROPOSED="" PROPOSED=""
if [ "$1" = '-s' ]; then IMAGEFORMAT="squashfs"
shift
SUBARCH="$1" while getopts :s:d:f:p name; do case $name in
SUBARCHARG="-s$SUBARCH" s) SUBARCH="$OPTARG";;
shift d) NEWSUITE="$OPTARG";;
fi f) IMAGEFORMAT="$OPTARG";;
if [ "$1" = '-p' ]; then p) PROPOSED="-p";;
PROPOSED='-p' esac; done;
shift shift $((OPTIND-1))
fi
if [ "$1" = '-d' ]; then
shift
NEWSUITE="$1"
shift
else
NEWSUITE="$DEFAULTSUITE"
fi
for s in $NEWSUITE; do for s in $NEWSUITE; do
if [ -d build-${s}-live/chroot-${s} ]; then SUITES="$SUITES $s"; fi if [ -d build-${s}-live/chroot-${s} ]; then SUITES="$SUITES $s"; fi
done done
@ -128,7 +120,7 @@ for STE in $SUITES; do
rm -f ${PUBDIR}latest rm -f ${PUBDIR}latest
ln -sf ${PUBDIR}${NOW} ${PUBDIR}latest ln -sf ${PUBDIR}${NOW} ${PUBDIR}latest
mkdir -p ${PUBDIR}${NOW} mkdir -p ${PUBDIR}${NOW}
if $LINUX32 sudo chroot ${DIR%/./*} sh -c "cd /${DIR#*/./} && /usr/sbin/livecd.sh ${SUBARCHARG} ${PROPOSED} -d${STE} ${ARCHARG} $arg" > ${LOG} 2>&1; then if $LINUX32 sudo chroot ${DIR%/./*} sh -c "cd /${DIR#*/./} && /usr/sbin/livecd.sh ${SUBARCHARG} ${PROPOSED} -d${STE} -f${IMAGEFORMAT} ${ARCHARG} ${IMAGEARG} $arg" > ${LOG} 2>&1; then
rm -f ${PUBDIR}current rm -f ${PUBDIR}current
ln -sf ${NOW} ${PUBDIR}current ln -sf ${NOW} ${PUBDIR}current

10
debian/changelog vendored

@ -1,3 +1,13 @@
livecd-rootfs (1.116) UNRELEASED; urgency=low
* added new -f switch for changing image build type
* added support for building ext2 and ext3 images in addition to squashfs
* fixed spacing in the livefs build code
* extended BuildLiveCD to handle the -f switch
* reworked BuildLiveCD command line parsing to be more sane
-- Michael Casadevall <mcasadevall@ubuntu.com> Mon, 17 May 2010 13:59:28 -0400
livecd-rootfs (1.115) maverick; urgency=low livecd-rootfs (1.115) maverick; urgency=low
* use a tmpfs for the livefs root directory, to get some speed * use a tmpfs for the livefs root directory, to get some speed

@ -21,7 +21,7 @@ set -eu
# Boston, MA 02110-1301 USA. # # Boston, MA 02110-1301 USA. #
########################################################################## ##########################################################################
# Depends: debootstrap, rsync, python-minimal|python, procps, squashfs-tools, ltsp-server [i386] # Depends: debootstrap, rsync, python-minimal|python, procps, squashfs-tools, ltsp-server [i386], genext2fs
cleanup() { cleanup() {
for mnt in ${ROOT}dev/pts ${ROOT}dev/shm ${ROOT}.dev ${ROOT}dev \ for mnt in ${ROOT}dev/pts ${ROOT}dev/shm ${ROOT}.dev ${ROOT}dev \
@ -56,6 +56,37 @@ subst_package() {
} }
livefs_squash()
{
squashsort="http://people.ubuntu.com/~tfheen/livesort/${FSS}.list.${TARGETARCH}"
#if wget -O livecd.${FSS}.sort ${squashsort} > /dev/null 2>&1; then
if false; then
echo "Using the squashfs sort list from ${squashsort}."
else
echo "Unable to fetch squashfs sort list; using a blank list."
: > livecd.${FSS}.sort
fi
# make sure there is no old squashfs idling around
rm -f livecd.${FSS}.squashfs
mksquashfs ${ROOT} livecd.${FSS}.squashfs -sort livecd.${FSS}.sort
chmod 644 livecd.${FSS}.squashfs
}
livefs_ext2()
{
# Add 10MiB extra free space for first boot + ext3 journal
size=$(($(du -ks ${ROOT} | cut -f1) + (10240)))
echo "Building ext2 filesystem."
# remove any stale filesystem images
rm -f livecd.${FSS}.ext?
genext2fs -b $size -d ${ROOT} livecd.${FSS}.ext2
chmod 644 livecd.${FSS}.ext2
}
if [ $(id -u) != 0 ];then if [ $(id -u) != 0 ];then
echo "must be run as root" echo "must be run as root"
exit 2 exit 2
@ -118,11 +149,12 @@ EXCLUDE=""
LIST="" LIST=""
SUBARCH="" SUBARCH=""
PROPOSED="" PROPOSED=""
IMAGEFORMAT="squashfs"
# must be in the "team / PPA name" form; e.g. "moblin/ppa"; the default PPA # must be in the "team / PPA name" form; e.g. "moblin/ppa"; the default PPA
# name is "ppa", don't omit it # name is "ppa", don't omit it
PPA="" PPA=""
while getopts :d:e:i:I:m:S:s:a:p name; do case $name in while getopts :d:e:i:I:m:S:s:a:f:p name; do case $name in
d) STE=$OPTARG;; d) STE=$OPTARG;;
e) EXCLUDE="$EXCLUDE $OPTARG";; e) EXCLUDE="$EXCLUDE $OPTARG";;
i) LIST="$LIST $OPTARG";; i) LIST="$LIST $OPTARG";;
@ -131,6 +163,7 @@ while getopts :d:e:i:I:m:S:s:a:p name; do case $name in
S) USZ="$OPTARG";; S) USZ="$OPTARG";;
s) SUBARCH="$OPTARG";; s) SUBARCH="$OPTARG";;
a) ARCH="$OPTARG";; a) ARCH="$OPTARG";;
f) IMAGEFORMAT="$OPTARG";;
p) PROPOSED="yes";; p) PROPOSED="yes";;
\?) echo bad usage >&2; exit 2;; \?) echo bad usage >&2; exit 2;;
\:) echo missing argument >&2; exit 2;; \:) echo missing argument >&2; exit 2;;
@ -624,35 +657,29 @@ Pin-Priority: 550
perl -i -nle 'print unless /^Package: language-(pack|support)/ .. /^$/;' \ perl -i -nle 'print unless /^Package: language-(pack|support)/ .. /^$/;' \
${ROOT}/var/lib/apt/extended_states ${ROOT}/var/lib/apt/extended_states
# And run the cleanup function dead last, to umount /proc after nothing # And run the cleanup function dead last, to umount /proc after nothing
# else needs to be run in the chroot (umounting it earlier breaks rm): # else needs to be run in the chroot (umounting it earlier breaks rm):
cleanup cleanup
# Squashfs does not report unpacked disk space usage, which is explained at
# <http://lkml.org/lkml/2006/6/16/163>. However, we would like to cache this
# number for partman's sufficient free space check and ubiquity's
# installation progress calculation.
printf $(du -sx --block-size=1 ${ROOT} | cut -f1) > livecd.${FSS}.size || true
livefs_squash()
{
squashsort="http://people.ubuntu.com/~tfheen/livesort/${FSS}.list.${TARGETARCH}"
#if wget -O livecd.${FSS}.sort ${squashsort} > /dev/null 2>&1; then
if false; then
echo "Using the squashfs sort list from ${squashsort}."
else
echo "Unable to fetch squashfs sort list; using a blank list."
: > livecd.${FSS}.sort
fi
# make sure there is no old squashfs idling around # Squashfs does not report unpacked disk space usage, which is explained at
rm -f livecd.${FSS}.squashfs # <http://lkml.org/lkml/2006/6/16/163>. However, we would like to cache this
# number for partman's sufficient free space check and ubiquity's
# installation progress calculation.
printf $(du -sx --block-size=1 ${ROOT} | cut -f1) > livecd.${FSS}.size || true
mksquashfs ${ROOT} livecd.${FSS}.squashfs -sort livecd.${FSS}.sort
chmod 644 livecd.${FSS}.squashfs
}
livefs_squash # Build our images
if [ "$IMAGEFORMAT" = "ext2" ] || [ "$IMAGEFORMAT" = "ext3" ]; then
livefs_ext2
else
livefs_squash
fi
# Upgrade ext2->ext3 if that's what is requested
if [ "$IMAGEFORMAT" = "ext3" ]; then
tune2fs -j livecd.${FSS}.ext2
mv livecd.${FSS}.ext2 livecd.${FSS}.ext3
fi
# LTSP chroot building (only in 32bit and for Edubuntu (DVD)) # LTSP chroot building (only in 32bit and for Edubuntu (DVD))
case $FS in case $FS in

Loading…
Cancel
Save