Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Moved the source of CONFIG_APPEND_FILES to 'init' stage (see: issue r…
- Loading branch information
Showing
2 changed files
with
44 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
usr/share/rear/init/default/005_set_config_append_files.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
|
||
if drlm_is_managed ; then | ||
return 0 | ||
fi | ||
|
||
# source additional configuration files if specified on the command line: | ||
if test "$CONFIG_APPEND_FILES" ; then | ||
for config_append_file in $CONFIG_APPEND_FILES ; do | ||
# If what is specified on the command line starts with '/' an absolute path is meant | ||
# otherwise what is specified on the command line means a file in CONFIG_DIR. | ||
# Files in CONFIG_DIR get automatically copied into the recovery system but | ||
# other files are added to COPY_AS_IS to get them copied into the recovery system: | ||
case "$config_append_file" in | ||
(/*) | ||
config_append_file_path="$config_append_file" | ||
# If "-C foo" was specified on the command line but 'foo' does not exist | ||
# try if 'foo.conf' exists and if yes, use that: | ||
if test -r "$config_append_file_path" ; then | ||
COPY_AS_IS=( "${COPY_AS_IS[@]}" "$config_append_file_path" ) | ||
else if test -r "$config_append_file_path.conf" ; then | ||
COPY_AS_IS=( "${COPY_AS_IS[@]}" "$config_append_file_path.conf" ) | ||
else | ||
Error "There is '-C $config_append_file' but neither '$config_append_file_path' nor '$config_append_file_path.conf' can be read." | ||
fi | ||
fi | ||
;; | ||
(*) | ||
config_append_file_path="$CONFIG_DIR/$config_append_file" | ||
;; | ||
esac | ||
# If "-C foo" was specified on the command line but 'foo' does not exist | ||
# try if 'foo.conf' exists and if yes, use that: | ||
if test -r "$config_append_file_path" ; then | ||
LogPrint "Sourcing additional configuration file '$config_append_file_path'" | ||
Source "$config_append_file_path" | ||
else if test -r "$config_append_file_path.conf" ; then | ||
LogPrint "Sourcing additional configuration file '$config_append_file_path.conf'" | ||
Source "$config_append_file_path.conf" | ||
else | ||
Error "There is '-C $config_append_file' but neither '$config_append_file_path' nor '$config_append_file_path.conf' can be read." | ||
fi | ||
fi | ||
done | ||
fi |