diff --git a/src/config.sample.cfg b/src/config.sample.cfg index 30cbfbb..aaa223e 100644 --- a/src/config.sample.cfg +++ b/src/config.sample.cfg @@ -9,8 +9,8 @@ # -> bei iso gen erforderlich! iso_source="/data/remaster/desinfect-2017.iso" #destination optinal -iso_aim="/data/remaster/result/custom_desinfect_`date '+%Y-%m-%d'`.iso" -iso_lable="DESINFECT_`date '+%Y-%m-%d'`" +iso_aim="/data/remaster/result/custom_desinfect_.iso" +iso_lable="DESINFECT_" #Filesystem (for pxe) #entweder iso_source oder squashfs_path alls quelle @@ -26,7 +26,7 @@ nameserver="10.x.x.2,10.x.x.1" project="desinfect.17" #LOG -log_file="/data/remaster/logs/`date '+%Y-%m-%d'`.log" +log_file="/data/remaster/logs/.log" log_mail_source="desinfect@email.clocal" log_mail_smtp="smtp.mail.local:25" log_mail_aim="6543@email.clocal" diff --git a/src/func/check_config b/src/func/check_config old mode 100755 new mode 100644 index 313332a..9b03322 --- a/src/func/check_config +++ b/src/func/check_config @@ -2,8 +2,8 @@ #remaster lib [ -d "" ] || { echo "LIBDIR not exist"; exit 1; } -#check_config -function check_config() { +#config_check +function config_check() { #Project [ -f "/proj/$project" ] || { @@ -51,5 +51,5 @@ function check_config() { #this func is standalone executable [ -n "$1" ] && { - check_config $@ + config_check $@ } diff --git a/src/func/config_check b/src/func/config_check new file mode 100755 index 0000000..9b03322 --- /dev/null +++ b/src/func/config_check @@ -0,0 +1,55 @@ +#!/bin/bash +#remaster lib +[ -d "" ] || { echo "LIBDIR not exist"; exit 1; } + +#config_check +function config_check() { + + #Project + [ -f "/proj/$project" ] || { + echo "No Project \"$project\" is not supported" + return 3 + } + + #live-system files + if [ -f "$iso_source" ]; then + if [ -n "$iso_aim" ] && [ -d "${iso_aim%/*}" ]; then + #Lable + [ -z "$iso_lable" ] && iso_lable="$project" + + echo 'iso_source -> iso_aim' + echo 'iso_source -> squashfs [optinal]' + else + if [ -n "$squashfs_path" ] && [ -d "${squashfs_path%/*}" ]; then + echo 'iso_source -> squashfs' + else + # ERROR + echo "No corect AIM in Settings" + return 3 + fi + fi + else + if [ -f "$squashfs_path" ]; then + if [ -n "$iso_aim" ]; then + # ERROR + echo "only Squashfs source in Settings, cant creat ISO" + return 3 + else + echo 'squashfs -> squashfs' + fi + else + # ERROR + echo "No corect Source in Settings" + return 3 + fi + fi + + + + +} + +#this func is standalone executable +[ -n "$1" ] && { + config_check $@ +} diff --git a/src/func/config_load b/src/func/config_load new file mode 100644 index 0000000..a9a7bf0 --- /dev/null +++ b/src/func/config_load @@ -0,0 +1,59 @@ +#!/bin/bash +#remaster lib +[ -d "" ] || { echo "LIBDIR not exist"; exit 1; } + +#config_load config +function config_load() { + config="$1" + + echo "### S e t t i n g s ###" + + ##load project + export "`cat "$config" | grep ^[^#] | grep ^project= | cut -d "#" -f 1 | tr -d '"'`" + + #check if project template exist + [ -f "/proj/$project" ] || { + echo "No Project \"$project\" is not supported" + return 3 + } + # loard project + source "/proj/$project" + + echo; echo #space + + cat "$config" | grep ^[^#] | cut -d "#" -f 1 | grep '=' | while read line; do + #read each var line + config_key=`echo $line | cut -d "=" -f 1` + config_value=`echo $line | cut -d "=" -f 2 | tr -d '"'` + config_corect="false" + + #check if this is a alowed config key + for i in $config_keys; do + [ "$i" == "$config_key" ] && config_corect="true" + done + + if [ "$config_corect" == "true" ]; then + #load config key + + #replace value strings + config_value="${config_value//`date '+%Y-%m-%d'`}" + config_value="${config_value/