From a2905105a3c3324686ed565ec833b5cca609fdd3 Mon Sep 17 00:00:00 2001 From: Andreas Loibl Date: Sat, 4 Sep 2010 17:02:53 +0200 Subject: added methods to build on tmpfs --- auto/build | 22 +++++++++++++++++++++- auto/clean | 10 ++++++++++ tmpfs.disabled/README | 23 +++++++++++++++++++++++ tmpfs.disabled/options | 1 + 4 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 tmpfs.disabled/README create mode 100644 tmpfs.disabled/options diff --git a/auto/build b/auto/build index e55b879..306af81 100755 --- a/auto/build +++ b/auto/build @@ -7,4 +7,24 @@ bit=32 # Update kanotix-version (32/64-bit and timestamp) perl -pi -e "s%(Kanotix|Excalibur|Hellfire)(32|64)%\${1}$bit%i; s%(32|64)(bit)%$bit\${2}%i; s|[0-9]+-[0-9]+:[0-9]+|$(date +%Y%m%d-%H:%M)|" config/chroot_local-includes/etc/kanotix-version -lh build noauto ${@} 2>&1 | tee binary.log +if [ -d tmpfs ]; then + # build using tmpfs + if [ -z "$(stat --printf "%d\n" . tmpfs | uniq -u)" ]; then + # tmpfs not mounted yet + options=defaults + [ -f tmpfs/options ] && options="$(/dev/null + # copy everything to tmpfs + rsync -a .. . --exclude=tmpfs + # build + lh build noauto ${@} 2>&1 | tee binary.log + cd .. + # prevent parent lh build (the "auto" one) from building again + exit 1 +else + lh build noauto ${@} 2>&1 | tee binary.log +fi diff --git a/auto/clean b/auto/clean index 05c53de..fb261dd 100755 --- a/auto/clean +++ b/auto/clean @@ -19,3 +19,13 @@ then rmdir --ignore-fail-on-non-empty config fi +# umount tmpfs +if [ -e tmpfs ]; then + case "$1" in + --tmpfs|--all) + [ "$(stat --printf "%d\n" . tmpfs | uniq -u)" ] && umount tmpfs;; + esac + [ "$1" = "--tmpfs" ] && exit 1 +fi + +exit 0 diff --git a/tmpfs.disabled/README b/tmpfs.disabled/README new file mode 100644 index 0000000..cf9b913 --- /dev/null +++ b/tmpfs.disabled/README @@ -0,0 +1,23 @@ +Live-Helper: Build using tmpfs +============================== + +just rename this directory to "tmpfs" to enable. + +you may specify mount-options in the "options"-file in this directory, e.g. +"size=6G" to set the maximum size of the ramdisk to 6GB. + +"lh build" will then mount a tmpfs into this directory and the build process +will take place there. + +after the build the result and the cache will reside on the tmpfs, so if you +want to keep them you should move or copy them to somewhere else. +everything inside the "tmpfs" directory will be lost when umounting it, so if +you want to save the cache for later builds you have to move (or copy) it: + + mv tmpfs/cache . + +live-helper will not umount the "tmpfs" unless you run "lh clean --tmpfs" +or "lh clean --all", so if you are going to do multiple builds without +umounting the "tmpfs" you do not need to backup the cache, it will stay there +and will be used for the next build. + diff --git a/tmpfs.disabled/options b/tmpfs.disabled/options new file mode 100644 index 0000000..560761c --- /dev/null +++ b/tmpfs.disabled/options @@ -0,0 +1 @@ +size=6G -- cgit v1.0