diff --git a/client/docker-finance.d/client/Dockerfiles/dev-tools/Dockerfile.dev-tools.in b/client/docker-finance.d/client/Dockerfiles/dev-tools/Dockerfile.dev-tools.in index 3f7ddba..7e5b60b 100644 --- a/client/docker-finance.d/client/Dockerfiles/dev-tools/Dockerfile.dev-tools.in +++ b/client/docker-finance.d/client/Dockerfiles/dev-tools/Dockerfile.dev-tools.in @@ -15,6 +15,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +# docker-finance @DOCKER_FINANCE_VERSION@ + # # Custom (optional) Dockerfile # diff --git a/client/docker-finance.d/client/Dockerfiles/finance/Dockerfile.archlinux.in b/client/docker-finance.d/client/Dockerfiles/finance/Dockerfile.archlinux.in index c4c9076..504c44e 100644 --- a/client/docker-finance.d/client/Dockerfiles/finance/Dockerfile.archlinux.in +++ b/client/docker-finance.d/client/Dockerfiles/finance/Dockerfile.archlinux.in @@ -15,6 +15,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +# docker-finance @DOCKER_FINANCE_VERSION@ + # # Custom (optional) Dockerfile # diff --git a/client/docker-finance.d/client/Dockerfiles/finance/Dockerfile.ubuntu.in b/client/docker-finance.d/client/Dockerfiles/finance/Dockerfile.ubuntu.in index 04ecfc2..41bbc92 100644 --- a/client/docker-finance.d/client/Dockerfiles/finance/Dockerfile.ubuntu.in +++ b/client/docker-finance.d/client/Dockerfiles/finance/Dockerfile.ubuntu.in @@ -15,6 +15,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +# docker-finance @DOCKER_FINANCE_VERSION@ + # # Custom (optional) Dockerfile # diff --git a/client/docker-finance.d/container/fetch/fetch.yaml.in b/client/docker-finance.d/container/fetch/fetch.yaml.in index 1844361..d6561ba 100644 --- a/client/docker-finance.d/container/fetch/fetch.yaml.in +++ b/client/docker-finance.d/container/fetch/fetch.yaml.in @@ -15,6 +15,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +# docker-finance @DOCKER_FINANCE_VERSION@ + # # Configuration for `fetch` command # diff --git a/client/src/docker/lib/internal/lib_docker.bash b/client/src/docker/lib/internal/lib_docker.bash index 15cde64..802f6d5 100644 --- a/client/src/docker/lib/internal/lib_docker.bash +++ b/client/src/docker/lib/internal/lib_docker.bash @@ -74,6 +74,7 @@ function lib_docker::__docker() -e "s|@DOCKER_FINANCE_IMAGE@|${global_image}:${global_tag}|g" \ -e "s|@DOCKER_FINANCE_CONTAINER@|${global_container}|g" \ -e "s|@DOCKER_FINANCE_NETWORK@|${global_network}|g" \ + -e "/^ *#/d" -e "/^$/d" \ "${_path}.${global_platform}.in" >"$_path" || return $? } @@ -318,6 +319,9 @@ function lib_docker::__build() echo -e "# WARNING: keep at end of file\nUSER ${DOCKER_FINANCE_USER}\nWORKDIR /home/${DOCKER_FINANCE_USER}\n" \ >>"$_final" + # Remove all comments and empty lines + sed -i -e "/^ *#/d" -e "/^$/d" "$_final" + # # Execute # diff --git a/client/src/docker/lib/internal/lib_gen.bash b/client/src/docker/lib/internal/lib_gen.bash index d8ddb29..da23470 100644 --- a/client/src/docker/lib/internal/lib_gen.bash +++ b/client/src/docker/lib/internal/lib_gen.bash @@ -455,7 +455,6 @@ function lib_gen::__gen_client() local _confirm="${_read:-y}" if [[ "$_confirm" == [yY] || -z "$global_arg_confirm" ]]; then cp -a "$global_custom_dockerfile" "${global_custom_dockerfile}_${global_suffix}" || lib_utils::die_fatal - cp -fa "$global_repo_custom_dockerfile" "$global_custom_dockerfile" || lib_utils::die_fatal fi else lib_utils::print_custom " \e[32m│\e[0m\n" @@ -463,10 +462,16 @@ function lib_gen::__gen_client() lib_utils::print_debug "$global_repo_custom_dockerfile" lib_utils::print_debug "$global_custom_dockerfile" - - cp -a "$global_repo_custom_dockerfile" "$global_custom_dockerfile" fi + # Filter to de-clutter output file (license cleanup) + local -r _filter="1,17d" + + sed \ + -e "$_filter" \ + -e "s:@DOCKER_FINANCE_VERSION@:${global_client_version}:g" \ + "$global_repo_custom_dockerfile" >"$global_custom_dockerfile" || lib_utils::die_fatal + lib_utils::print_custom " \e[32m│ └─\e[34m Edit file now? [Y/n] \e[0m" lib_gen::__gen_edit "$global_custom_dockerfile" fi @@ -580,7 +585,11 @@ function lib_gen::__gen_superscript_write() [ -z "$global_superscript" ] && lib_utils::die_fatal lib_utils::print_debug "global_superscript=${global_superscript}" + # Filter to de-clutter output file (license cleanup) + local -r _filter="3,19d" + sed \ + -e "$_filter" \ -e "s:@DOCKER_FINANCE_VERSION@:${global_client_version}:g" \ "${global_repo_conf_dir}/container/shell/superscript.bash.in" >"$global_superscript" } @@ -846,7 +855,11 @@ function lib_gen::__gen_subprofile_flow_subscript_write() [ -z "$global_client_version" ] && lib_utils::die_fatal [ -z "$global_repo_conf_dir" ] && lib_utils::die_fatal + # Filter to de-clutter output file (license cleanup) + local -r _filter="3,19d" + sed \ + -e "$_filter" \ -e "s:@DOCKER_FINANCE_CONTAINER_CMD@:${DOCKER_FINANCE_CONTAINER_CMD}:g" \ -e "s:@DOCKER_FINANCE_CONTAINER_REPO@:${DOCKER_FINANCE_CONTAINER_REPO}:g" \ -e "s:@DOCKER_FINANCE_VERSION@:${global_client_version}:g" \ @@ -917,7 +930,11 @@ function lib_gen::__gen_subprofile_flow_fetch_write() [ -z "$global_client_version" ] && lib_utils::die_fatal [ -z "$global_repo_conf_dir" ] && lib_utils::die_fatal + # Filter to de-clutter output file (license cleanup) + local -r _filter="1,17d" + sed \ + -e "$_filter" \ -e "s:@DOCKER_FINANCE_VERSION@:${global_client_version}:g" \ -e "s:@DOCKER_FINANCE_PROFILE@:${_profile}:g" \ -e "s:@DOCKER_FINANCE_SUBPROFILE@:${_subprofile}:g" \ @@ -965,6 +982,7 @@ function lib_gen::__gen_subprofile_flow_meta_write() [ -z "$global_repo_conf_dir" ] && lib_utils::die_fatal # Deletes default comments or else ROOT meta sample won't work out-of-the-box + # TODO: possible to keep filtered comments using upstream options? sed \ -e "/\/\/\\!/d" \ -e "s:@DOCKER_FINANCE_VERSION@:${global_client_version}:g" \ @@ -1013,7 +1031,11 @@ function lib_gen::__gen_subprofile_flow_hledger_write() [ -z "$global_repo_conf_dir" ] && lib_utils::die_fatal lib_utils::print_debug "global_repo_conf_dir=${global_repo_conf_dir}" + # Filter to de-clutter output file (license cleanup) + local -r _filter="1,17d" + sed \ + -e "$_filter" \ -e "s:@DOCKER_FINANCE_VERSION@:${global_client_version}:g" \ "${global_repo_conf_dir}/container/hledger/hledger.conf.in" >"$_file" }