commit 34518fa716d0c2386d252bc3e0648efda0509e49
parent 532bb665e6f08990b2c6b1884c5c4f9aff11170d
Author: oscarbenedito <oscar@obenedito.org>
Date: Mon, 25 Nov 2019 17:57:07 +0100
Bug fixes
Diffstat:
3 files changed, 19 insertions(+), 7 deletions(-)
diff --git a/.chezmoi.toml.tmpl b/.chezmoi.toml.tmpl
@@ -1,10 +1,12 @@
{{ $pgpkey := promptString "Is there a PGP key set up" -}}
{{ $website := promptString "Is the website repository under ~/Git/obenedito.org" -}}
{{ $backups := promptString "Set up backups" -}}
+{{ $loc := promptString "Chezmoi executable location" -}}
[data]
pgpkey = {{ $pgpkey }}
website = {{ $website }}
-{{- if backups }}
+ chezmoi_location = "{{ $loc }}"
+{{- if eq $backups "true" }}
{{- $backup_exclude := promptString "backup_exclude" }}
{{- $small_backup_exclude := promptString "small_backup_exclude" }}
{{- $backup_dir := promptString "backup_dir" }}
diff --git a/.gitignore b/.gitignore
@@ -1,3 +1,5 @@
+*.swp
+
dot_vimrc
dot_bash_aliases.tmpl
dot_gitconfig.tmpl
diff --git a/dot_bash_aliases.tmpl.md b/dot_bash_aliases.tmpl.md
@@ -3,7 +3,7 @@ Alias to run Markion everytime we use chezmoi, before actually running chezmoi.
``` file dot_bash_aliases.tmpl
chezmoi() {
sh $HOME/.local/share/chezmoi/markion.sh
- /bin/chezmoi $*
+ {{ .chezmoi_location }} $*
}
```
@@ -24,8 +24,7 @@ alias upgrade="
## Backups
If backup is enabled in the `chezmoi` data, create backup alias, excluding the files specified in the `chezmoi` data. First is the complete backup alias:
-``` file dot_bash_aliases.tmpl
-{{- if .backup }}
+``` block backup_all
alias backup_all="rsync -gloptruzvP --delete --no-group --exclude={
{{- range $i, $dir := .backup.backup_exclude }}
{{- if $i -}}
@@ -54,7 +53,6 @@ rsync -gloptruzvP --delete --exclude={"/Git",
,"{{ $dir }}"
{{- end -}}
} {{ .chezmoi.homedir }}/ /media/veracrypt10/{{ .backup.backup_dir }}/
-{{- end }}
rsync -gloptruzvP --delete {{ .chezmoi.homedir }}/Git/ /media/veracrypt11/{{ .backup.backup_dir }}/
```
@@ -65,7 +63,7 @@ veracrypt --dismount /media/$USER/Oscar/Varis/copia-gris-git.hc
```
So the alias will be:
-``` file dot_bash_aliases.tmpl
+``` block backup_vc_10_11
backup_vc_10_11() {
[[ include mount-backup-vc ]]
[[ include rsync-small-backup ]]
@@ -75,10 +73,20 @@ backup_vc_10_11() {
### USB Backups
The following alias is used when backing up my USB drive.
-``` file dot_bash_aliases.tmpl
+``` block backup_usb
alias backup_usb="rsync -gloptruzvP --delete --exclude={"/Varis/copia-gris.hc","/Varis/copia-gris-git.hc"} /media/$USER/Oscar/ {{ .chezmoi.homedir }}/USB/"
```
+### Writing the backups
+Finally, we include the aliases to the file.
+``` file dot_bash_aliases.tmpl
+{{- if .backup }}
+[[ include backup_all ]]
+[[ include backup_vc_10_11 ]]
+[[ include backup_usb ]]
+{{- end }}
+```
+
## Website
If website is enabled in the `chezmoi` configuration, we create aliases to the scripts to open the website working environment the to deploy the website.
``` file dot_bash_aliases.tmpl