From bf829d37582c2e68e9837a55f479f76c3e4bfd14 Mon Sep 17 00:00:00 2001 From: Holger Levsen Date: Tue, 4 Nov 2014 18:59:34 +0100 Subject: g-i-i: simplify and fix post-install fs mounting. --- bin/g-i-installation.sh | 53 ++++++++++++++++--------------------------------- 1 file changed, 17 insertions(+), 36 deletions(-) diff --git a/bin/g-i-installation.sh b/bin/g-i-installation.sh index def805bb..9cc17d42 100644 --- a/bin/g-i-installation.sh +++ b/bin/g-i-installation.sh @@ -50,7 +50,7 @@ if [ -z "$WORKSPACE" ] ; then WORKSPACE=$(pwd) fi RESULTS=$WORKSPACE/results -mkdir -p $RESULTS/log +mkdir -p $RESULTS GOCR=$(mktemp) # @@ -114,7 +114,12 @@ cleanup_all() { # # remove lvm volume # - sudo lvremove -f $LV + case $NAME in + # *standalone_mate) echo "Warning: not deleting lvm volume $LV" + # ;; + *) sudo lvremove -f $LV + ;; + esac rm -f $QEMU_LAUNCHER # # cleanup image mount @@ -128,7 +133,7 @@ cleanup_all() { # echo "$(date) - Creating video now. This may take a while.'" TMPFILE=$(mktemp) - avconv -r $FRAMERATE snapshot_%06d.png g-i-installation-$NAME.webm > $TMPFILE 2>&1 || cat $TMPFILE + avconv -r $FRAMERATE -i snapshot_%06d.png g-i-installation-$NAME.webm > $TMPFILE 2>&1 || cat $TMPFILE rm snapshot_??????.png $TMPFILE # rename .bak files back to .png if find . -name "*.png.bak" > /dev/null ; then @@ -136,6 +141,7 @@ cleanup_all() { mv $i $(echo $i | sed -s 's#.png.bak#.png#') done fi + echo # finally if [ -f "$GOCR" ] ; then echo "Results of running /usr/bin/gocr on last screenshot:" @@ -1072,36 +1078,24 @@ save_logs() { SYSTEM_MNT=/media/$NAME sudo mkdir -p $SYSTEM_MNT FAILURE=false - MLOGS=$(mktemp) # FIXME: bugreport guestmount: -o uid doesnt work: # "sudo guestmount -o uid=$(id -u) -o gid=$(id -g)" would be nicer, but it doesnt work: as root, the files seem to belong to jenkins, but as jenkins they cannot be accessed - case $NAME in - debian-edu_*) sudo guestmount -a $LV -m /dev/vg_system/root --ro $SYSTEM_MNT || ( echo "Warning: cannot mount /dev/vg_system/root" ; export FAILURE=true ) - sudo guestmount -a $LV -m /dev/vg_system/var -o nonempty --ro $SYSTEM_MNT/var > $MLOGS 2>&1 || echo "Not mounting /dev/vg_system/var - it's probably not used in this profile." >> $MLOGS - sudo guestmount -a $LV -m /dev/vg_system/usr -o nonempty --ro $SYSTEM_MNT/usr >> $MLOGS 2>&1 || echo "Not mounting /dev/vg_system/usr - it's probably not used in this profile." >> $MLOGS - sudo guestmount -a $LV -m /dev/vg_system/var+log -o nonempty --ro $SYSTEM_MNT/var/log >> $MLOGS 2>&1 || echo "Not mounting /dev/vg_system/var+log - it's probably not used in this profile." >> $MLOGS - ;; - debian_wheezy_*) sudo guestmount -a $LV -m /dev/debian/root --ro $SYSTEM_MNT || ( echo "Warning: cannot mount /dev/debian/root" ; export FAILURE=true ) - ;; - *) sudo guestmount -a $LV -m /dev/debian-vg/root --ro $SYSTEM_MNT || ( echo "Warning: cannot mount /dev/debian-vg/root" ; export FAILURE=true ) - ;; - esac + sudo guestmount -a $LV -i --ro $SYSTEM_MNT || ( echo "Warning: cannot mount filesystems from $LV" ; export FAILURE=true ) # # copy logs (and continue if some logs cannot be copied) # - sudo cp -rv $SYSTEM_MNT/var/log/* $SYSTEM_MNT/etc/fstab $RESULTS/log/ || ( echo "Warning: cannot get logs from installed system." ; echo "Did the installation finish correctly?" ; export FAILURE=true ) + sudo cp -rv $SYSTEM_MNT/var/log $SYSTEM_MNT/etc/fstab $RESULTS/ || ( echo "Warning: cannot get logs from installed system." ; echo "Did the installation finish correctly?" ; export FAILURE=true ) # # get list of installed packages # - sudo chroot $SYSTEM_MNT dpkg -l > $RESULTS/log/dpkg-l || ( echo "Warning: cannot run dpkg inside the installed system, did the installation finish correctly?" ; export FAILURE=true ) + sudo chroot $SYSTEM_MNT dpkg -l > $RESULTS/dpkg-l || ( echo "Warning: cannot run dpkg inside the installed system, did the installation finish correctly?" ; export FAILURE=true ) # # only on combi-servers and ltsp-servers: # mount /opt # copy LTSP logs and package list # unmount /opt # - case $NAME in debian-edu_*ltsp-server|debian-edu_*combi-server) sudo guestmount -a $LV -m /dev/vg_system/opt -o nonempty --ro $SYSTEM_MNT/opt >> $MLOGS 2>&1 || ( echo "Warning: cannot mount /dev/vg_system/opt" | tee -a $MLOGS ; export FAILURE=true ) - mkdir -p $RESULTS/log/opt + case $NAME in debian-edu_*ltsp-server|debian-edu_*combi-server) mkdir -p $RESULTS/log/opt if [ -d $SYSTEM_MNT/opt/ltsp/amd64 ] ; then LTSPARCH="amd64" elif [ -d $SYSTEM_MNT/opt/ltsp/i386 ] ; then @@ -1113,28 +1107,15 @@ save_logs() { sudo cp -rv $SYSTEM_MNT/opt/ltsp/$LTSPARCH/var/log $RESULTS/log/opt/ sudo chroot $SYSTEM_MNT/opt/ltsp/$LTSPARCH dpkg -l > $RESULTS/log/opt/dpkg-l || ( echo "Warning: cannot run dpkg inside the ltsp chroot." ; sudo ls -la $SYSTEM_MNT/opt/ltsp/$LTSPARCH ; export FAILURE=true ) fi - sudo umount -l $SYSTEM_MNT/opt || echo "Warning: cannot un-mount $SYSTEM_MNT/opt" ;; *) ;; esac # - # make log with mounting problems available if it exists - # - if [ -s $MLOGS ] ; then - echo "Preserving log with probably harmless mounting problems in .../log/guessmount-problems" - cp -v $MLOGS $RESULTS/log/guessmount-problems - fi - rm $MLOGS - # - # umount guests + # umount guests (debian-edu uses many mountpoints...) # - sync - case $NAME in debian-edu_*) sudo umount -l $SYSTEM_MNT/var/log || true - sudo umount -l $SYSTEM_MNT/var || true - sudo umount -l $SYSTEM_MNT/usr || true - ;; - *) ;; - esac + #for MP in var/log var/ usr/ boot/ opt/ home/ debianedufreespace/ skole/tjener/home0 var/opt/ltsp/swapfiles skole/backup/ var/spool/squid3/ ; do + # sudo umount -l $SYSTEM_MNT/$MP 2>/dev/null || true + #done sudo umount -l $SYSTEM_MNT || ( echo "Warning: cannot un-mount $SYSTEM_MNT" ; export FAILURE=true ) # # make sure we can read everything after installation -- cgit v1.2.3-54-g00ecf