kopia lustrzana https://github.com/modem7/docker-borgmatic
Add ability to have custom scripts
rodzic
face292d3f
commit
37d5e7f819
12
README.md
12
README.md
|
@ -41,8 +41,16 @@ It uses cron to run the backups at a time you can configure in `data/borgmatic.d
|
||||||
| CRON_COMMAND | Command cron will run | borgmatic --stats -v 0 2>&1 | borgmatic --stats -v 0 2>&1 |
|
| CRON_COMMAND | Command cron will run | borgmatic --stats -v 0 2>&1 | borgmatic --stats -v 0 2>&1 |
|
||||||
| EXTRA_CRON | Extra cron lines | 0 5 2 * * command1 | Empty |
|
| EXTRA_CRON | Extra cron lines | 0 5 2 * * command1 | Empty |
|
||||||
|
|
||||||
## Breaking change
|
## Customising the container
|
||||||
dockercli tag has been removed as there is now a variable to install it at container startup.
|
Simply mount a volume located at /custom-cont-init.d and add any scripts you want. These scripts can contain logic for installing packages, copying over custom files to other locations, or installing plugins.
|
||||||
|
|
||||||
|
For example:
|
||||||
|
```yaml
|
||||||
|
services:
|
||||||
|
borgmatic:
|
||||||
|
volumes:
|
||||||
|
- /home/foo/my-custom-files:/custom-cont-init.d:ro
|
||||||
|
```
|
||||||
|
|
||||||
### Usage
|
### Usage
|
||||||
|
|
||||||
|
|
|
@ -2,13 +2,13 @@
|
||||||
|
|
||||||
# Install DockerCLI if true
|
# Install DockerCLI if true
|
||||||
if [ "${DOCKERCLI}" == "true" ]; then
|
if [ "${DOCKERCLI}" == "true" ]; then
|
||||||
echo "Installing Docker CLI and Compose..."
|
echo "[custom-init] Installing Docker CLI and Compose..."
|
||||||
apk add -U --quiet docker-cli docker-cli-compose
|
apk add -U --quiet docker-cli docker-cli-compose
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Install additional packages
|
# Install additional packages
|
||||||
if [ -v EXTRA_PKGS ]
|
if [ -v EXTRA_PKGS ]
|
||||||
then
|
then
|
||||||
echo Installing extra packages: "$EXTRA_PKGS"
|
echo "[custom-init] Installing extra packages: $EXTRA_PKGS"
|
||||||
apk add -U --quiet $EXTRA_PKGS
|
apk add -U --quiet $EXTRA_PKGS
|
||||||
fi
|
fi
|
|
@ -0,0 +1,21 @@
|
||||||
|
#!/usr/bin/with-contenv bash
|
||||||
|
|
||||||
|
# Directories
|
||||||
|
SCRIPTS_DIR="/custom-cont-init.d"
|
||||||
|
|
||||||
|
# Make sure custom init directory exists and has files in it
|
||||||
|
if [[ -e "${SCRIPTS_DIR}" ]] && [[ -n "$(/bin/ls -A ${SCRIPTS_DIR} 2>/dev/null)" ]]; then
|
||||||
|
echo "[custom-init] Files found, executing"
|
||||||
|
for SCRIPT in "${SCRIPTS_DIR}"/*; do
|
||||||
|
NAME="$(basename "${SCRIPT}")"
|
||||||
|
if [[ -f "${SCRIPT}" ]]; then
|
||||||
|
echo "[custom-init] ${NAME}: executing..."
|
||||||
|
/bin/bash "${SCRIPT}"
|
||||||
|
echo "[custom-init] ${NAME}: exited $?"
|
||||||
|
elif [[ ! -f "${SCRIPT}" ]]; then
|
||||||
|
echo "[custom-init] ${NAME}: is not a file"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
else
|
||||||
|
echo "[custom-init] No custom files found, skipping..."
|
||||||
|
fi
|
|
@ -0,0 +1 @@
|
||||||
|
oneshot
|
|
@ -0,0 +1 @@
|
||||||
|
/etc/s6-overlay/s6-rc.d/init-custom-scripts/run
|
Ładowanie…
Reference in New Issue