remaster/src/func/check_config

56 lines
1.3 KiB
Bash
Executable File

#!/bin/bash
#remaster lib
[ -d "<LIBDIR>" ] || { echo "LIBDIR not exist"; exit 1; }
#check_config
function check_config() {
#Project
[ -f "<LIBDIR>/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" ] && {
check_config $@
}