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