9037474d22
- /system/Applications/Firefox.app/Contents/Resources/distribution/policies.json - /system/etc/cups/cupsd.conf - /system/etc/cups/modify_cupsd.conf - /system/etc/fonts/local.conf - /system/etc/grub.d/31-hold-shift - /system/etc/opt/chrome/policies/managed/policies.json - /system/etc/qubes/repo-templates/qubes-templates.repo - /system/etc/yum.repos.d/qubes-dom0.repo - /system/etc/timeshift/timeshift.json - /system/usr/lib/firefox-esr/distribution/policies.json - /system/usr/lib/firefox/distribution/policies.json - /system/var/cache/rclone/remove_dot_gitkeep - /system/mnt/private_r2-docker/remove_dot_gitkeep - /system/etc/sddm.conf - /home/.chezmoiscripts/universal/run_onchange_after_57-netdata.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_20-font.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_14-timeshift.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_50-rclone.tmpl - /home/.chezmoiscripts/qubes/run_onchange_before_12-update-dom0.tmpl - /home/dot_config/rclone/merge_rclone.conf - /home/dot_config/cups/cupsd.conf - /home/dot_config/qubes/qubes-templates.repo - /home/dot_config/qubes/qubes-dom0.repo - /home/dot_config/timeshift/timeshift.json - /home/Cloud/Private/remove_dot_gitkeep - /home/Cloud/Public/remove_dot_gitkeep - /home/dot_local/share/firefox/distribution/policies.json - /home/dot_local/bin/executable_rclone-mount - /home/dot_local/grub.d/31-hold-shift
39 lines
1.3 KiB
Text
39 lines
1.3 KiB
Text
{{- if and (ne .user.CLOUDFLARE_ACCESS_KEY_ID "") (ne .user.CLOUDFLARE_SECRET_ACCESS_KEY "") (ne .user.CLOUDFLARE_R2_ACCOUNT_ID "") }}
|
|
#!/usr/bin/env bash
|
|
|
|
# Consider https://github.com/dustinsand/blockinfile
|
|
CONFIG_FILE="$HOME/.config/rclone/rclone.conf"
|
|
if cat "$CONFIG_FILE" | grep '# MEGABYTE LABS MANAGED r2-user'; then
|
|
# TODO: Remove old block
|
|
START_LINE="$(echo `grep -n -m 1 "# MEGABYTE LABS MANAGED r2-user" .zshrc | cut -f1 -d ":"`)"
|
|
END_LINE="$(echo `grep -n -m 1 "# MEGABYTE LABS MANAGED r2-user" .zshrc | cut -f1 -d ":"`)"
|
|
if command -v gsed > /dev/null; then
|
|
gsed -i "$START_LINE,$END_LINEd" "$CONFIG_FILE"
|
|
else
|
|
sed -i "$START_LINE,$END_LINEd" "$CONFIG_FILE"
|
|
fi
|
|
fi
|
|
|
|
tee -a "$CONFIG_FILE" > /dev/null <<EOT
|
|
# MEGABYTE LABS MANAGED r2-user
|
|
[r2-user]
|
|
type = s3
|
|
provider = Cloudflare
|
|
access_key_id = {{ .user.CLOUDFLARE_ACCESS_KEY_ID }}
|
|
secret_access_key = {{ .user.CLOUDFLARE_SECRET_ACCESS_KEY }}
|
|
region = auto
|
|
endpoint = https://{{ .user.CLOUDFLARE_R2_ACCOUNT_ID }}.r2.cloudflarestorage.com
|
|
acl = private
|
|
# MEGABYTE LABS MANAGED r2-user
|
|
[do-private]
|
|
type = s3
|
|
provider = DigitalOcean
|
|
endpoint = private.nyc3.digitaloceanspaces.com
|
|
acl = private
|
|
[do-open]
|
|
type = s3
|
|
provider = DigitalOcean
|
|
endpoint = open.nyc3.digitaloceanspaces.com
|
|
acl = public-read
|
|
EOT
|
|
{{- end }}
|