Skip to content

Commit 1bf39d0

Browse files
feat: add backup scripts
1 parent 364b20f commit 1bf39d0

File tree

4 files changed

+48
-0
lines changed

4 files changed

+48
-0
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,6 @@ $ dot config --local status.showUntrackedFiles no
2929
- [zoxide](https://github.com/ajeetdsouza/zoxide)
3030
- [zsh-syntax-highlighting](https://github.com/zsh-users/zsh-syntax-highlighting)
3131
- [zsh-vi-mode](https://github.com/jeffreytse/zsh-vi-mode)
32+
33+
---
34+
`$ gpg --keyserver keys.openpgp.org --recv-keys 1B90D025DC9A8E35`

scripts/backup

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/usr/bin/env zsh
2+
3+
. ~/.env
4+
5+
restic backup \
6+
--exclude-caches \
7+
--exclude 'node_modules/*' \
8+
--exclude 'build/*' \
9+
--exclude 'dist/*' \
10+
--exclude 'target/*' \
11+
--exclude 'cache/*' \
12+
--exclude 'Cache/*' \
13+
--exclude 'caches/*' \
14+
--exclude 'Caches/*' \
15+
--exclude 'Mobile Documents/*' \
16+
--exclude 'CloudStorage/*' \
17+
--exclude=$HOME/{.cache,.npm,.pnpm,.Trash}/\* \
18+
~

scripts/functions/_mount-backup

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#compdef mount-backup
2+
3+
_path_files -W "$HOME/.restic" -g '*.env(:r)' -S ' '

scripts/mount-backup

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/usr/bin/env zsh
2+
3+
name=${1:-mac14}
4+
5+
if [[ ! $name ]] ; then
6+
echo 'incorrect usage: missing NAME' >&2
7+
return 1
8+
fi
9+
10+
envfile="$HOME/.restic/$name.env"
11+
12+
if [ ! -f $envfile ] ; then
13+
echo "missing \`$envfile\` file for: $name" >&2
14+
return 1
15+
fi
16+
17+
dir=$(mktemp -d -t "$name")
18+
trap "rm -rf \"$dir\"" EXIT SIGINT
19+
20+
. $envfile
21+
22+
open $dir
23+
24+
restic mount $dir

0 commit comments

Comments
 (0)