rewrites the whole thing
This commit is contained in:
43
mount-volumes.sh
Executable file
43
mount-volumes.sh
Executable file
@@ -0,0 +1,43 @@
|
||||
#! /bin/sh
|
||||
#
|
||||
|
||||
if [ "$(id -u)" -ne 0 ]; then
|
||||
echo "must be ran as root"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
set -a
|
||||
. "${PWD}/.env"
|
||||
. "${PWD}/env_files/manage.env"
|
||||
set +a
|
||||
|
||||
volumes="certs dynamic logs static webroot"
|
||||
for volume in ${volumes}; do
|
||||
mount_path="${PWD}/traefik-volumes/${volume}"
|
||||
volume_path="${DOCKER_VOLUMES_PATH}/${PREFIX}-traefik-${volume}/_data"
|
||||
if [ "${volume}" = "webroot" ]; then
|
||||
mount_path="${PWD}/${volume}-volume"
|
||||
volume_path="${DOCKER_VOLUMES_PATH}/${PREFIX}-${volume}/_data"
|
||||
fi
|
||||
sudo -u "${MOUNT_USER}" mkdir -p "${mount_path}"
|
||||
if mountpoint "${mount_path}" -q; then
|
||||
echo "exiting because something is mounted at ${mount_path}"
|
||||
exit 1
|
||||
fi
|
||||
# if [ -n "$(find "${mount_path}" -maxdepth 0 -type d -empty 2> /dev/null)" ]; then
|
||||
if [ "$(ls -A "${mount_path}")" ]; then
|
||||
echo "${mount_path} is not empty"
|
||||
exit 1
|
||||
fi
|
||||
echo "mounting ${mount_path}"
|
||||
sudo /usr/bin/bindfs \
|
||||
--create-for-group=root \
|
||||
--create-for-user=root \
|
||||
--force-group="${MOUNT_USER}" \
|
||||
--force-user="${MOUNT_USER}" \
|
||||
"${volume_path}" \
|
||||
"${mount_path}"
|
||||
done
|
||||
|
||||
#tree "${PWD}/traefik-volumes"
|
||||
#tree "${PWD}/webroot-volume" -L 1
|
||||
Reference in New Issue
Block a user