diff --git a/src/func/check_config b/src/func/check_config index 2b68c8c..3a0653f 100755 --- a/src/func/check_config +++ b/src/func/check_config @@ -2,12 +2,31 @@ #remaster lib [ -d "" ] || { echo "LIBDIR not exist"; exit 1; } -# -function () { - #Code of +#check_config [param] +function check_config() { + + #LOG + [ -z "$log_file" ] && log_file="/tmp/remaster_`date '+%Y-%m-%d'`" + + if [ -f "$log_file" ]; then + echo > "$log_file" + else + #check if folder exist + [ -d "${log_file%/*}" ] || { + # N-> exit 3 + echo "Directory for Log didnt exist" + exit 3 + } + #create LOG + touch "$log_file" + fi + + + + } #this func is standalone executable [ -n "$1" ] && { - $@ + check_config $@ } diff --git a/src/remaster.sh b/src/remaster.sh index 8874202..dd6202f 100755 --- a/src/remaster.sh +++ b/src/remaster.sh @@ -32,8 +32,7 @@ fi #remaster.sh renew function main_renew() { - - [ -f "$log_file" ] || touch "$log_file" + check_config tail -f "$log_file" --pid="$$" & chroot_path="`mktemp -d`" @@ -195,8 +194,7 @@ function main_renew() { #remaster.sh update_pxe function main_update_pxe() { - [ "$log_file" == "" ] && log_file="`mktemp`" - [ -f "$log_file" ] || touch "$log_file" + check_config tail -f "$log_file" --pid="$$" & chroot_path="`mktemp -d`" @@ -308,7 +306,7 @@ function main_update_pxe() { #remaster.sh update_iso #in arbeit function main_update_iso() { - [ -f "$log_file" ] || touch "$log_file" + check_config tail -f "$log_file" --pid="$$" & chroot_path="`mktemp -d`"