[arkdep] Add ARKDEP_DATABASE override
This commit is contained in:
parent
b3b58bab56
commit
25f6105305
2 changed files with 13 additions and 4 deletions
15
arkdep
15
arkdep
|
@ -54,6 +54,13 @@ fi
|
||||||
# If ARKDEP_ROOT is defined we imply confirm
|
# If ARKDEP_ROOT is defined we imply confirm
|
||||||
[[ -n $ARKDEP_ROOT ]] && declare -r ARKDEP_CONFIRM=1
|
[[ -n $ARKDEP_ROOT ]] && declare -r ARKDEP_CONFIRM=1
|
||||||
|
|
||||||
|
# Override database name if ARKDEP_DATABASE is defined
|
||||||
|
if [[ -n $ARKDEP_DATABASE ]]; then
|
||||||
|
declare -r database_name=$ARKDEP_DATABASE
|
||||||
|
else
|
||||||
|
declare -r database_name='database'
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ ! -d $arkdep_dir ]] && [[ ! $1 == 'init' ]]; then
|
if [[ ! -d $arkdep_dir ]] && [[ ! $1 == 'init' ]]; then
|
||||||
printf "\e[1;31m<#>\e[0m\e[1m Arkdep does not seem to be managing this system or the provided file path is incorrect for $arkdep_dir was not found\e[0m\n"
|
printf "\e[1;31m<#>\e[0m\e[1m Arkdep does not seem to be managing this system or the provided file path is incorrect for $arkdep_dir was not found\e[0m\n"
|
||||||
exit 1
|
exit 1
|
||||||
|
@ -648,7 +655,7 @@ diff () {
|
||||||
if [[ -n $2 ]] && [[ $2 != '-' ]]; then
|
if [[ -n $2 ]] && [[ $2 != '-' ]]; then
|
||||||
# Param was provided, set target to param
|
# Param was provided, set target to param
|
||||||
# Get ID of (partially) defined entry
|
# Get ID of (partially) defined entry
|
||||||
declare curl_data=($(curl -sf "$repo_url/$diff_target/database" || printf 'ERROR'))
|
declare curl_data=($(curl -sf "$repo_url/$diff_target/$database_name" || printf 'ERROR'))
|
||||||
|
|
||||||
if [[ $curl_data == 'ERROR' ]]; then
|
if [[ $curl_data == 'ERROR' ]]; then
|
||||||
printf '\e[1;31m<#>\e[0m Failed to download database\e[0m\n'
|
printf '\e[1;31m<#>\e[0m Failed to download database\e[0m\n'
|
||||||
|
@ -664,7 +671,7 @@ diff () {
|
||||||
else
|
else
|
||||||
# No param was provided, set first db entry as target
|
# No param was provided, set first db entry as target
|
||||||
# Get ID of latest entry
|
# Get ID of latest entry
|
||||||
declare curl_data=($(curl -sf "$repo_url/$diff_target/database" || printf 'ERROR'))
|
declare curl_data=($(curl -sf "$repo_url/$diff_target/$database_name" || printf 'ERROR'))
|
||||||
|
|
||||||
if [[ $curl_data == 'ERROR' ]]; then
|
if [[ $curl_data == 'ERROR' ]]; then
|
||||||
printf '\e[1;31m<#>\e[0m Failed to download database\e[0m\n'
|
printf '\e[1;31m<#>\e[0m Failed to download database\e[0m\n'
|
||||||
|
@ -825,14 +832,14 @@ deploy () {
|
||||||
# If latest is requested grab database and get first line
|
# If latest is requested grab database and get first line
|
||||||
printf '\e[1;34m-->\e[0m\e[1m Downloading database\e[0m\n'
|
printf '\e[1;34m-->\e[0m\e[1m Downloading database\e[0m\n'
|
||||||
if [[ $deploy_version == 'latest' ]]; then
|
if [[ $deploy_version == 'latest' ]]; then
|
||||||
declare curl_data=($(curl -sf "${repo_url}/${deploy_target}/database" || printf 'ERROR'))
|
declare curl_data=($(curl -sf "${repo_url}/${deploy_target}/$database_name" || printf 'ERROR'))
|
||||||
|
|
||||||
[[ $curl_data == 'ERROR' ]] && cleanup_and_quit 'Failed to download database file'
|
[[ $curl_data == 'ERROR' ]] && cleanup_and_quit 'Failed to download database file'
|
||||||
|
|
||||||
declare -r database_hit=${curl_data[0]}
|
declare -r database_hit=${curl_data[0]}
|
||||||
elif [[ $deploy_target != 'cache' ]]; then
|
elif [[ $deploy_target != 'cache' ]]; then
|
||||||
# Only return first hit
|
# Only return first hit
|
||||||
declare curl_data=($(curl -sf "${repo_url}/${deploy_target}/database" || printf 'ERROR'))
|
declare curl_data=($(curl -sf "${repo_url}/${deploy_target}/$database_name" || printf 'ERROR'))
|
||||||
|
|
||||||
[[ $curl_data == 'ERROR' ]] && cleanup_and_quit 'Failed to download database file'
|
[[ $curl_data == 'ERROR' ]] && cleanup_and_quit 'Failed to download database file'
|
||||||
|
|
||||||
|
|
|
@ -35,6 +35,8 @@ Set custom /boot location, overwrites ARKDEP_ROOT on relevant tasks if set.
|
||||||
Skip interactive prompts.
|
Skip interactive prompts.
|
||||||
.SS ARKDEP_CONFIG
|
.SS ARKDEP_CONFIG
|
||||||
Override configuration file location.
|
Override configuration file location.
|
||||||
|
.SS ARKDEP_DATABASE
|
||||||
|
Override repository database filename.
|
||||||
.SH EXAMPLES
|
.SH EXAMPLES
|
||||||
.SS arkdep deploy
|
.SS arkdep deploy
|
||||||
Check for updates, if available download and deploy.
|
Check for updates, if available download and deploy.
|
||||||
|
|
Loading…
Add table
Reference in a new issue