diff options
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/action.source.sh | 2 | ||||
| -rw-r--r-- | src/lib/album.source.sh | 10 | ||||
| -rw-r--r-- | src/lib/bootstrap.source.sh | 1 | ||||
| -rw-r--r-- | src/lib/config.print.source.sh | 1 | ||||
| -rw-r--r-- | src/lib/config.source.sh | 3 | ||||
| -rw-r--r-- | src/lib/config.validate.source.sh | 13 |
6 files changed, 28 insertions, 2 deletions
diff --git a/src/lib/action.source.sh b/src/lib/action.source.sh index e2649d7..12be053 100644 --- a/src/lib/action.source.sh +++ b/src/lib/action.source.sh @@ -42,6 +42,7 @@ run_action_body_context() { INCOMING_DIR DIST_DIR TEMPLATE_DIR + FAVICON TITLE HEIGHT THUMBHEIGHT @@ -155,6 +156,7 @@ log_configured_action() { log_verbose "Effective incoming directory: ${INCOMING_DIR:-}" log_verbose "Effective output directory: ${DIST_DIR:-}" log_verbose "Effective template directory: ${TEMPLATE_DIR:-}" + log_verbose "Effective favicon: ${FAVICON:-(bundled default)}" log_verbose "Effective image jobs: $IMAGE_JOBS" log_verbose "Effective ImageMagick timeout: ${IMAGEMAGICK_TIMEOUT}s" log_verbose "Effective tar timeout: ${TAR_TIMEOUT}s" diff --git a/src/lib/album.source.sh b/src/lib/album.source.sh index 532c218..08509fb 100644 --- a/src/lib/album.source.sh +++ b/src/lib/album.source.sh @@ -1047,8 +1047,14 @@ copy_site_favicon() { local asset_dir local favicon_src - asset_dir=$(resolve_default_asset_dir) - favicon_src="$asset_dir/favicon.ico" + # Use the configured favicon when set, otherwise the bundled default. Either + # way it is published as favicon.ico (the name the templates link to). + if [ -n "${FAVICON:-}" ]; then + favicon_src="$FAVICON" + else + asset_dir=$(resolve_default_asset_dir) + favicon_src="$asset_dir/favicon.ico" + fi if [ ! -r "$favicon_src" ]; then config_error "favicon file $favicon_src must be readable" diff --git a/src/lib/bootstrap.source.sh b/src/lib/bootstrap.source.sh index a047f5d..2b19e58 100644 --- a/src/lib/bootstrap.source.sh +++ b/src/lib/bootstrap.source.sh @@ -15,6 +15,7 @@ usage() { --incoming PATH --dist PATH --template PATH + --favicon PATH --title TEXT --height VALUE --thumbheight VALUE diff --git a/src/lib/config.print.source.sh b/src/lib/config.print.source.sh index 7b91b60..c5fe2b4 100644 --- a/src/lib/config.print.source.sh +++ b/src/lib/config.print.source.sh @@ -27,6 +27,7 @@ print_config() { print_shell_assignment INCOMING_DIR "$INCOMING_DIR" print_shell_assignment DIST_DIR "$DIST_DIR" print_shell_assignment TEMPLATE_DIR "$TEMPLATE_DIR" + print_shell_assignment FAVICON "$FAVICON" print_shell_assignment TITLE "$TITLE" print_shell_assignment HEIGHT "$HEIGHT" print_shell_assignment THUMBHEIGHT "$THUMBHEIGHT" diff --git a/src/lib/config.source.sh b/src/lib/config.source.sh index 50c331a..c13e807 100644 --- a/src/lib/config.source.sh +++ b/src/lib/config.source.sh @@ -30,6 +30,9 @@ missing_config() { } apply_config_defaults() { + # Empty FAVICON means use the bundled default favicon; otherwise it is a path + # to a custom favicon file copied into the album as favicon.ico. + FAVICON="${FAVICON:-}" HEIGHT="${HEIGHT:-}" IMAGE_JOBS="${IMAGE_JOBS:-3}" IMAGEMAGICK_TIMEOUT="${IMAGEMAGICK_TIMEOUT:-60}" diff --git a/src/lib/config.validate.source.sh b/src/lib/config.validate.source.sh index bd2fccf..fda20f0 100644 --- a/src/lib/config.validate.source.sh +++ b/src/lib/config.validate.source.sh @@ -195,6 +195,19 @@ validate_common_config() { validate_yes_no_config_var SPLASH_PAGE || return validate_yes_no_config_var STATS_PAGE || return validate_yes_no_config_var TARBALL_INCLUDE || return + validate_favicon_config || return +} + +# A custom FAVICON (when set) must be a readable file; empty means the bundled +# default favicon is used. +validate_favicon_config() { + if [ -z "${FAVICON:-}" ]; then + return + fi + if [ ! -f "$FAVICON" ] || [ ! -r "$FAVICON" ]; then + config_error "FAVICON file $FAVICON must be a readable file" + return 1 + fi } validate_generation_config() { |
