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/$distro" ] || {
echo "No Project \"$distro\" is not supported"
return 3
}
#live-system files
if [ -f "$iso_source" ]; then
if [ -n "$iso_destination" ] && [ -d "${iso_destination%/*}" ]; then
#Lable
[ -z "$iso_lable" ] && iso_lable="$distro"
echo 'iso_source -> iso_destination'
echo 'iso_source -> squashfs [optinal]'
else
if [ -n "$filesystem_source" ] && [ -d "${filesystem_source%/*}" ]; then
echo 'iso_source -> squashfs'
else
# ERROR
echo "No corect AIM in Settings"
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"
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 $@
}