-
-
Notifications
You must be signed in to change notification settings - Fork 12
/
Taskfile.yml
516 lines (454 loc) · 26 KB
/
Taskfile.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
---
# @file System Taskfile Commands
# @brief Defines commands provided by the Install Doctor CLI system
# @description
# The tasks / commands defined in this `Taskfile.yml` are all accessible by using the `task-menu` command.
# `task-menu` is a custom fork created to make browsing through various post-provisioning commands easier
# after setting up a device with Install Doctor. For each of the command below, you can run `task-menu command-name`
# to directly invoke the task. Alternatively, you can simply run `task-menu` from anywhere on the device to open
# an interactive command menu.
#
# ## Documentation
#
# The documentation for each command is defined in this file under the `summary` key. If a command has a `summary` defined
# then, our documentation system will automatically integrate the documentation into our documentation portal. The
# Install Doctor CLI (which is defined in this file) is available for viewing [here](https://install.doctor/docs/cli).
version: '3'
tasks:
bitwarden:
cmds:
- |
### Command to copy to clipboard
COPY="wl-copy"
### Get list of all logins as json
logins="$(bw list items)"
### Grab the name of every login and pip them into fzf
name="$(echo "$logins" | jq -r '.[].name' | fzf)"
### Find the login with the selected name (as a json)
selected="$(echo "$logins" | jq -r ".[] | select(.name == \"$name\")")"
### Print the name of the selected login
echo "Name: $(echo "$selected" | jq -r '.name')"
echo "> Copying Username"
### Copy the username to the clipboard
printf '%s' "$(echo "$selected" | jq -r '.login.username')" | $COPY
echo "Press any key to copy password..."
### Wait for user input before coping the password
read -r
echo "> Copying Password"
### Copy the password to the clipboard
printf '%s' "$(echo "$selected" | jq -r '.login.password')" | $COPY
build:packer:
desc: Builds Packer boxes using all supported virtualization platform / operating system combinations
summary: |
# {{ .AppName}} Packer Build
build:packer:
desc: Builds Packer boxes using all supported virtualization platform / operating system combinations
summary: |
# {{ .AppName}} Packer Build
This command will use Packer to build all the supported virtualization platform / operating system
combinations. This command can be used to test {{ .AppName }} on all the various systems that are
supported.
## Supported Virtualization Platforms
* KVM
* Hyper-V
* VirtualBox
* Parallels
* VMWare
## Supported Operating Systems
* Archlinux
* CentOS
* Debian
* Fedora
* macOS
* Ubuntu
* Windows
## Qubes Support
Qubes can leverage the assets generated from the VirtualBox builds to power HVMs.
cmds:
- |
cd "${XDG_DATA_HOME:-$HOME/.local/share}/bento"
packer init -upgrade ./packer_templates
gum log -sl info 'Building Ubuntu VirtualBox VMs'
packer build -var-file=os_pkrvars/ubuntu/ubuntu-22.04-x86_64.pkrvars.hcl ./packer_templates
brave:profile:backup:
desc: Backs up the user's {{ .AppName }} profile to the user's S3-backed Restic repository
vars:
AppName: Brave Browser
RcloneRepository: brave
summary: |
# {{ .AppName }} Profile Backup
This command backups the {{ .AppName }} user data profile to an S3-backed Restic repository if the profile exists. If the repository
has not been initialized then it will initialize it. After you backup the profile, you can restore it with the
`{{ .RcloneRepository }}:profile:restore` command like so:
```
run {{ .RcloneRepository }}:profile:restore
```
The {{ .AppName }} backup is encrypted with the same key that Chezmoi uses (stored in `~/.config/age/chezmoi.txt`, by default).
The backup uses Restic so all the functionality that Restic offers is available with backups made by this command.
cmds:
- task: profile:backup
vars:
AppName: Brave Browser
ProfileFolderDarwin: ~/Library/Application Support/BraveSoftware/Brave-Browser/Default
ProfileFolderLinux: ~/.config/BraveSoftware/Brave-Browser/Default
ProfileFolderWindows: '%APPDATA%/Local/BraveSoftware/Brave-Browser/Default'
ProfileFolder: '{{if eq OS "linux"}}{{.ProfileFolderLinux}}{{else if eq OS "darwin"}}{{.ProfileFolderDarwin}}{{else}}{{.ProfileFolderWindows}}{{end}}'
RcloneRepository: brave
brave:profile:restore:
desc: Restores the user's {{ .AppName }} profile from the user's S3-backed Restic repository
vars:
AppName: Brave Browser
RcloneRepository: brave
summary: |
# {{ .AppName }} Profile Import / Restore
This command imports / restores the {{ .AppName }} profile from the S3 Restic repository, if it exists. In order to use this
command for the first time, you should initialize {{ .AppName }} by opening the application. You should also customize
the application by applying your preferred settings (i.e. customize it how you want it to open in the future). Then, after making
any changes you wish to be saved, you can backup the {{ .AppName }} profile to the user's S3 bucket
by running the `{{ .RcloneRepository }}:profile:backup` task. After this is done, you can restore the application
settings by running this command (i.e. `{{ .RcloneRepository }}:profile:restore`).
The {{ .AppName }} backup is encrypted with the same key that Chezmoi uses (stored in `~/.config/age/chezmoi.txt`, by default).
Since the backup leverages Restic, you can leverage all the functionality that Restic offers if something goes awry.
cmds:
- task: profile:restore
vars:
AppFolder: /Applications/Brave Browser.app
AppName: Brave Browser
ProfileFolderDarwin: ~/Library/Application Support/BraveSoftware/Brave-Browser/Default
ProfileFolderLinux: ~/.config/BraveSoftware/Brave-Browser/Default
ProfileFolderWindows: '%APPDATA%/Local/BraveSoftware/Brave-Browser/Default'
ProfileFolder: '{{if eq OS "linux"}}{{.ProfileFolderLinux}}{{else if eq OS "darwin"}}{{.ProfileFolderDarwin}}{{else}}{{.ProfileFolderWindows}}{{end}}'
RcloneRepository: brave
chrome:profile:backup:
desc: Backs up the user's {{ .AppName }} profile to the user's S3-backed Restic repository
vars:
AppName: Google Chrome
RcloneRepository: chrome
summary: |
# {{ .AppName }} Profile Backup
This command backups the {{ .AppName }} user data profile to an S3-backed Restic repository if the profile exists. If the repository
has not been initialized then it will initialize it. After you backup the profile, you can restore it with the
`{{ .RcloneRepository }}:profile:restore` command like so:
```
run {{ .RcloneRepository }}:profile:restore
```
The {{ .AppName }} backup is encrypted with the same key that Chezmoi uses (stored in `~/.config/age/chezmoi.txt`, by default).
The backup uses Restic so all the functionality that Restic offers is available with backups made by this command.
cmds:
- task: profile:backup
vars:
AppName: Google Chrome
ProfileFolderDarwin: ~/Library/Application Support/Google/Chrome/Default
ProfileFolderLinux: ~/.config/google-chrome/default
ProfileFolderWindows: '%LOCALAPPDATA%/Google/Chrome/User Data/Default'
ProfileFolder: '{{if eq OS "linux"}}{{.ProfileFolderLinux}}{{else if eq OS "darwin"}}{{.ProfileFolderDarwin}}{{else}}{{.ProfileFolderWindows}}{{end}}'
RcloneRepository: chrome
chrome:profile:restore:
desc: Restores the user's {{ .AppName }} profile from the user's S3-backed Restic repository
vars:
AppName: Google Chrome
RcloneRepository: chrome
summary: |
# {{ .AppName }} Profile Import / Restore
This command imports / restores the {{ .AppName }} profile from the S3 Restic repository, if it exists. In order to use this
command for the first time, you should initialize {{ .AppName }} by opening the application. You should also customize
the application by applying your preferred settings (i.e. customize it how you want it to open in the future). Then, after making
any changes you wish to be saved, you can backup the {{ .AppName }} profile to the user's S3 bucket
by running the `{{ .RcloneRepository }}:profile:backup` task. After this is done, you can restore the application
settings by running this command (i.e. `{{ .RcloneRepository }}:profile:restore`).
The {{ .AppName }} backup is encrypted with the same key that Chezmoi uses (stored in `~/.config/age/chezmoi.txt`, by default).
Since the backup leverages Restic, you can leverage all the functionality that Restic offers if something goes awry.
cmds:
- task: profile:restore
vars:
AppFolder: /Applications/Google Chrome.app
AppName: Google Chrome
ProfileFolderDarwin: ~/Library/Application Support/Google/Chrome/Default
ProfileFolderLinux: ~/.config/google-chrome/default
ProfileFolderWindows: '%LOCALAPPDATA%/Google/Chrome/User Data/Default'
ProfileFolder: '{{if eq OS "linux"}}{{.ProfileFolderLinux}}{{else if eq OS "darwin"}}{{.ProfileFolderDarwin}}{{else}}{{.ProfileFolderWindows}}{{end}}'
RcloneRepository: chrome
edge:profile:backup:
desc: Backs up the user's {{ .AppName }} profile to the user's S3-backed Restic repository
vars:
AppName: Microsoft Edge
RcloneRepository: edge
summary: |
# {{ .AppName }} Profile Backup
This command backups the {{ .AppName }} user data profile to an S3-backed Restic repository if the profile exists. If the repository
has not been initialized then it will initialize it. After you backup the profile, you can restore it with the
`{{ .RcloneRepository }}:profile:restore` command like so:
```
run {{ .RcloneRepository }}:profile:restore
```
The {{ .AppName }} backup is encrypted with the same key that Chezmoi uses (stored in `~/.config/age/chezmoi.txt`, by default).
The backup uses Restic so all the functionality that Restic offers is available with backups made by this command.
cmds:
- task: profile:backup
vars:
AppName: Microsoft Edge
ProfileFolderDarwin: ~/Library/Application Support/Microsoft Edge/Default
ProfileFolderLinux: ~/.config/microsoft-edge/Default
ProfileFolderWindows: '%LOCALAPPDATA%/Microsoft/Edge/User Data/Default'
ProfileFolder: '{{if eq OS "linux"}}{{.ProfileFolderLinux}}{{else if eq OS "darwin"}}{{.ProfileFolderDarwin}}{{else}}{{.ProfileFolderWindows}}{{end}}'
RcloneRepository: edge
edge:profile:restore:
desc: Restores the user's {{ .AppName }} profile from the user's S3-backed Restic repository
vars:
AppName: Microsoft Edge
RcloneRepository: edge
summary: |
# {{ .AppName }} Profile Import / Restore
This command imports / restores the {{ .AppName }} profile from the S3 Restic repository, if it exists. In order to use this
command for the first time, you should initialize {{ .AppName }} by opening the application. You should also customize
the application by applying your preferred settings (i.e. customize it how you want it to open in the future). Then, after making
any changes you wish to be saved, you can backup the {{ .AppName }} profile to the user's S3 bucket
by running the `{{ .RcloneRepository }}:profile:backup` task. After this is done, you can restore the application
settings by running this command (i.e. `{{ .RcloneRepository }}:profile:restore`).
The {{ .AppName }} backup is encrypted with the same key that Chezmoi uses (stored in `~/.config/age/chezmoi.txt`, by default).
Since the backup leverages Restic, you can leverage all the functionality that Restic offers if something goes awry.
cmds:
- task: profile:restore
vars:
AppFolder: /Applications/Microsoft Edge.app
AppName: Microsoft Edge
ProfileFolderDarwin: ~/Library/Application Support/Microsoft Edge/Default
ProfileFolderLinux: ~/.config/microsoft-edge/Default
ProfileFolderWindows: '%LOCALAPPDATA%/Microsoft/Edge/User Data/Default'
ProfileFolder: '{{if eq OS "linux"}}{{.ProfileFolderLinux}}{{else if eq OS "darwin"}}{{.ProfileFolderDarwin}}{{else}}{{.ProfileFolderWindows}}{{end}}'
RcloneRepository: edge
ferdium:profile:backup:
desc: Backs up the user's {{ .AppName }} profile to the user's S3-backed Restic repository
vars:
AppName: Ferdium
RcloneRepository: ferdium
summary: |
# {{ .AppName }} Profile Backup
This command backups the {{ .AppName }} user data profile to an S3-backed Restic repository if the profile exists. If the repository
has not been initialized then it will initialize it. After you backup the profile, you can restore it with the
`{{ .RcloneRepository }}:profile:restore` command like so:
```
run {{ .RcloneRepository }}:profile:restore
```
The {{ .AppName }} backup is encrypted with the same key that Chezmoi uses (stored in `~/.config/age/chezmoi.txt`, by default).
The backup uses Restic so all the functionality that Restic offers is available with backups made by this command.
cmds:
- task: profile:backup
vars:
AppName: Ferdium
ProfileFolderDarwin: ~/Library/Application Support/Ferdium
ProfileFolderLinux: ~/.config/Ferdium/
ProfileFolderWindows: '%APPDATA%/Ferdium'
ProfileFolder: '{{if eq OS "linux"}}{{.ProfileFolderLinux}}{{else if eq OS "darwin"}}{{.ProfileFolderDarwin}}{{else}}{{.ProfileFolderWindows}}{{end}}'
RcloneRepository: ferdium
ferdium:profile:restore:
desc: Restores the user's {{ .AppName }} profile from the user's S3-backed Restic repository
vars:
AppName: Ferdium
RcloneRepository: ferdium
summary: |
# {{ .AppName }} Profile Import / Restore
This command imports / restores the {{ .AppName }} profile from the S3 Restic repository, if it exists. In order to use this
command for the first time, you should initialize {{ .AppName }} by opening the application. You should also customize
the application by applying your preferred settings (i.e. customize it how you want it to open in the future). Then, after making
any changes you wish to be saved, you can backup the {{ .AppName }} profile to the user's S3 bucket
by running the `{{ .RcloneRepository }}:profile:backup` task. After this is done, you can restore the application
settings by running this command (i.e. `{{ .RcloneRepository }}:profile:restore`).
The {{ .AppName }} backup is encrypted with the same key that Chezmoi uses (stored in `~/.config/age/chezmoi.txt`, by default).
Since the backup leverages Restic, you can leverage all the functionality that Restic offers if something goes awry.
cmds:
- task: profile:restore
vars:
AppFolder: /Applications/Ferdium.app
AppName: Ferdium
ProfileFolderDarwin: ~/Library/Application Support/Ferdium
ProfileFolderLinux: ~/.config/Ferdium/
ProfileFolderWindows: '%APPDATA%/Ferdium'
ProfileFolder: '{{if eq OS "linux"}}{{.ProfileFolderLinux}}{{else if eq OS "darwin"}}{{.ProfileFolderDarwin}}{{else}}{{.ProfileFolderWindows}}{{end}}'
RcloneRepository: ferdium
firefox:profile:backup:
desc: Backs up the user's {{ .AppName }} profile to the user's S3-backed Restic repository
vars:
AppName: Firefox
RcloneRepository: firefox
summary: |
# {{ .AppName }} Profile Backup
This command backups the {{ .AppName }} user data profile to an S3-backed Restic repository if the profile exists. If the repository
has not been initialized then it will initialize it. After you backup the profile, you can restore it with the
`{{ .RcloneRepository }}:profile:restore` command like so:
```
run {{ .RcloneRepository }}:profile:restore
```
The {{ .AppName }} backup is encrypted with the same key that Chezmoi uses (stored in `~/.config/age/chezmoi.txt`, by default).
The backup uses Restic so all the functionality that Restic offers is available with backups made by this command.
cmds:
- task: profile:backup
vars:
AppName: Firefox
ProfileFolderDarwin: ~/Library/Application Support/Firefox/Profiles/profile.private
ProfileFolderLinux: ~/.mozilla/firefox
ProfileFolderWindows: '%APPDATA%/Mozilla/Firefox/Profiles'
ProfileFolder: '{{if eq OS "linux"}}{{.ProfileFolderLinux}}{{else if eq OS "darwin"}}{{.ProfileFolderDarwin}}{{else}}{{.ProfileFolderWindows}}{{end}}'
RcloneRepository: firefox
firefox:profile:restore:
desc: Restores the user's {{ .AppName }} profile from the user's S3-backed Restic repository
vars:
AppName: Firefox
RcloneRepository: firefox
summary: |
# {{ .AppName }} Profile Import / Restore
This command imports / restores the {{ .AppName }} profile from the S3 Restic repository, if it exists. In order to use this
command for the first time, you should initialize {{ .AppName }} by opening the application. You should also customize
the application by applying your preferred settings (i.e. customize it how you want it to open in the future). Then, after making
any changes you wish to be saved, you can backup the {{ .AppName }} profile to the user's S3 bucket
by running the `{{ .RcloneRepository }}:profile:backup` task. After this is done, you can restore the application
settings by running this command (i.e. `{{ .RcloneRepository }}:profile:restore`).
The {{ .AppName }} backup is encrypted with the same key that Chezmoi uses (stored in `~/.config/age/chezmoi.txt`, by default).
Since the backup leverages Restic, you can leverage all the functionality that Restic offers if something goes awry.
cmds:
- task: profile:restore
vars:
AppFolder: /Applications/Firefox.app
AppName: Firefox
ProfileFolderDarwin: ~/Library/Application Support/Firefox/Profiles/profile.private
ProfileFolderLinux: ~/.mozilla/firefox
ProfileFolderWindows: '%APPDATA%/Mozilla/Firefox/Profiles'
ProfileFolder: '{{if eq OS "linux"}}{{.ProfileFolderLinux}}{{else if eq OS "darwin"}}{{.ProfileFolderDarwin}}{{else}}{{.ProfileFolderWindows}}{{end}}'
RcloneRepository: firefox
font-test:
cmds:
- |
echo -en "Regular"
echo -en "\e[3m Italic \e[0m"
echo -en "\e[1m Bold \e[0m"
echo -en "\e[3m\e[1m Bold-Italic \e[0m"
echo -en " \e[4mUnderline\e[0m "
echo -e " \e[9mStrikethrough\e[0m"
librewolf:profile:backup:
desc: Backs up the user's {{ .AppName }} profile to the user's S3-backed Restic repository
vars:
AppName: LibreWolf
RcloneRepository: librewolf
summary: |
# {{ .AppName }} Profile Backup
This command backups the {{ .AppName }} user data profile to an S3-backed Restic repository if the profile exists. If the repository
has not been initialized then it will initialize it. After you backup the profile, you can restore it with the
`{{ .RcloneRepository }}:profile:restore` command like so:
```
run {{ .RcloneRepository }}:profile:restore
```
The {{ .AppName }} backup is encrypted with the same key that Chezmoi uses (stored in `~/.config/age/chezmoi.txt`, by default).
The backup uses Restic so all the functionality that Restic offers is available with backups made by this command.
cmds:
- task: profile:backup
vars:
AppName: LibreWolf
ProfileFolderDarwin: ~/Library/Application Support/LibreWolf/Profiles/profile.default
ProfileFolderLinux: ~/.librewolf
ProfileFolderWindows: '%USERPROFILE%/.librewolf'
ProfileFolder: '{{if eq OS "linux"}}{{.ProfileFolderLinux}}{{else if eq OS "darwin"}}{{.ProfileFolderDarwin}}{{else}}{{.ProfileFolderWindows}}{{end}}'
RcloneRepository: librewolf
librewolf:profile:restore:
desc: Restores the user's {{ .AppName }} profile from the user's S3-backed Restic repository
vars:
AppName: LibreWolf
RcloneRepository: librewolf
summary: |
# {{ .AppName }} Profile Import / Restore
This command imports / restores the {{ .AppName }} profile from the S3 Restic repository, if it exists. In order to use this
command for the first time, you should initialize {{ .AppName }} by opening the application. You should also customize
the application by applying your preferred settings (i.e. customize it how you want it to open in the future). Then, after making
any changes you wish to be saved, you can backup the {{ .AppName }} profile to the user's S3 bucket
by running the `{{ .RcloneRepository }}:profile:backup` task. After this is done, you can restore the application
settings by running this command (i.e. `{{ .RcloneRepository }}:profile:restore`).
The {{ .AppName }} backup is encrypted with the same key that Chezmoi uses (stored in `~/.config/age/chezmoi.txt`, by default).
Since the backup leverages Restic, you can leverage all the functionality that Restic offers if something goes awry.
cmds:
- task: profile:restore
vars:
AppFolder: /Applications/LibreWolf.app
AppName: LibreWolf
ProfileFolderDarwin: ~/Library/Application Support/LibreWolf/Profiles/profile.default
ProfileFolderLinux: ~/.librewolf
ProfileFolderWindows: '%USERPROFILE%/.librewolf'
ProfileFolder: '{{if eq OS "linux"}}{{.ProfileFolderLinux}}{{else if eq OS "darwin"}}{{.ProfileFolderDarwin}}{{else}}{{.ProfileFolderWindows}}{{end}}'
RcloneRepository: librewolf
macos:plists:
cmds:
- |
find /usr/local/src/install.doctor/home/Library/Preferences -type f -mindepth 1 -maxdepth 1 | while read PLIST; do
if [[ "$PLIST" == *".plist" ]]; then
PLIST_FILE="$(basename "$PLIST")"
cp -f "$HOME/Library/Preferences/$PLIST_FILE" "/usr/local/src/install.doctor/home/Library/Preferences/$PLIST_FILE"
plutil -convert xml1 "/usr/local/src/install.doctor/home/Library/Preferences/$PLIST_FILE"
fi
done
profile:backup:
cmds:
- |
if [ -d "{{ .ProfileFolder }}" ]; then
if [ -d "$HOME/.local/mnt/s3" ]; then
if command -v rclone > /dev/null && command -v restic > /dev/null; then
gum log -sl info '{{ .AppName }} profile folder exists and user S3 mount exists. Backing the profile up to user S3 bucket via Restic.'
if ([ -z "$(restic -r "rclone:$USER-s3:user/{{ .RcloneRepository }}" --password-file "${XDG_CONFIG_HOME:-$HOME/.config}/age/chezmoi.txt" cat config)" ]) 2>/dev/null; then
gum log -sl info 'Initializing {{ .AppName }} Restic repository'
restic -r "rclone:$USER-s3:user/{{ .RcloneRepository }}" --password-file "${XDG_CONFIG_HOME:-$HOME/.config}/age/chezmoi.txt" init
fi
restic -r "rclone:$USER-s3:user/{{ .RcloneRepository }}" --password-file "${XDG_CONFIG_HOME:-$HOME/.config}/age/chezmoi.txt" --verbose backup --tag "{{ .ProfileFolder }}" --tag {{ OS }} --tag "$HOST" "{{ .ProfileFolder }}"
else
gum log -sl error 'Both rclone and restic must be available' && exit 1
fi
else
gum log -sl error 'User S3 bucket mount is unavailable. The presence of this folder is used to detect whether or not the user S3 Rclone configuration is in place.' && exit 1
fi
else
gum log -sl warn 'The {{ .ProfileFolder }} folder does not exist. Skipping.'
fi
profile:restore:
cmds:
- |
if [ -d '{{ .AppFolder }}' ]; then
if [ -d "$HOME/.local/mnt/s3" ]; then
if command -v rclone > /dev/null && command -v restic > /dev/null; then
if ([ -z "$(restic -r "rclone:$USER-s3:user/{{ .RcloneRepository }}" --password-file "${XDG_CONFIG_HOME:-$HOME/.config}/age/chezmoi.txt" cat config)" ]) 2>/dev/null; then
gum log -sl warn 'The {{ .AppName }} Rclone repository has not been initialized. Skipping.'
else
restic -r "rclone:$USER-s3:user/{{ .RcloneRepository }}" --password-file "${XDG_CONFIG_HOME:-$HOME/.config}/age/chezmoi.txt" restore latest --target '{{ .ProfileFolder }}'
fi
else
gum log -sl error 'Both rclone and restic must be available' && exit 1
fi
else
gum log -sl error 'User S3 bucket mount is unavailable. The presence of this folder is used to detect whether or not the user S3 Rclone configuration is in place.' && exit 1
fi
else
gum log -sl info 'The {{ .AppFolder }} folder that is used to detect the presence of {{ .AppName }} on the system is not present so the profile will not be restored for this type of {{ .AppName }} install.'
fi
squash-symlink:
summary: |
This command, when used in conjunction with the `find` command, will scan through a directory
and convert any symlinks into regular files by copying their source over the initial symlink.
**Example usage:**
```
find . -type l -exec 'run squash-symlink --' {} +
```
## TODO
Test and fix this so it can be accessed by `run squash-symlink -- $PATH`
cmds:
- |
set -e
for link; do
test -h "$link" || continue
dir=$(dirname "$link")
reltarget=$(readlink "$link")
case $reltarget in
/*) abstarget=$reltarget;;
*) abstarget=$dir/$reltarget;;
esac
rm -fv "$link"
cp -afv "$abstarget" "$link" || {
### On failure, restore the symlink
rm -rfv "$link"
ln -sfv "$reltarget" "$link"
}
done