Made first_run_setup actually work when ~/.config/qq2clone is defined

This commit is contained in:
Jesse Gardner 2021-04-15 17:18:44 -07:00
parent e8c5077d60
commit d0db223eb9
1 changed files with 7 additions and 5 deletions

View File

@ -349,8 +349,7 @@ first_run_setup ()
# PARAMETERS: None
#=========================================================================#
{
local QQ2_DIR="${HOME}/storage-qq2clone"
echo "$QQ2_DIR" > "${HOME}/.config/qq2clone"
echo "$QQ2_DIR" > "${HOME}/.config/qq2clone" 2>/dev/null
# Default locations of key directories
local TEMPLATE_DIR="${QQ2_DIR}/templates"
@ -359,8 +358,6 @@ local POOL_DIR="${QQ2_DIR}/qq2clone-pool"
check_rw "$QQ2_DIR"
check_depends
[[ -e "${QQ2_DIR}/qq2clone.db" ]] && return 0
make_dir "$TEMPLATE_DIR"
make_dir "$POOL_DIR"
check_rw -r "$TEMPLATE_DIR" "$POOL_DIR"
@ -3124,7 +3121,12 @@ return 0
if ! ((QQ2_NOEXECUTE)); then
open_pipe
[[ -e "${HOME:?}/.config/qq2clone" ]] || first_run_setup
if [[ -e "${HOME:?}/.config/qq2clone" ]]; then
QQ2_DIR="$(<"${HOME}/.config/qq2clone")"
else
QQ2_DIR="${HOME}/storage-qq2clone"
fi
[[ -e "${QQ2_DIR}/qq2clone.db" ]] || first_run_setup
get_config
exec_com "$@"
exit 0