Skip to content

Commit

Permalink
do not use /etc/RUNNING_FROM_FAICD for detecting CD or USB stick
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas Lange committed Apr 17, 2014
1 parent 1131b9f commit fd43b1e
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 12 deletions.
3 changes: 1 addition & 2 deletions bin/fai
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,7 @@ fai_init() {
[ -n "$cspace" ] && FAI_CONFIG_SRC=$cspace
unset cspace

if [ -f /etc/RUNNING_FROM_FAICD ]; then # we are booting from fai cd
umount /initrd
if [ -f /media/mirror ]; then # we are booting from fai cd or USB stick
romountopt=
FAI_DEBMIRROR="--bind /media/mirror"
MNTPOINT=/media/mirror
Expand Down
2 changes: 0 additions & 2 deletions bin/fai-cd
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,6 @@ umount_dirs() {
for d in $dirs; do
umount $nfsrootdir/$d 2>/dev/null
done
rm -f $nfsrootdir/etc/RUNNING_FROM_FAICD
mountpoint -q $nfsrootdir && umount $nfsrootdir
mountpoint -q $cow && umount $cow
set -e
Expand Down Expand Up @@ -199,7 +198,6 @@ create_iso() {

mkdir -p $nfsrootdir/media/mirror || true

> $nfsrootdir/etc/RUNNING_FROM_FAICD
mount --bind $FAI_CONFIGDIR $nfsrootdir/$FAI && echo "Config space $FAI_CONFIGDIR mounted"
mount -o remount,ro,bind $nfsrootdir/$FAI
addmirror
Expand Down
1 change: 0 additions & 1 deletion examples/simple/class/10-base-classes
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,4 @@
uname -s | tr '[:lower:]' '[:upper:]'
[ -x "`which dpkg`" ] && dpkg --print-architecture | tr a-z A-Z

[ -f /etc/RUNNING_FROM_FAICD ] && echo "FAICD"
exit 0
20 changes: 13 additions & 7 deletions lib/subroutines
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,19 @@ task_faiend() {
sync

killall -q sshd udevd
if [ -f /etc/RUNNING_FROM_FAICD ]; then

for dir in $(mount | grep $target | awk '{print $3}' | sort -r); do
mount -o remount,ro $dir
done

# if we run from CD or USB stick and did not any installation
if [ -d /lib/live/mount/medium -a X$FAI_ACTION = Xsysinfo ]; then
reboot -dfi
fi

# check if we are running from CD, live-boot
cddev=$(mount |grep /lib/live/mount/medium | awk '{print $1}')
if [[ $cddev =~ '/dev/sr' ]]; then
echo 1 > /proc/sys/dev/cdrom/autoeject
cat > /tmp/rebootCD <<'EOF'
#! /bin/bash
Expand All @@ -550,14 +562,8 @@ EOF
[ -d $target/tmp ] && mv /tmp/rebootCD $target/tmp/rebootCD

sync
for dir in $(mount | grep $target | awk '{print $3}' | sort -r); do
mount -o remount,ro $dir
done
cdromdevice=$(awk '/ name:/ {print $3}' /proc/sys/dev/cdrom/info)

if [ -f /etc/RUNNING_FROM_FAICD -a X$FAI_ACTION = Xsysinfo ]; then
reboot -dfi
fi
chroot $target /tmp/rebootCD $cdromdevice
# never reached, because chroot will reboot the machine
die "Internal error when calling /tmp/rebootCD." >&2
Expand Down

0 comments on commit fd43b1e

Please sign in to comment.