mirror of
https://github.com/hackacad/bastille.git
synced 2026-01-04 03:33:41 +01:00
begin moving functions to common.sh
This commit is contained in:
@@ -70,6 +70,36 @@ warn() {
|
||||
echo -e "${COLOR_YELLOW}$*${COLOR_RESET}"
|
||||
}
|
||||
|
||||
# This is where I am placing all new functions.
|
||||
check_if_jail_exists() {
|
||||
TARGET="${1}"
|
||||
JAILS=""
|
||||
if [ -d "${bastille_jailsdir}/${TARGET}" ]; then
|
||||
JAILS="${TARGET}"
|
||||
return 0
|
||||
else
|
||||
error_exit "Jail not found."
|
||||
fi
|
||||
}
|
||||
|
||||
check_target_is_running() {
|
||||
TARGET="${1}"
|
||||
if [ ! "$(/usr/sbin/jls name | awk "/^${TARGET}$/")" ]; then
|
||||
error_exit "[${TARGET}]: Not started. See 'bastille start ${TARGET}'."
|
||||
fi
|
||||
}
|
||||
|
||||
target_all_jails() {
|
||||
_JAILS=$(/usr/sbin/jls name)
|
||||
JAILS=""
|
||||
for _jail in ${_JAILS}; do
|
||||
_JAILPATH=$(/usr/sbin/jls -j "${_jail}" path)
|
||||
if [ -z ${_JAILPATH##${bastille_jailsdir}*} ]; then
|
||||
JAILS="${JAILS} ${_jail}"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
generate_vnet_jail_netblock() {
|
||||
local jail_name="$1"
|
||||
local use_unique_bridge="$2"
|
||||
|
||||
Reference in New Issue
Block a user