rootfsinstall: fix a typo error preventing the script from working; also:

- install qemu static if found
- avoid duplicated unmounts
This commit is contained in:
Silvan Calarco 2013-11-23 16:58:43 +01:00
parent ad7d4bc87e
commit 8607a86960

View File

@ -206,10 +206,10 @@ mke2fs -q -t $SYSTEMFSTYPE -j -L "openmamba" $PARTITION2 || {
exit 1 exit 1
} }
BOOTMP=`mktemp -d -t rootfsinstall.XXXXXXXX` [ "$BOOTFSTYPE" ] && BOOTMP=`mktemp -d -t rootfsinstall.XXXXXXXX`
ROOTMP=`mktemp -d -t rootfsinstall.XXXXXXXX` ROOTMP=`mktemp -d -t rootfsinstall.XXXXXXXX`
[ -d $BOOTMP -a -d $ROOTMP ] || { [ -d $ROOTMP ] || {
echo "Error: unable to create temporary mount points; aborting." echo "Error: unable to create temporary mount points; aborting."
exit 1 exit 1
} }
@ -218,7 +218,7 @@ mount $PARTITION2 $ROOTMP || {
echo "ERROR: unable to mount partition $PARTITION2; aborting." echo "ERROR: unable to mount partition $PARTITION2; aborting."
exit 1 exit 1
} }
trap "[ -e $ROOTMP ] && umount $ROOTMP;[ -e $BOOTMP ] && umount $BOOTMP" 0 HUP INT QUIT ABRT KILL TERM trap "[ "$ROOTMP" -a -e $ROOTMP ] && umount $ROOTMP && rmdir $ROOTMP;[ "$BOOTMP" -a -e $BOOTMP ] && umount $BOOTMP && rmdir $BOOTMP" 0 HUP INT QUIT ABRT KILL TERM
if [ "$BOOTFSTYPE" ]; then if [ "$BOOTFSTYPE" ]; then
mount $PARTITION1 $BOOTMP || { mount $PARTITION1 $BOOTMP || {
@ -292,7 +292,7 @@ framebuffer_ignore_alpha=1" > $BOOTMP/config.txt
[ "$SWHOME" -a "${SWHOME:0:4}" = "/tmp" ] && rm -rf $SWHOME [ "$SWHOME" -a "${SWHOME:0:4}" = "/tmp" ] && rm -rf $SWHOME
elif [ "$TARGETDEVICE" = "cubox" ]; then elif [ "$TARGETDEVICE" = "cubox" ]; then
[ "$VIDEO_MODE" ] || VIDEO_MODE=1920x1080-32@60" [ "$VIDEO_MODE" ] || VIDEO_MODE="1920x1080-32@60"
mkdir -p $BOOTMP/boot mkdir -p $BOOTMP/boot
echo "Creating u-boot boot.scr..." echo "Creating u-boot boot.scr..."
cat > $BOOTMP/boot/boot.txt << _EOF cat > $BOOTMP/boot/boot.txt << _EOF
@ -359,6 +359,8 @@ if [ "$SETHOSTNAME" ]; then
sed -i "s|\(127\.0\.0\.1\W*\)\(.*\)|\1 $SETHOSTNAME.localdomain $SETHOSTNAME localhost.localdomain localhost|" $ROOTMP/etc/hosts sed -i "s|\(127\.0\.0\.1\W*\)\(.*\)|\1 $SETHOSTNAME.localdomain $SETHOSTNAME localhost.localdomain localhost|" $ROOTMP/etc/hosts
fi fi
[ -e /usr/bin/qemu-arm.static ] && cp /usr/bin/qemu-arm.static $ROOTMP/usr/bin/qemu-arm
if [ "$ROOTPASSWORD" ]; then if [ "$ROOTPASSWORD" ]; then
echo "$ROOTPASSWORD" | chroot $ROOTMP passwd root --stdin || { echo "$ROOTPASSWORD" | chroot $ROOTMP passwd root --stdin || {
echo "ERROR: unable to set password for root; aborting." echo "ERROR: unable to set password for root; aborting."
@ -382,12 +384,6 @@ if [ "$CHROOTCOMMAND" ]; then
fi fi
sync sync
if [ "$BOOTFSTYPE" ]; then
umount $PARTITION1
rmdir $BOOTMP
fi
umount $PARTITION2
rmdir $ROOTMP
echo "Done." echo "Done."
exit 0 exit 0