fix check
This commit is contained in:
51
Run.sh
51
Run.sh
@@ -46,40 +46,47 @@ function show_help() {
|
||||
echo
|
||||
}
|
||||
|
||||
### Check if a directory does not exist ###
|
||||
if [ ! -d $OUTPUT_DIR ]
|
||||
then
|
||||
echo "incorrect <UT99_INSTALL_DIR>"
|
||||
show_help
|
||||
exit 9999 # die with error code 9999
|
||||
fi
|
||||
function check_cfg_file() {
|
||||
if [ -z ${CFG_FILE} ]
|
||||
then
|
||||
echo "CFG_FILE is unset, setting it to $DEFAULT_CFG_FILE"
|
||||
CFG_FILE=$DEFAULT_CFG_FILE
|
||||
else
|
||||
echo "CFG_FILE is set to '$CFG_FILE'"
|
||||
fi
|
||||
|
||||
### handle config file
|
||||
if [ -z ${CFG_FILE} ]
|
||||
then
|
||||
echo "CFG_FILE is unset, setting it to $DEFAULT_CFG_FILE"
|
||||
CFG_FILE=$DEFAULT_CFG_FILE
|
||||
else
|
||||
echo "CFG_FILE is set to '$CFG_FILE'"
|
||||
fi
|
||||
if [ ! -f $OUTPUT_DIR/System/$CFG_FILE ]
|
||||
then
|
||||
echo "$OUTPUT_DIR/System/$CFG_FILE does not exist"
|
||||
show_help
|
||||
exit 9999 # die with error code 9999
|
||||
fi
|
||||
}
|
||||
|
||||
### Check config file exists
|
||||
if [ ! -f $OUTPUT_DIR/System/$CFG_FILE ]
|
||||
then
|
||||
echo "$OUTPUT_DIR/System/$CFG_FILE does not exist"
|
||||
show_help
|
||||
exit 9999 # die with error code 9999
|
||||
fi
|
||||
function check_game_dir() {
|
||||
### Check if a directory does not exist ###
|
||||
if [ ! -d $OUTPUT_DIR ]
|
||||
then
|
||||
echo "incorrect <UT99_INSTALL_DIR>"
|
||||
show_help
|
||||
exit 9999 # die with error code 9999
|
||||
fi
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
'install')
|
||||
check_game_dir
|
||||
install
|
||||
;;
|
||||
'enable')
|
||||
check_game_dir
|
||||
check_cfg_file
|
||||
disable
|
||||
enable
|
||||
;;
|
||||
'disable')
|
||||
check_game_dir
|
||||
check_cfg_file
|
||||
disable
|
||||
;;
|
||||
*)
|
||||
|
||||
Reference in New Issue
Block a user