move link functionality into utils as a sh function
This commit is contained in:
parent
caae172589
commit
67821fcc0d
|
@ -7,6 +7,9 @@ trap "kill 0" EXIT
|
|||
# Source in util.sh so we can have our nice tools
|
||||
. $(cd $(dirname $0); pwd)/util.sh
|
||||
|
||||
# first include any user configs if they've been mounted
|
||||
link_user_configs
|
||||
|
||||
# Immediately run auto_enable_configs so that nginx is in a runnable state
|
||||
auto_enable_configs
|
||||
|
||||
|
|
|
@ -1,15 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
SOURCE_DIR=/etc/nginx/user.conf.d
|
||||
TARGET_DIR=/etc/nginx/conf.d
|
||||
|
||||
echo "symlinking scripts from ${SOURCE_DIR} to ${TARGET_DIR}"
|
||||
|
||||
if [ ! -d "$SOURCE_DIR" ]; then
|
||||
echo "no ${SOURCE_DIR}, nothing to do."
|
||||
else
|
||||
for conf in ${SOURCE_DIR}/*.conf; do
|
||||
echo "symlinking: ${conf}" "${TARGET_DIR}/$(basename ${conf})"
|
||||
ln -s "${conf}" "${TARGET_DIR}/$(basename ${conf})"
|
||||
done
|
||||
fi
|
|
@ -91,3 +91,22 @@ is_renewal_required() {
|
|||
is_finshed_week_sec=$(( ($one_week_sec - $last_renewal_delta_sec) ))
|
||||
[ $is_finshed_week_sec -lt 0 ]
|
||||
}
|
||||
|
||||
# symlinks any *.conf files in /etc/nginx/user.conf.d
|
||||
# to /etc/nginx/conf.d so they are included as configs
|
||||
# this allows a user to easily mount their own configs
|
||||
link_user_configs() {
|
||||
SOURCE_DIR=${1-/etc/nginx/user.conf.d}
|
||||
TARGET_DIR=${2-/etc/nginx/conf.d}
|
||||
|
||||
echo "symlinking scripts from ${SOURCE_DIR} to ${TARGET_DIR}"
|
||||
|
||||
if [ ! -d "$SOURCE_DIR" ]; then
|
||||
echo "no ${SOURCE_DIR}, nothing to do."
|
||||
else
|
||||
for conf in ${SOURCE_DIR}/*.conf; do
|
||||
echo "symlinking: ${conf}" "${TARGET_DIR}/$(basename ${conf})"
|
||||
ln -s "${conf}" "${TARGET_DIR}/$(basename ${conf})"
|
||||
done
|
||||
fi
|
||||
}
|
Loading…
Reference in New Issue