commit 6c9426334d393e1da954e65b5fbfc01d45f1a72f from: Thomas Böhler date: Fri Dec 22 09:53:58 2023 UTC Add meson to install files Signed-off-by: Thomas Böhler commit - cf1036fdfb27ce10ea883e83ae727538272a48ef commit + 6c9426334d393e1da954e65b5fbfc01d45f1a72f blob - ee8eff5285ad5bcbb20e257cb23e8813d8ba724a blob + 80392d5fe8c95dc8018bd5eb0be74513cfe4cbc7 --- README.md +++ README.md @@ -10,17 +10,23 @@ restic-backup.sh /path/to/config.sh ## Installation -Put `restic-backup.sh` somewhere in `$PATH` and `config.sh` somewhere. Don't -forget to make `config.sh` user-readable only as it contains sensitive -information. +``` +meson setup build +cd build +sudo meson install +``` +Copy the example `config.sh` to a desired location (i.e. +`/etc/backup/config.sh`). Don't forget to make `config.sh` user-readable only +as it contains sensitive information. + ## Modifying the repository Source `config.sh` in an interactive shell to be able to easily inspect the repository without giving the repository location or password manually every time a command is run. -For example: +For example, to list all the snapshots stored in the repository: ```sh source /path/to/config.sh blob - /dev/null blob + 5e7909493b52d0fc9f4156c603e5be0715a7ab0c (mode 644) --- /dev/null +++ .gitignore @@ -0,0 +1,2 @@ +build +.build blob - ac38a523c2c94fa24b018d62981e57db376c0b29 (mode 644) blob + /dev/null --- config.sh +++ /dev/null @@ -1,25 +0,0 @@ -REMOTE_PROTOCOL="PROTOCOL" # TODO: replace me -REMOTE_USERNAME="USER" # TODO: replace me -REMOTE_HOSTNAME="HOSTNAME.TLD" # TODO: replace me -REMOTE_REPOSITORY_PATH="/path/to/repo" # TODO: replace me -REMOTE_URL="${REMOTE_PROTOCOL}:${REMOTE_USERNAME}@${REMOTE_HOSTNAME}" - -REMOTE_FORGET_KEEP="30" # TODO: replace me -REMOTE_KEEP_HOURLY="48" # TODO: replace me -REMOTE_KEEP_DAILY="14" # TODO: replace me -REMOTE_KEEP_WEEKLY="8" # TODO: replace me -REMOTE_KEEP_MONTHLY="12" # TODO: replace me -REMOTE_KEEP_YEARLY="5" # TODO: replace me - -CONFIG_HOME="${XDG_CONFIG_HOME:-${HOME}/.config}" # TODO: replace me -CONFIG_PATH="${CONFIG_HOME}/backup" # TODO: replace me - -REPOSITORY_PASSWORD="hunter2" # TODO: replace me -EXCLUDE_FILE_PATH="${CONFIG_PATH}/excludes.txt" # TODO: replace me -FILES_FROM_PATH="${CONFIG_PATH}/files_from.txt" # TODO: replace me -BACKUP_DIRECTORY="${HOME}" # TODO: replace me - -RESTIC_OPTIONS="--quiet" - -export RESTIC_REPOSITORY="${REMOTE_URL}:${REMOTE_REPOSITORY_PATH}" -export RESTIC_PASSWORD="${REPOSITORY_PASSWORD}" blob - /dev/null blob + 61726c9a1d736dba68ac9e2d7425f3a813bd41b9 (mode 644) --- /dev/null +++ examples/config.sh @@ -0,0 +1,29 @@ +# protocol to use for uploading the backup +REMOTE_PROTOCOL="PROTOCOL" +# username of the remote machine +REMOTE_USERNAME="USER" +# hostname of the remote machine +REMOTE_HOSTNAME="HOSTNAME.TLD" +# path to the repo on the remote machine +REMOTE_REPOSITORY_PATH="/path/to/repo" +REMOTE_URL="${REMOTE_PROTOCOL}:${REMOTE_USERNAME}@${REMOTE_HOSTNAME}" + +REMOTE_FORGET_KEEP="30" +REMOTE_KEEP_HOURLY="48" +REMOTE_KEEP_DAILY="14" +REMOTE_KEEP_WEEKLY="8" +REMOTE_KEEP_MONTHLY="12" +REMOTE_KEEP_YEARLY="5" + +CONFIG_PATH="/path/to/confdir" + +REPOSITORY_PASSWORD="hunter2" +EXCLUDE_FILE_PATH="${CONFIG_PATH}/excludes.txt" +FILES_FROM_PATH="${CONFIG_PATH}/files_from.txt" +BACKUP_DIRECTORY="/path/to/backup" + +# avoid unnecessary output in logs +RESTIC_OPTIONS="--quiet" + +export RESTIC_REPOSITORY="${REMOTE_URL}:${REMOTE_REPOSITORY_PATH}" +export RESTIC_PASSWORD="${REPOSITORY_PASSWORD}" blob - /dev/null blob + 4ce92b5396847bd6c183bdcde1f8c072a3a97066 (mode 644) --- /dev/null +++ examples/crontab @@ -0,0 +1,3 @@ +0 * * * * restic-backup.sh /path/to/confdir/config.sh | logger -t backup + +# vim: ft=crontab blob - /dev/null blob + a90761a5cbb4be11b43e42bc873dfc41da5f62bb (mode 644) --- /dev/null +++ meson.build @@ -0,0 +1,3 @@ +project('backup') + +install_data('restic-backup.sh', install_dir: get_option('bindir'))