figures where modprobe.conf.dist gets installed
[bootcd.git] / build.sh
index 0e1f598..97e234c 100755 (executable)
--- a/build.sh
+++ b/build.sh
@@ -57,10 +57,12 @@ pushd $srcdir
 # Root of the isofs
 isofs=$PWD/build/isofs
 
-# Build reference image if it does not exist. This should only need to
-# be executed once at build time, never at run time.
-if [ ! -f $isofs/bootcd.img ] ; then
-    ./prep.sh
+# The reference image is expected to have been built by prep.sh (see .spec)
+# we disable the initial logic that called prep.sh if that was not the case
+# this is because prep.sh needs to know pldistro 
+if [ ! -f $isofs/bootcd.img -o ! -f build/version.txt ] ; then
+    echo "you have to run prep.sh prior to calling $0 - exiting"
+    exit 1
 fi
 
 # build/version.txt written by prep.sh
@@ -100,12 +102,19 @@ FULL_VERSION_STRING="$PLC_NAME BootCD $BOOTCD_VERSION"
 
 echo "* Building images for $FULL_VERSION_STRING"
 
-# From within a myplc chroot /tmp is too small to build
-# all possible images, whereas /data is part of the host
+# From within a myplc chroot /usr/tmp is too small 
+# to build all possible images, whereas /data is part of the host
 # filesystem and usually has sufficient space.  What we
 # should do is check whether the expected amount of space
 # is available.
-[ -d /data ] && BUILDTMP=/data || BUILDTMP=/tmp
+BUILDTMP=/usr/tmp
+if [ -d /data ] ; then
+       isreadonly=$(mktemp /data/isreadonly.XXXXXX || /bin/true)
+       if [ -n "$isreadonly" ] ; then
+               rm -f "$isreadonly"
+               BUILDTMP=/data
+       fi
+fi
 
 # Root of the ISO and USB images
 echo "* Populating root filesystem..."