From 6a889c01a73b48882c481d23f2b05d9000f56f2f Mon Sep 17 00:00:00 2001 From: Andreas Loibl Date: Mon, 6 Sep 2010 04:35:26 +0200 Subject: changed the auto/*-scripts, added additional kanotix arguments this replaces the old tmpfs.disabled directory, therefor it is removed --- README.tmpfs | 26 ++++++++ auto/build | 19 +++--- auto/clean | 46 ++++++++++---- auto/config | 6 +- auto/kanotix | 76 ++++++++++++++++++++++++ config/chroot_local-includes/etc/kanotix-version | 1 - tmpfs.disabled/README | 23 ------- tmpfs.disabled/options | 1 - 8 files changed, 152 insertions(+), 46 deletions(-) create mode 100644 README.tmpfs create mode 100755 auto/kanotix delete mode 100644 config/chroot_local-includes/etc/kanotix-version delete mode 100644 tmpfs.disabled/README delete mode 100644 tmpfs.disabled/options diff --git a/README.tmpfs b/README.tmpfs new file mode 100644 index 0000000..8141c6b --- /dev/null +++ b/README.tmpfs @@ -0,0 +1,26 @@ +Live-Helper: Build using tmpfs +============================== + +use "lh config --tmpfs true" to enable. + +you may specify mount-options with --tmpfs-options, e.g. + + lh config --tmpfs-options "size=6G" + +to set the maximum size of the ramdisk to 6GB. + +"lh build" will then mount a tmpfs into the "tmpfs" 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/auto/build b/auto/build index b64105c..7ca72d3 100755 --- a/auto/build +++ b/auto/build @@ -1,6 +1,8 @@ #!/bin/bash . config/bootstrap +. config/common +. config/kanotix bit=32 [ "$LH_ARCHITECTURE" = "amd64" ] && bit=64 @@ -10,7 +12,7 @@ perl -pi -e "s%(Kanotix|Excalibur|Hellfire)(32|64)%\${1}$bit%i; s%(32|64)(bit)%$ prebuild() { # Include nvidia-driver into chroot - if [ -f config/chroot_local-includes/usr/local/bin/install-nvidia-debian.sh ]; then + if [ "$LH_KANOTIX_NVIDIA" = "true" -a -f config/chroot_local-includes/usr/local/bin/install-nvidia-debian.sh ]; then mkdir -p config/chroot_local-includes/usr/src VER="$(grep -o ^VER=.* config/chroot_local-includes/usr/local/bin/install-nvidia-debian.sh|sed s/VER=//)" ARCH=; [ "$LH_ARCHITECTURE" = "amd64" ] && ARCH="_64" @@ -23,16 +25,13 @@ prebuild() cp "cache/$(basename "$URL")" "config/chroot_local-includes/usr/src/$(basename "$URL")" fi fi + exit 1 # DEBUG } -if [ -d tmpfs ]; then +if [ "$LH_KANOTIX_TMPFS" = "true" ]; then + mkdir -p tmpfs # 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 @@ -42,9 +41,9 @@ if [ -d tmpfs ]; then prebuild lh build noauto ${@} 2>&1 | tee binary.log cd .. - # prevent parent lh build (the "auto" one) from building again - exit 1 else prebuild lh build noauto ${@} 2>&1 | tee binary.log fi + +exit 1 diff --git a/auto/clean b/auto/clean index fb261dd..c4f0846 100755 --- a/auto/clean +++ b/auto/clean @@ -3,7 +3,11 @@ rm -f build.log # Remove generated files -rm -f config/binary config/bootstrap config/chroot config/common config/source +rm -f config/binary config/bootstrap config/chroot config/common config/source config/kanotix +if [ -f config/all ]; then + sed -i '/^. config\/kanotix/d' config/all + [ ! -s config/all ] && rm -f config/all +fi # remove kanotix-scripts grep -oe '^[^ #]*' scripts.urls | grep -oe '[^/]*$' | xargs -i rm -f config/chroot_local-includes/usr/local/bin/{} @@ -19,13 +23,35 @@ 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 +# handle additional kanotix parameters +while [ "$1" ] +do + case "$1" in + --help) + lh clean noauto --help + echo -e "\nAdditional Options for Kanotix:\n\t[--tmpfs]\n" + exit 1 + ;; + --all) + if [ -d tmpfs ]; then + [ "$(stat --printf "%d\n" . tmpfs | uniq -u)" ] && umount tmpfs + rmdir tmpfs + fi + lh clean noauto --all + exit 1 + ;; + --tmpfs) + if [ -d tmpfs ]; then + [ "$(stat --printf "%d\n" . tmpfs | uniq -u)" ] && umount tmpfs + rmdir tmpfs + fi + ;; + *) + lh clean noauto "$1" + ;; + esac + shift +done + +exit 1 -exit 0 diff --git a/auto/config b/auto/config index 5441557..8ae4135 100755 --- a/auto/config +++ b/auto/config @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash MIRROR_CHROOT=http://ftp.de.debian.org/debian MIRROR_CHROOT_SECURITY=http://security.debian.org/ @@ -6,6 +6,8 @@ MIRROR_BINARY=http://ftp.de.debian.org/debian MIRROR_BINARY_SECURITY=http://security.debian.org/ MIRROR_BOOTSTRAP="$MIRROR_CHROOT" +. auto/kanotix + lh config noauto \ --iso-volume KANOTIX \ --iso-preparer kanotix.com \ @@ -57,3 +59,5 @@ mkdir -p config/chroot_local-includes/usr/local/bin grep -oe '^[^ #]*' scripts.urls | wget -i- -c -N -q -P config/chroot_local-includes/usr/local/bin chmod 755 config/chroot_local-includes/usr/local/bin/*.sh +exit 1 + diff --git a/auto/kanotix b/auto/kanotix new file mode 100755 index 0000000..ac6ec48 --- /dev/null +++ b/auto/kanotix @@ -0,0 +1,76 @@ +#!/bin/bash + +[ -f config/kanotix ] && . config/kanotix + +usage() +{ +cat <config/kanotix << EOF +# config/kanotix - additional options for Kanotix + +# \$LH_KANOTIX_NVIDIA: include NVidia-Drivers into chroot +# (Default: ${LH_KANOTIX_NVIDIA}) +LH_KANOTIX_NVIDIA="${LH_KANOTIX_NVIDIA}" + +# \$LH_KANOTIX_TMPFS: use tmpfs to build +# (Default: ${LH_KANOTIX_TMPFS}) +LH_KANOTIX_TMPFS="${LH_KANOTIX_TMPFS}" + +# \$LH_KANOTIX_TMPFS_OPTIONS: options for tmpfs +# (Default: ${LH_KANOTIX_TMPFS_OPTIONS}) +LH_KANOTIX_TMPFS_OPTIONS="${LH_KANOTIX_TMPFS_OPTIONS}" + +EOF +grep -q ". config/kanotix" config/all 2>/dev/null || echo ". config/kanotix" >> config/all +} + +# process Kanotix config values +unset args; i=1 +while [ "$1" ] +do + case "$1" in + --include-nvidia) + LH_KANOTIX_NVIDIA="$2" + shift + ;; + --tmpfs) + LH_KANOTIX_TMPFS="$2" + shift + ;; + --tmpfs-options) + LH_KANOTIX_TMPFS_OPTIONS="$2" + shift + ;; + --help|-h) + lh config noauto --help + usage + exit 1 + ;; + *) + args[$i]="$1" + ((i++)) + ;; + esac + shift +done + +set -- "${args[@]}" + +write_kanotix_config + diff --git a/config/chroot_local-includes/etc/kanotix-version b/config/chroot_local-includes/etc/kanotix-version deleted file mode 100644 index 887f2bb..0000000 --- a/config/chroot_local-includes/etc/kanotix-version +++ /dev/null @@ -1 +0,0 @@ -Kanotix Hellfire 64bit 20100902-14:54 diff --git a/tmpfs.disabled/README b/tmpfs.disabled/README deleted file mode 100644 index cf9b913..0000000 --- a/tmpfs.disabled/README +++ /dev/null @@ -1,23 +0,0 @@ -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 deleted file mode 100644 index 560761c..0000000 --- a/tmpfs.disabled/options +++ /dev/null @@ -1 +0,0 @@ -size=6G -- cgit v1.0