mirror of
https://gitlab.com/shorewall/code.git
synced 2024-12-22 22:30:58 +01:00
Fail if the rc file can not be loaded
Signed-off-by: Matt Darfeuille <matdarf@gmail.com> Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
parent
a9048b63f2
commit
f6f7e691d0
@ -104,14 +104,14 @@ done
|
|||||||
#
|
#
|
||||||
if [ $# -eq 0 ]; then
|
if [ $# -eq 0 ]; then
|
||||||
if [ -f ./shorewallrc ]; then
|
if [ -f ./shorewallrc ]; then
|
||||||
. ./shorewallrc
|
|
||||||
file=./shorewallrc
|
file=./shorewallrc
|
||||||
|
. $file || fatal_error "Can not load the RC file: $file"
|
||||||
elif [ -f ~/.shorewallrc ]; then
|
elif [ -f ~/.shorewallrc ]; then
|
||||||
. ~/.shorewallrc || exit 1
|
|
||||||
file=~/.shorewallrc
|
file=~/.shorewallrc
|
||||||
|
. $file || fatal_error "Can not load the RC file: $file"
|
||||||
elif [ -f /usr/share/shorewall/shorewallrc ]; then
|
elif [ -f /usr/share/shorewall/shorewallrc ]; then
|
||||||
. /usr/share/shorewall/shorewallrc
|
|
||||||
file=/usr/share/shorewall/shorewallrc
|
file=/usr/share/shorewall/shorewallrc
|
||||||
|
. $file || fatal_error "Can not load the RC file: $file"
|
||||||
else
|
else
|
||||||
fatal_error "No configuration file specified and /usr/share/shorewall/shorewallrc not found"
|
fatal_error "No configuration file specified and /usr/share/shorewall/shorewallrc not found"
|
||||||
fi
|
fi
|
||||||
@ -125,7 +125,7 @@ elif [ $# -eq 1 ]; then
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
. $file
|
. $file || fatal_error "Can not load the RC file: $file"
|
||||||
else
|
else
|
||||||
usage 1
|
usage 1
|
||||||
fi
|
fi
|
||||||
|
@ -52,11 +52,11 @@ cd "$(dirname $0)"
|
|||||||
#
|
#
|
||||||
if [ $# -eq 0 ]; then
|
if [ $# -eq 0 ]; then
|
||||||
if [ -f ./shorewallrc ]; then
|
if [ -f ./shorewallrc ]; then
|
||||||
. ./shorewallrc
|
. ./shorewallrc || fatal_error "Can not load the RC file: ./shorewallrc"
|
||||||
elif [ -f ~/.shorewallrc ]; then
|
elif [ -f ~/.shorewallrc ]; then
|
||||||
. ~/.shorewallrc || exit 1
|
. ~/.shorewallrc || fatal_error "Can not load the RC file: ~/.shorewallrc"
|
||||||
elif [ -f /usr/share/shorewall/shorewallrc ]; then
|
elif [ -f /usr/share/shorewall/shorewallrc ]; then
|
||||||
. /usr/share/shorewall/shorewallrc
|
. /usr/share/shorewall/shorewallrc || fatal_error "Can not load the RC file: /usr/share/shorewall/shorewallrc"
|
||||||
else
|
else
|
||||||
fatal_error "No configuration file specified and /usr/share/shorewall/shorewallrc not found"
|
fatal_error "No configuration file specified and /usr/share/shorewall/shorewallrc not found"
|
||||||
fi
|
fi
|
||||||
@ -66,11 +66,11 @@ elif [ $# -eq 1 ]; then
|
|||||||
/*|.*)
|
/*|.*)
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
file=./$file
|
file=./$file || exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
. $file
|
. $file || fatal_error "Can not load the RC file: $file"
|
||||||
else
|
else
|
||||||
usage 1
|
usage 1
|
||||||
fi
|
fi
|
||||||
|
@ -114,17 +114,17 @@ done
|
|||||||
# Read the RC file
|
# Read the RC file
|
||||||
#
|
#
|
||||||
if [ $# -eq 0 ]; then
|
if [ $# -eq 0 ]; then
|
||||||
#
|
|
||||||
# Load packager's settings if any
|
|
||||||
#
|
|
||||||
if [ -f ./shorewallrc ]; then
|
if [ -f ./shorewallrc ]; then
|
||||||
. ./shorewallrc || exit 1
|
|
||||||
file=./shorewallrc
|
file=./shorewallrc
|
||||||
|
. $file || fatal_error "Can not load the RC file: $file"
|
||||||
elif [ -f ~/.shorewallrc ]; then
|
elif [ -f ~/.shorewallrc ]; then
|
||||||
. ~/.shorewallrc || exit 1
|
|
||||||
file=~/.shorewallrc
|
file=~/.shorewallrc
|
||||||
else
|
. $file || fatal_error "Can not load the RC file: $file"
|
||||||
fatal_error "No configuration file specified and ~/.shorewallrc not found"
|
elif [ -f /usr/share/shorewall/shorewallrc ]; then
|
||||||
|
file=/usr/share/shorewall/shorewallrc
|
||||||
|
. $file || fatal_error "Can not load the RC file: $file"
|
||||||
|
else
|
||||||
|
fatal_error "No configuration file specified and /usr/share/shorewall/shorewallrc not found"
|
||||||
fi
|
fi
|
||||||
elif [ $# -eq 1 ]; then
|
elif [ $# -eq 1 ]; then
|
||||||
file=$1
|
file=$1
|
||||||
@ -132,11 +132,11 @@ elif [ $# -eq 1 ]; then
|
|||||||
/*|.*)
|
/*|.*)
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
file=./$file
|
file=./$file || exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
. $file
|
. $file || fatal_error "Can not load the RC file: $file"
|
||||||
else
|
else
|
||||||
usage 1
|
usage 1
|
||||||
fi
|
fi
|
||||||
|
@ -83,16 +83,17 @@ while [ $finished -eq 0 ]; do
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
#
|
#
|
||||||
# Read the RC file
|
# Read the RC file
|
||||||
#
|
#
|
||||||
if [ $# -eq 0 ]; then
|
if [ $# -eq 0 ]; then
|
||||||
if [ -f ./shorewallrc ]; then
|
if [ -f ./shorewallrc ]; then
|
||||||
. ./shorewallrc
|
. ./shorewallrc || fatal_error "Can not load the RC file: ./shorewallrc"
|
||||||
elif [ -f ~/.shorewallrc ]; then
|
elif [ -f ~/.shorewallrc ]; then
|
||||||
. ~/.shorewallrc || exit 1
|
. ~/.shorewallrc || fatal_error "Can not load the RC file: ~/.shorewallrc"
|
||||||
elif [ -f /usr/share/shorewall/shorewallrc ]; then
|
elif [ -f /usr/share/shorewall/shorewallrc ]; then
|
||||||
. /usr/share/shorewall/shorewallrc
|
. /usr/share/shorewall/shorewallrc || fatal_error "Can not load the RC file: /usr/share/shorewall/shorewallrc"
|
||||||
else
|
else
|
||||||
fatal_error "No configuration file specified and /usr/share/shorewall/shorewallrc not found"
|
fatal_error "No configuration file specified and /usr/share/shorewall/shorewallrc not found"
|
||||||
fi
|
fi
|
||||||
@ -102,11 +103,11 @@ elif [ $# -eq 1 ]; then
|
|||||||
/*|.*)
|
/*|.*)
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
file=./$file
|
file=./$file || exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
. $file || exit 1
|
. $file || fatal_error "Can not load the RC file: $file"
|
||||||
else
|
else
|
||||||
usage 1
|
usage 1
|
||||||
fi
|
fi
|
||||||
|
@ -116,12 +116,14 @@ done
|
|||||||
#
|
#
|
||||||
if [ $# -eq 0 ]; then
|
if [ $# -eq 0 ]; then
|
||||||
if [ -f ./shorewallrc ]; then
|
if [ -f ./shorewallrc ]; then
|
||||||
. ./shorewallrc || exit 1
|
|
||||||
file=./shorewallrc
|
file=./shorewallrc
|
||||||
|
. $file || fatal_error "Can not load the RC file: $file"
|
||||||
elif [ -f ~/.shorewallrc ]; then
|
elif [ -f ~/.shorewallrc ]; then
|
||||||
. ~/.shorewallrc
|
file=~/.shorewallrc
|
||||||
|
. $file || fatal_error "Can not load the RC file: $file"
|
||||||
elif [ -f /usr/share/shorewall/shorewallrc ]; then
|
elif [ -f /usr/share/shorewall/shorewallrc ]; then
|
||||||
. /usr/share/shorewall/shorewallrc
|
file=/usr/share/shorewall/shorewallrc
|
||||||
|
. $file || fatal_error "Can not load the RC file: $file"
|
||||||
else
|
else
|
||||||
fatal_error "No configuration file specified and /usr/share/shorewall/shorewallrc not found"
|
fatal_error "No configuration file specified and /usr/share/shorewall/shorewallrc not found"
|
||||||
fi
|
fi
|
||||||
@ -131,11 +133,11 @@ elif [ $# -eq 1 ]; then
|
|||||||
/*|.*)
|
/*|.*)
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
file=./$file
|
file=./$file || exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
. $file
|
. $file || fatal_error "Can not load the RC file: $file"
|
||||||
else
|
else
|
||||||
usage 1
|
usage 1
|
||||||
fi
|
fi
|
||||||
|
@ -87,16 +87,17 @@ while [ $finished -eq 0 ]; do
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
#
|
#
|
||||||
# Read the RC file
|
# Read the RC file
|
||||||
#
|
#
|
||||||
if [ $# -eq 0 ]; then
|
if [ $# -eq 0 ]; then
|
||||||
if [ -f ./shorewallrc ]; then
|
if [ -f ./shorewallrc ]; then
|
||||||
. ./shorewallrc
|
. ./shorewallrc || fatal_error "Can not load the RC file: ./shorewallrc"
|
||||||
elif [ -f ~/.shorewallrc ]; then
|
elif [ -f ~/.shorewallrc ]; then
|
||||||
. ~/.shorewallrc || exit 1
|
. ~/.shorewallrc || fatal_error "Can not load the RC file: ~/.shorewallrc"
|
||||||
elif [ -f /usr/share/shorewall/shorewallrc ]; then
|
elif [ -f /usr/share/shorewall/shorewallrc ]; then
|
||||||
. /usr/share/shorewall/shorewallrc
|
. /usr/share/shorewall/shorewallrc || fatal_error "Can not load the RC file: /usr/share/shorewall/shorewallrc"
|
||||||
else
|
else
|
||||||
fatal_error "No configuration file specified and /usr/share/shorewall/shorewallrc not found"
|
fatal_error "No configuration file specified and /usr/share/shorewall/shorewallrc not found"
|
||||||
fi
|
fi
|
||||||
@ -106,11 +107,11 @@ elif [ $# -eq 1 ]; then
|
|||||||
/*|.*)
|
/*|.*)
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
file=./$file
|
file=./$file || exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
. $file
|
. $file || fatal_error "Can not load the RC file: $file"
|
||||||
else
|
else
|
||||||
usage 1
|
usage 1
|
||||||
fi
|
fi
|
||||||
|
@ -129,11 +129,14 @@ done
|
|||||||
#
|
#
|
||||||
if [ $# -eq 0 ]; then
|
if [ $# -eq 0 ]; then
|
||||||
if [ -f ./shorewallrc ]; then
|
if [ -f ./shorewallrc ]; then
|
||||||
. ./shorewallrc
|
file=./shorewallrc
|
||||||
|
. $file || fatal_error "Can not load the RC file: $file"
|
||||||
elif [ -f ~/.shorewallrc ]; then
|
elif [ -f ~/.shorewallrc ]; then
|
||||||
. ~/.shorewallrc || exit 1
|
file=~/.shorewallrc
|
||||||
|
. $file || fatal_error "Can not load the RC file: $file"
|
||||||
elif [ -f /usr/share/shorewall/shorewallrc ]; then
|
elif [ -f /usr/share/shorewall/shorewallrc ]; then
|
||||||
. /usr/share/shorewall/shorewallrc
|
file=/usr/share/shorewall/shorewallrc
|
||||||
|
. $file || fatal_error "Can not load the RC file: $file"
|
||||||
else
|
else
|
||||||
fatal_error "No configuration file specified and /usr/share/shorewall/shorewallrc not found"
|
fatal_error "No configuration file specified and /usr/share/shorewall/shorewallrc not found"
|
||||||
fi
|
fi
|
||||||
@ -143,11 +146,11 @@ elif [ $# -eq 1 ]; then
|
|||||||
/*|.*)
|
/*|.*)
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
file=./$file
|
file=./$file || exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
. $file
|
. $file || fatal_error "Can not load the RC file: $file"
|
||||||
else
|
else
|
||||||
usage 1
|
usage 1
|
||||||
fi
|
fi
|
||||||
|
@ -88,13 +88,16 @@ while [ $finished -eq 0 ]; do
|
|||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
|
#
|
||||||
|
# Read the RC file
|
||||||
|
#
|
||||||
if [ $# -eq 0 ]; then
|
if [ $# -eq 0 ]; then
|
||||||
if [ -f ./shorewallrc ]; then
|
if [ -f ./shorewallrc ]; then
|
||||||
. ./shorewallrc
|
. ./shorewallrc || fatal_error "Can not load the RC file: ./shorewallrc"
|
||||||
elif [ -f ~/.shorewallrc ]; then
|
elif [ -f ~/.shorewallrc ]; then
|
||||||
. ~/.shorewallrc || exit 1
|
. ~/.shorewallrc || fatal_error "Can not load the RC file: ~/.shorewallrc"
|
||||||
elif [ -f /usr/share/shorewall/shorewallrc ]; then
|
elif [ -f /usr/share/shorewall/shorewallrc ]; then
|
||||||
. /usr/share/shorewall/shorewallrc
|
. /usr/share/shorewall/shorewallrc || fatal_error "Can not load the RC file: /usr/share/shorewall/shorewallrc"
|
||||||
else
|
else
|
||||||
fatal_error "No configuration file specified and /usr/share/shorewall/shorewallrc not found"
|
fatal_error "No configuration file specified and /usr/share/shorewall/shorewallrc not found"
|
||||||
fi
|
fi
|
||||||
@ -104,11 +107,11 @@ elif [ $# -eq 1 ]; then
|
|||||||
/*|.*)
|
/*|.*)
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
file=./$file
|
file=./$file || exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
. $file
|
. $file || fatal_error "Can not load the RC file: $file"
|
||||||
else
|
else
|
||||||
usage 1
|
usage 1
|
||||||
fi
|
fi
|
||||||
|
@ -83,16 +83,17 @@ while [ $finished -eq 0 ]; do
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
#
|
#
|
||||||
# Read the RC file
|
# Read the RC file
|
||||||
#
|
#
|
||||||
if [ $# -eq 0 ]; then
|
if [ $# -eq 0 ]; then
|
||||||
if [ -f ./shorewallrc ]; then
|
if [ -f ./shorewallrc ]; then
|
||||||
. ./shorewallrc
|
. ./shorewallrc || fatal_error "Can not load the RC file: ./shorewallrc"
|
||||||
elif [ -f ~/.shorewallrc ]; then
|
elif [ -f ~/.shorewallrc ]; then
|
||||||
. ~/.shorewallrc || exit 1
|
. ~/.shorewallrc || fatal_error "Can not load the RC file: ~/.shorewallrc"
|
||||||
elif [ -f /usr/share/shorewall/shorewallrc ]; then
|
elif [ -f /usr/share/shorewall/shorewallrc ]; then
|
||||||
. /usr/share/shorewall/shorewallrc
|
. /usr/share/shorewall/shorewallrc || fatal_error "Can not load the RC file: /usr/share/shorewall/shorewallrc"
|
||||||
else
|
else
|
||||||
fatal_error "No configuration file specified and /usr/share/shorewall/shorewallrc not found"
|
fatal_error "No configuration file specified and /usr/share/shorewall/shorewallrc not found"
|
||||||
fi
|
fi
|
||||||
@ -102,11 +103,11 @@ elif [ $# -eq 1 ]; then
|
|||||||
/*|.*)
|
/*|.*)
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
file=./$file
|
file=./$file || exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
. $file
|
. $file || fatal_error "Can not load the RC file: $file"
|
||||||
else
|
else
|
||||||
usage 1
|
usage 1
|
||||||
fi
|
fi
|
||||||
|
@ -89,11 +89,11 @@ done
|
|||||||
#
|
#
|
||||||
if [ $# -eq 0 ]; then
|
if [ $# -eq 0 ]; then
|
||||||
if [ -f ./shorewallrc ]; then
|
if [ -f ./shorewallrc ]; then
|
||||||
. ./shorewallrc
|
. ./shorewallrc || fatal_error "Can not load the RC file: ./shorewallrc"
|
||||||
elif [ -f ~/.shorewallrc ]; then
|
elif [ -f ~/.shorewallrc ]; then
|
||||||
. ~/.shorewallrc || exit 1
|
. ~/.shorewallrc || fatal_error "Can not load the RC file: ~/.shorewallrc"
|
||||||
elif [ -f /usr/share/shorewall/shorewallrc ]; then
|
elif [ -f /usr/share/shorewall/shorewallrc ]; then
|
||||||
. /usr/share/shorewall/shorewallrc
|
. /usr/share/shorewall/shorewallrc || fatal_error "Can not load the RC file: /usr/share/shorewall/shorewallrc"
|
||||||
else
|
else
|
||||||
fatal_error "No configuration file specified and /usr/share/shorewall/shorewallrc not found"
|
fatal_error "No configuration file specified and /usr/share/shorewall/shorewallrc not found"
|
||||||
fi
|
fi
|
||||||
@ -103,11 +103,11 @@ elif [ $# -eq 1 ]; then
|
|||||||
/*|.*)
|
/*|.*)
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
file=./$file
|
file=./$file || exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
. $file
|
. $file || fatal_error "Can not load the RC file: $file"
|
||||||
else
|
else
|
||||||
usage 1
|
usage 1
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user