diff options
author | Dieter Plaetinck <dieter@plaetinck.be> | 2008-12-12 22:43:17 +0100 |
---|---|---|
committer | Dieter Plaetinck <dieter@plaetinck.be> | 2008-12-12 22:43:17 +0100 |
commit | 5cb52946e51297ac2a4779a159f742e3619f4c6e (patch) | |
tree | c0b687bc23b5222f666e3bca644be1579f5bdbb9 | |
parent | 3366ec0f156b500d94a667ff18ea9044432d6a9d (diff) |
cleanup stale files on start and stop + long overdue introduction of $RUNTIME_DIR
-rwxr-xr-x | src/aif.sh | 15 | ||||
-rw-r--r-- | src/core/libs/lib-blockdevices-filesystems.sh | 10 | ||||
-rw-r--r-- | src/core/libs/lib-misc.sh | 13 | ||||
-rw-r--r-- | src/core/libs/lib-software.sh | 4 | ||||
-rw-r--r-- | src/core/libs/lib-ui.sh | 4 | ||||
-rw-r--r-- | src/core/procedures/base | 2 |
6 files changed, 32 insertions, 16 deletions
@@ -3,7 +3,8 @@ ###### Set some default variables ###### TITLE="Arch Linux Installation Framework" LOG="/dev/tty7" -LOGFILE=/home/arch/aif/runtime/aif.log +RUNTIME_DIR=/home/arch/aif/runtime +LOGFILE=$RUNTIME_DIR/aif.log ###### Miscalleaneous functions ###### @@ -91,7 +92,7 @@ load_procedure() if [ "$1" = 'http:' ] then log "Loading procedure $2 ..." - procedure=/home/arch/aif/runtime/procedure-downloaded-`basename $2` + procedure=$RUNTIME_DIR/procedure-downloaded-`basename $2` wget "$2" -q -O $procedure >/dev/null || die_error "Could not download procedure $2" else log "Loading procedure $1/procedures/$2 ..." @@ -237,11 +238,19 @@ process_args () } +start_installer () +{ + log "################## START OF INSTALLATION ##################" + cleanup_runtime +} + + # use this function to stop the installation procedure. # $1 exit code (optional) stop_installer () { log "-------------- STOPPING INSTALLATION ----------" + cleanup_runtime exit $1 } @@ -320,7 +329,7 @@ load_procedure "$module" "$procedure" PACMAN=pacman PACMAN_TARGET="pacman --root $var_TARGET_DIR --config /tmp/pacman.conf" -log "################## START OF INSTALLATION ##################" +start_installer start_process diff --git a/src/core/libs/lib-blockdevices-filesystems.sh b/src/core/libs/lib-blockdevices-filesystems.sh index 5638f84..6bfa823 100644 --- a/src/core/libs/lib-blockdevices-filesystems.sh +++ b/src/core/libs/lib-blockdevices-filesystems.sh @@ -22,11 +22,11 @@ modprobe aes-i586 || show_warning modprobe 'Could not modprobe aes-i586. no supp -TMP_DEV_MAP=/home/arch/aif/runtime/dev.map -TMP_FSTAB=/home/arch/aif/runtime/.fstab -TMP_PARTITIONS=/home/arch/aif/runtime/.partitions -TMP_FILESYSTEMS=/home/arch/aif/runtime/.filesystems # Only used internally by this library. Do not even think about using this as interface to this library. it won't work -TMP_BLOCKDEVICES=/home/arch/aif/runtime/.blockdata +TMP_DEV_MAP=$RUNTIME_DIR/dev.map +TMP_FSTAB=$RUNTIME_DIR/.fstab +TMP_PARTITIONS=$RUNTIME_DIR/.partitions +TMP_FILESYSTEMS=$RUNTIME_DIR/.filesystems # Only used internally by this library. Do not even think about using this as interface to this library. it won't work +TMP_BLOCKDEVICES=$RUNTIME_DIR/.blockdata diff --git a/src/core/libs/lib-misc.sh b/src/core/libs/lib-misc.sh index fd2ebb8..29e4c2e 100644 --- a/src/core/libs/lib-misc.sh +++ b/src/core/libs/lib-misc.sh @@ -14,7 +14,7 @@ run_background () debug "run_background called. identifier: $1, command: $2, logfile: $3" ( \ - touch /home/arch/aif/runtime/$1-running + touch $RUNTIME_DIR/$1-running debug "run_background starting $1: $2 >>$3 2>&1" [ -f $3 ] && echo -e "\n\n\n" >>$3 echo "STARTING $1 . Executing $2 >>$3 2>&1\n" >> $3; @@ -23,7 +23,7 @@ run_background () read $var_exit <<< $? #TODO: bash complains about 'not a valid identifier' debug "run_background done with $1: exitcode (\$$1_exitcode): "${!var_exit}" .Logfile $3" #TODO ${!var_exit} doesn't show anything --> maybe fixed now echo >> $3 - rm -f /home/arch/aif/runtime/$1-running + rm -f $RUNTIME_DIR/$1-running ) & sleep 2 @@ -36,7 +36,7 @@ wait_for () { [ -z "$1" ] && die_error "wait_for needs an identifier to known on which command to wait!" - while [ -f /home/arch/aif/runtime/$1-running ] + while [ -f $RUNTIME_DIR/$1-running ] do #TODO: follow_progress dialog mode = nonblocking (so check and sleep is good), cli mode (tail -f )= blocking? (so check is probably not needed as it will be done) sleep 1 @@ -60,3 +60,10 @@ check_is_in () done return 1 } + + +# cleans up file in the runtime directory who can be deleted +cleanup_runtime () +{ + rm -rf $RUNTIME_DIR/.dia* &>/dev/null +}
\ No newline at end of file diff --git a/src/core/libs/lib-software.sh b/src/core/libs/lib-software.sh index 1785e85..af26137 100644 --- a/src/core/libs/lib-software.sh +++ b/src/core/libs/lib-software.sh @@ -1,7 +1,7 @@ #!/bin/sh -TMP_MKINITCPIO_LOG=/home/arch/aif/runtime/mkinitcpio.log -TMP_PACMAN_LOG=/home/arch/aif/runtime/pacman.log +TMP_MKINITCPIO_LOG=$RUNTIME_DIR/mkinitcpio.log +TMP_PACMAN_LOG=$RUNTIME_DIR/pacman.log # run_mkinitcpio() taken from setup. adapted a lot # runs mkinitcpio on the target system, displays output diff --git a/src/core/libs/lib-ui.sh b/src/core/libs/lib-ui.sh index bb7511e..3f64ee6 100644 --- a/src/core/libs/lib-ui.sh +++ b/src/core/libs/lib-ui.sh @@ -6,9 +6,9 @@ # Taken from setup. we store dialog output in a file. TODO: can't we do this with variables? ASKDEV -ANSWER="/home/arch/aif/runtime/.dialog-answer" +ANSWER=$RUNTIME_DIR/.dialog-answer DIA_MENU_TEXT="Use the UP and DOWN arrows to navigate menus. Use TAB to switch between buttons and ENTER to select." -DIA_SUCCESSIVE_ITEMS="/home/arch/aif/runtime/.dia-successive-items" +DIA_SUCCESSIVE_ITEMS=$RUNTIME_DIR/.dia-successive-items ### Functions that your code can use. Cli/dialog mode is fully transparant. This library takes care of it ### diff --git a/src/core/procedures/base b/src/core/procedures/base index 374f5ff..3797e0a 100644 --- a/src/core/procedures/base +++ b/src/core/procedures/base @@ -3,7 +3,7 @@ var_DEFAULTFS="/boot:32:ext2:+ swap:256:swap /:7500:ext3 /home:*:ext3" var_TARGET_DIR="/mnt" # When overriding this, do _not_ add a trailing /. It's not needed and maybe you could even break something var_RUNTIME_PACKAGES= -var_PKG_FILE=/home/arch/aif/runtime/package-list +var_PKG_FILE=$RUNTIME_DIR/package-list var_UI_TYPE="cli" # set to cli or dia for dialog ###### Phases ( can be overridden by more specific procedures) ###### |