gd: wrap files with tar as well

This commit is contained in:
2026-08-17 22:12:57 +02:00
parent 2d8b033c3e
commit 1399982b37

View File

@@ -68,31 +68,33 @@ gd-check() {
# gd-push pushes a file to Google Drive with compression and password encryption # gd-push pushes a file to Google Drive with compression and password encryption
gd-push() { gd-push() {
gd-check || return gd-check || return
zstd -6 -T0 -c -- "$1" \ tar cf - "$1" \
| zstd -6 \
| gpg -c -z 0 -o - \ | gpg -c -z 0 -o - \
| rclone rcat "gdrive:backups/${1:t}.zst.gpg" | rclone rcat "gdrive:rclone/${1:t}.tar.zst.gpg"
} }
# gd-push pulls a file from Google Drive, password decrypts and decompresses it. # gd-push pulls a file from Google Drive, password decrypts and decompresses it.
# gd-push outputs to stdout # gd-push outputs to stdout
gd-pull() { gd-pull() {
gd-check || return gd-check || return
rclone cat "gdrive:backups/${1:t}.zst.gpg" \ rclone cat "gdrive:rclone/${1:t}.tar.zst.gpg" \
| gpg -d \ | gpg -d \
| zstd -d -c | zstd -d -c \
| tar x -
} }
# gd-ls lists all the files available on Google Drive # gd-ls lists all the files available on Google Drive
gd-ls() { gd-ls() {
gd-check || return gd-check || return
rclone lsf --files-only gdrive:backups/ \ rclone lsf --files-only gdrive:rclone/ \
| sed -n 's/\.zst\.gpg$//p' | sed -n 's/\.tar\.zst\.gpg$//p'
} }
# gd-rm removes a file from Google Drive # gd-rm removes a file from Google Drive
gd-rm() { gd-rm() {
gd-check || return gd-check || return
rclone deletefile "gdrive:backups/${1:t}.zst.gpg" rclone deletefile "gdrive:rclone/${1:t}.tar.zst.gpg"
} }
# dispatcher for gd functions # dispatcher for gd functions