remaster/src/func/check_config

77 lines
1.8 KiB
Plaintext
Raw Normal View History

2018-05-20 19:02:45 +00:00
#!/bin/bash
#remaster lib
[ -d "<LIBDIR>" ] || { echo "LIBDIR not exist"; exit 1; }
2018-05-20 20:43:33 +00:00
#check_config [log_file]
2018-05-20 19:53:56 +00:00
function check_config() {
#LOG
2018-05-20 20:43:33 +00:00
{
log_file=$1
[ -z "$log_file" ] && log_file="/tmp/remaster_`date '+%Y-%m-%d'`"
2018-05-20 19:53:56 +00:00
2018-05-20 20:43:33 +00:00
if [ -f "$log_file" ]; then
2018-05-20 19:53:56 +00:00
echo > "$log_file"
2018-05-20 20:43:33 +00:00
else
2018-05-20 19:53:56 +00:00
#check if folder exist
[ -d "${log_file%/*}" ] || {
# N-> exit 3
echo "Directory for Log didnt exist"
exit 3
}
#create LOG
touch "$log_file"
2018-05-20 20:43:33 +00:00
fi
}
2018-05-20 19:53:56 +00:00
2018-05-20 20:52:20 +00:00
#Project
[ -f "<LIBDIR>/proj/$distro" ] || {
2018-05-20 20:55:54 +00:00
echo "No Project \"$distro\" is not supported" | tee -a "$log_file"
2018-05-20 20:52:20 +00:00
return 3
}
2018-05-20 20:53:00 +00:00
#live-system files
2018-05-20 20:44:33 +00:00
if [ -f "$iso_source" ]; then
if [ -n "$iso_destination" ] && [ -d "${iso_destination%/*}" ]; then
2018-05-20 20:55:54 +00:00
#Lable
[ -z "$iso_lable" ] && iso_lable="$distro"
2018-05-20 20:44:33 +00:00
# iso_source -> iso_destination
# iso_source -> squashfs [optinal]
else
if [ -n "$filesystem_source" ] && [ -d "${filesystem_source%/*}" ]; then
# iso_source -> squashfs
else
# ERROR
echo "No corect AIM in Settings" | tee -a "$log_file"
return 3
fi
fi
else
if [ -f "$filesystem_source" ]; then
if [ -n "$iso_destination" ]; then
# ERROR
echo "only Squashfs source in Settings, cant creat ISO" | tee -a "$log_file"
return 3
else
# squashfs -> squashfs
fi
else
# ERROR
echo "No corect Source in Settings" | tee -a "$log_file"
return 3
fi
fi
2018-05-20 20:53:00 +00:00
2018-05-20 19:02:45 +00:00
}
#this func is standalone executable
[ -n "$1" ] && {
2018-05-20 19:53:56 +00:00
check_config $@
2018-05-20 19:02:45 +00:00
}