log check at init
This commit is contained in:
parent
d11b96947c
commit
74b3a8b12b
@ -2,15 +2,17 @@
|
||||
#remaster lib
|
||||
[ -d "<LIBDIR>" ] || { echo "LIBDIR not exist"; exit 1; }
|
||||
|
||||
#check_config [param]
|
||||
#check_config [log_file]
|
||||
function check_config() {
|
||||
|
||||
#LOG
|
||||
[ -z "$log_file" ] && log_file="/tmp/remaster_`date '+%Y-%m-%d'`"
|
||||
{
|
||||
log_file=$1
|
||||
[ -z "$log_file" ] && log_file="/tmp/remaster_`date '+%Y-%m-%d'`"
|
||||
|
||||
if [ -f "$log_file" ]; then
|
||||
if [ -f "$log_file" ]; then
|
||||
echo > "$log_file"
|
||||
else
|
||||
else
|
||||
#check if folder exist
|
||||
[ -d "${log_file%/*}" ] || {
|
||||
# N-> exit 3
|
||||
@ -19,9 +21,8 @@ function check_config() {
|
||||
}
|
||||
#create LOG
|
||||
touch "$log_file"
|
||||
fi
|
||||
|
||||
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -25,6 +25,23 @@ else
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
#check 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
|
||||
}
|
||||
|
||||
#####################################################################################
|
||||
################## M o d e s ########################################################
|
||||
@ -32,7 +49,7 @@ fi
|
||||
|
||||
#remaster.sh renew
|
||||
function main_renew() {
|
||||
check_config
|
||||
#Start LOG
|
||||
tail -f "$log_file" --pid="$$" &
|
||||
|
||||
chroot_path="`mktemp -d`"
|
||||
@ -89,6 +106,9 @@ function main_renew() {
|
||||
check_dependency
|
||||
error_level="$?"; [ "$error_level" != "0" ] && on_exit $error_level >> "$log_file"
|
||||
|
||||
check_config "$log_file"
|
||||
error_level="$?"; [ "$error_level" != "0" ] && on_exit $error_level >> "$log_file"
|
||||
|
||||
check_update | tee -a "$log_file"
|
||||
|
||||
[ "$distro" != "" ] && distro="_$distro"
|
||||
@ -194,7 +214,7 @@ function main_renew() {
|
||||
#remaster.sh update_pxe
|
||||
function main_update_pxe() {
|
||||
|
||||
check_config
|
||||
#Start LOG
|
||||
tail -f "$log_file" --pid="$$" &
|
||||
|
||||
chroot_path="`mktemp -d`"
|
||||
@ -243,6 +263,9 @@ function main_update_pxe() {
|
||||
check_dependency
|
||||
error_level="$?"; [ "$error_level" != "0" ] && on_exit $error_level >> "$log_file"
|
||||
|
||||
check_config "$log_file"
|
||||
error_level="$?"; [ "$error_level" != "0" ] && on_exit $error_level >> "$log_file"
|
||||
|
||||
[ "$distro" != "" ] && distro="_$distro"
|
||||
|
||||
# 1. Entpacken der Dateien des Live-Systems
|
||||
@ -306,7 +329,7 @@ function main_update_pxe() {
|
||||
|
||||
#remaster.sh update_iso #in arbeit
|
||||
function main_update_iso() {
|
||||
check_config
|
||||
#Start LOG
|
||||
tail -f "$log_file" --pid="$$" &
|
||||
|
||||
chroot_path="`mktemp -d`"
|
||||
@ -365,6 +388,9 @@ function main_update_iso() {
|
||||
check_dependency
|
||||
error_level="$?"; [ "$error_level" != "0" ] && on_exit $error_level >> "$log_file"
|
||||
|
||||
check_config "$log_file"
|
||||
error_level="$?"; [ "$error_level" != "0" ] && on_exit $error_level >> "$log_file"
|
||||
|
||||
[ "$distro" != "" ] && distro="_$distro"
|
||||
|
||||
# 2. Entpacke ISO
|
||||
|
Loading…
Reference in New Issue
Block a user