Hi!

The reason why dirinstall does not work as expected when using a relative path
is IMHO fairly deep inside fai: task_defvar performs a "cd /" ...

The attached patch replaces this with a proper cd command and removes another cd
/ at the end of FAI.

The patch is untested and may break other (then buggy) parts of FAI.

Best,
Michael

Index: lib/subroutines
===================================================================
--- lib/subroutines     (revision 4117)
+++ lib/subroutines     (working copy)
@@ -335,6 +335,7 @@
 task_defvar() {
 
     local svar=$LOGDIR/showvar.log
+    local cdir=`pwd`
     cd $FAI/class
     for class in $classes ; do
        if [ -f $class.var ]; then
@@ -357,7 +358,7 @@
     unset class svar
     # now all variables are defined. Dump them to variables.log
     set | perl -ne 'print if /^\w\w+=/ and not 
/^(BASH_VERSINFO|EUID|PPID|SHELLOPTS|UID|rootpw|ROOTPW|HOME|PWD)/' > 
$LOGDIR/variables.log
-    cd /
+    cd $cdir
 }
 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 task_mountdisks() {
@@ -398,7 +399,6 @@
     [ "$flag_reboot" -lt "1" ] && read
     echo "Rebooting $HOSTNAME now"
     sendmon REBOOT
-    cd /
     sync
 
     killall -q sshd udevd

Attachment: pgpVrl1Ta8vIv.pgp
Description: PGP signature

Reply via email to