Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions usr/local/share/vulture-utils/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,11 @@ sublist() {
return $((_index_stop - _index_start + 1))
}

contains() {
contains_word() {
_list="$1"
_elem_in_list="$2"
_word_in_list="$2"

if echo "${_list}" | grep -q "${_elem_in_list}"; then
if echo "${_list}" | grep -qw "${_word_in_list}"; then
return 0
else
return 1
Expand Down
2 changes: 1 addition & 1 deletion usr/local/share/vulture-utils/restore.sh
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ for _type in ${AVAILABLE_DATASET_TYPES}; do
fi

# Ignore datasets not explicitely selected from here
if ! contains "${_rollback_datasets_list}" "${_type}"; then
if ! contains_word "${_rollback_datasets_list}" "${_type}"; then
continue
fi

Expand Down
2 changes: 1 addition & 1 deletion usr/local/share/vulture-utils/snapshot.sh
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ for _type in ${AVAILABLE_DATASET_TYPES}; do
# snapshotting datasets
else
# Ignore datasets not explicitely selected
if ! contains "${_snapshot_datasets_list}" "${_type}"; then
if ! contains_word "${_snapshot_datasets_list}" "${_type}"; then
continue
fi
if [ "${_type}" = "DB" ] && [ "${_mongo_locked}" -eq 0 ]; then
Expand Down
10 changes: 7 additions & 3 deletions usr/local/share/vulture-utils/upgrade-pkg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,10 @@ while [ $# -gt 0 ]; do
esac
done

if contains_word "$targets" "all"; then
targets=""
fi

if [ $clean_cache -gt 0 ] && [ $download_only -gt 0 ]; then
error_and_exit "[!] Cannot activate -c if -D or -T are set"
fi
Expand All @@ -231,7 +235,7 @@ fi

# If no argument or jail asked
for jail in "haproxy" "redis" "mongodb" "rsyslog" ; do
if [ -z "${targets}" ] || contains "$targets" "$jail" ; then
if [ -z "${targets}" ] || contains_word "$targets" "$jail" ; then

/bin/echo "[+] Updating jail $jail packages..."
IGNORE_OSVERSION="yes" /usr/sbin/pkg -j "$jail" update -f || finalize 1 "Could not update list of packages for jail ${jail}"
Expand Down Expand Up @@ -284,7 +288,7 @@ for jail in "haproxy" "redis" "mongodb" "rsyslog" ; do
done

# No parameter, or gui
if [ -z "${targets}" ] || contains "${targets}" "gui" ; then
if [ -z "${targets}" ] || contains_word "${targets}" "gui" ; then
echo "[+] Updating GUI..."
_gui_was_up=1
/usr/sbin/jexec apache /usr/sbin/service gunicorn stop
Expand Down Expand Up @@ -321,7 +325,7 @@ if [ -z "${targets}" ] || contains "${targets}" "gui" ; then
echo "[-] GUI updated."
fi

if [ -z "${targets}" ] || contains "${targets}" "base" ; then
if [ -z "${targets}" ] || contains_word "${targets}" "base" ; then
echo "[+] Updating vulture-base ..."
# shellcheck disable=SC2086
IGNORE_OSVERSION="yes" /usr/sbin/pkg upgrade ${_pkg_options} -y vulture-base || finalize 1 "Failed to upgrade vulture-base"
Expand Down