mirror of
https://github.com/mail-in-a-box/mailinabox.git
synced 2025-04-11 01:27:17 +00:00
fix capture state and populate working directory errors
This commit is contained in:
parent
80decc3f71
commit
b731de2f66
@ -332,11 +332,27 @@ upstream_install() {
|
|||||||
H2 "miab install success"
|
H2 "miab install success"
|
||||||
|
|
||||||
if [ "$need_pop" = "yes" ]; then
|
if [ "$need_pop" = "yes" ]; then
|
||||||
|
if [ ! -e tests/vagrant ]; then
|
||||||
|
# if this is an upstream install, then populate using
|
||||||
|
# miabldap's populate scripts (upstream doesn't have any)
|
||||||
|
local d
|
||||||
|
d=$(pwd)
|
||||||
|
popd >/dev/null
|
||||||
|
populate_by_cli_argument "$@"
|
||||||
|
pushd "$d" >/dev/null
|
||||||
|
else
|
||||||
|
# otherwise populate using branch-supplied populate scripts
|
||||||
|
populate_by_cli_argument "$@"
|
||||||
|
fi
|
||||||
|
# state capture must be run from the source tree corresponding to the
|
||||||
|
# the installed state
|
||||||
|
capture_state_by_cli_argument "$@"
|
||||||
popd >/dev/null
|
popd >/dev/null
|
||||||
|
else
|
||||||
|
# populate if specified on command line
|
||||||
|
populate_by_cli_argument "$@"
|
||||||
|
capture_state_by_cli_argument "$@"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# populate if specified on command line
|
|
||||||
populate_by_cli_argument "$@"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -392,38 +408,51 @@ miab_ldap_install() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
H2 "miab-ldap install success"
|
H2 "miab-ldap install success"
|
||||||
|
|
||||||
if [ "need_pop" = "yes" ]; then
|
|
||||||
popd >/dev/null
|
|
||||||
fi
|
|
||||||
|
|
||||||
# populate if specified on command line
|
# populate if specified on command line
|
||||||
populate_by_cli_argument "$@"
|
populate_by_cli_argument "$@"
|
||||||
|
capture_state_by_cli_argument "$@"
|
||||||
|
|
||||||
|
if [ "need_pop" = "yes" ]; then
|
||||||
|
popd >/dev/null
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
populate_by_cli_argument() {
|
capture_state_by_cli_argument() {
|
||||||
|
# this must be run with the working directory set to the source
|
||||||
|
# tree corresponding to the the installed state
|
||||||
|
|
||||||
# ...ignore unknown options they may be interpreted elsewhere
|
# ...ignore unknown options they may be interpreted elsewhere
|
||||||
local populate_names=()
|
|
||||||
local state_dir=""
|
local state_dir=""
|
||||||
for arg; do
|
for arg; do
|
||||||
case "$arg" in
|
case "$arg" in
|
||||||
--populate=* )
|
|
||||||
populate_names+=( $(awk -F= '{print $2}' <<<"$arg") )
|
|
||||||
;;
|
|
||||||
--capture-state=* )
|
--capture-state=* )
|
||||||
state_dir=$(awk -F= '{print $2}' <<<"$arg")
|
state_dir=$(awk -F= '{print $2}' <<<"$arg")
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ ${#populate_names} -gt 0 ]; then
|
|
||||||
populate_by_name "${populate_names[@]}"
|
|
||||||
fi
|
|
||||||
if [ ! -z "$state_dir" ]; then
|
if [ ! -z "$state_dir" ]; then
|
||||||
installed_state_capture "$state_dir"
|
installed_state_capture "$state_dir"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
populate_by_cli_argument() {
|
||||||
|
# ...ignore unknown options they may be interpreted elsewhere
|
||||||
|
local populate_names=()
|
||||||
|
for arg; do
|
||||||
|
case "$arg" in
|
||||||
|
--populate=* )
|
||||||
|
populate_names+=( $(awk -F= '{print $2}' <<<"$arg") )
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ ${#populate_names} -gt 0 ]; then
|
||||||
|
populate_by_name "${populate_names[@]}"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
populate_by_name() {
|
populate_by_name() {
|
||||||
local populate_name
|
local populate_name
|
||||||
for populate_name; do
|
for populate_name; do
|
||||||
|
Loading…
Reference in New Issue
Block a user