From e36bd93c143f6b9296c1471180871afc67a1a452 Mon Sep 17 00:00:00 2001 From: casjay Date: Fri, 21 Oct 2022 02:22:52 -0400 Subject: [PATCH] =?UTF-8?q?=F0=9F=97=83=EF=B8=8F=20Committing=20everything?= =?UTF-8?q?=20that=20changed=20=F0=9F=97=83=EF=B8=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- rootfs/usr/local/bin/entrypoint.sh | 36 +++++++++++++++++++++++++----- 1 file changed, 30 insertions(+), 6 deletions(-) diff --git a/rootfs/usr/local/bin/entrypoint.sh b/rootfs/usr/local/bin/entrypoint.sh index 6377fd0..463de4e 100755 --- a/rootfs/usr/local/bin/entrypoint.sh +++ b/rootfs/usr/local/bin/entrypoint.sh @@ -169,8 +169,10 @@ SET_USR_BIN="" if [ -n "$SET_USR_BIN" ]; then echo "Setting up bin" for create_bin in $SET_USR_BIN; do - create_bin_name="$(basename "$create_bin")" - ln -sf "$create_bin" "$LOCAL_BIN_DIR/$create_bin_name" + if [ -n "$create_bin" ]; then + create_bin_name="$(basename "$create_bin")" + ln -sf "$create_bin" "$LOCAL_BIN_DIR/$create_bin_name" + fi done fi # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -180,7 +182,14 @@ if [ "$CONFIG_DIR_INITIALIZED" = "false" ] && [ -d "/config" ]; then if [ -n "$DEFAULT_TEMPLATE_DIR" ] && [ -d "$DEFAULT_TEMPLATE_DIR" ]; then for create_template in "$DEFAULT_TEMPLATE_DIR"/*; do create_template_name="$(basename "$create_template")" - cp -Rf "$create_template" "/config/$create_template_name" 2>/dev/null + if [ -n "$create_template" ]; then + if [ -d "$create_template" ]; then + mkdir -p "/config/$create_template_name/" + cp -Rf "$create_template/." "/config/$create_template_name/" 2>/dev/null + else + cp -Rf "$create_template" "/config/$create_template_name" 2>/dev/null + fi + fi done fi fi @@ -190,7 +199,14 @@ if [ "$CONFIG_DIR_INITIALIZED" = "false" ] && [ -d "/config" ]; then echo "Copying custom config files" for create_config in "$DEFAULT_CONF_DIR"/*; do create_config_name="$(basename "$create_config")" - cp -Rf "$create_config" "/config/$create_config_name" 2>/dev/null + if [ -n "$create_config" ]; then + if [ -d "$create_config" ]; then + mkdir -p "/config/$create_config_name" + cp -Rf "$create_config/." "/config/$create_config_name/" 2>/dev/null + else + cp -Rf "$create_config" "/config/$create_config_name" 2>/dev/null + fi + fi done fi # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -199,18 +215,26 @@ if [ "$DATA_DIR_INITIALIZED" = "false" ] && [ -d "/data" ]; then echo "Copying data files" for create_data in "$DEFAULT_DATA_DIR"/*; do create_data_name="$(basename "$create_data")" - cp -Rf "$create_data" "/data/$create_data_name" 2>/dev/null + if [ -n "$create_data" ]; then + if [ -d "$create_data" ]; then + mkdir -p "/data/$create_data_name" + cp -Rf "$create_data/." "/data/$create_data_name/" 2>/dev/null + else + cp -Rf "$create_data" "/data/$create_data_name" 2>/dev/null + fi + fi done fi # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # Copy /config to /etc if [ -d "/config" ]; then - [ "$DATA_DIR_INITIALIZED" = "false" ] && echo "Copying /config to /etc" + [ "$CONFIG_DIR_INITIALIZED" = "false" ] && echo "Copying /config to /etc" for create_conf in /config/*; do if [ -n "$create_conf" ]; then create_conf_name="$(basename "$create_conf")" if [ -e "/etc/$create_conf_name" ]; then if [ -d "/etc/$create_conf_name" ]; then + mkdir -p "/etc/$create_conf_name/" cp -Rf "$create_conf/." "/etc/$create_conf_name/" 2>/dev/null else cp -Rf "$create_conf" "/etc/$create_conf_name" 2>/dev/null