Compare commits
No commits in common. "e7d024f68a5e6f6dbae403e3050f411edae175a4" and "a6561ba2798b02cfcbcf6779e8e17101abb4b9ff" have entirely different histories.
e7d024f68a
...
a6561ba279
3 changed files with 0 additions and 72 deletions
41
bash/.bashrc
41
bash/.bashrc
|
@ -124,44 +124,3 @@ export QT_IM_MODULE=fcitx
|
|||
export SDL_IM_MODULE=fcitx
|
||||
export WLR_XWAYLAND=$HOME/.local/bin/Xwayland-noshm
|
||||
$MACHINE_START_SWAY && [[ -z "$DISPLAY" && $(tty) == /dev/tty1 ]] && exec sway
|
||||
|
||||
# Miscellaneous utilities
|
||||
function clamp_filename() {
|
||||
[[ -z "$1" ]] && return 1
|
||||
|
||||
local len="$1"
|
||||
|
||||
for file in *; do
|
||||
local filename_len=$(echo "$file" | wc -c)
|
||||
|
||||
if [ $filename_len -gt $len ]; then
|
||||
local extension="${file##*.}"
|
||||
local filename="${filename%.*}"
|
||||
if [ ${#extension} -gt 5 ]; then
|
||||
filename="$file"
|
||||
extension=""
|
||||
fi
|
||||
local clamped_filename="$(echo "$file" | cut -c1-$((len - ${#extension})) | iconv -f utf8 -t utf8 -c -)"
|
||||
if [ ${#extension} -gt 0 ]; then
|
||||
clamped_filename="$clamped_filename.$extension"
|
||||
fi
|
||||
echo "File '$PWD/$file' clamped to '$PWD/$clamped_filename'"
|
||||
mv "$file" "$clamped_filename"
|
||||
file="$clamped_filename"
|
||||
fi
|
||||
|
||||
if [ -d "$file" ]; then
|
||||
pushd "$file" > /dev/null
|
||||
clamp_filename "$1"
|
||||
popd > /dev/null
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
function open_nas_decrypt() {
|
||||
gocryptfs -passfile /dev/stdin "$MACHINE_NAS_CIPHER_PATH" "$MACHINE_NAS_DECRYPT_PATH" <<< "$(pass gocrypt show "$MACHINE_NAS_CIPHER_PASS")"
|
||||
}
|
||||
|
||||
function close_nas_decrypt() {
|
||||
fusermount -u "$MACHINE_NAS_DECRYPT_PATH"
|
||||
}
|
||||
|
|
|
@ -1,24 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
source ~/.config/restic-backup/config.sh
|
||||
|
||||
cleanup() {
|
||||
pass gocrypt close || true > /dev/null 2>&1
|
||||
}
|
||||
|
||||
trap cleanup EXIT
|
||||
|
||||
pass gocrypt close > /dev/null 2>&1 || true
|
||||
PASS_GOCRYPT_CLOSE_TIMEOUT=2147483648 pass gocrypt open
|
||||
|
||||
for dir in ${RESTIC_BACKUP_SUBVOL_PATHS[@]}; do
|
||||
parent="$(dirname $dir)"
|
||||
snap="$parent/$(basename $dir)-restic"
|
||||
echo "snap = $snap"
|
||||
sudo btrfs subvol delete "$snap" > /dev/null 2>&1 || true
|
||||
sudo btrfs subvol snap "$dir" "$snap"
|
||||
restic-wrapper --verbose backup "$snap"
|
||||
sudo btrfs subvol delete "$snap" || true
|
||||
done
|
|
@ -1,7 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
source ~/.config/restic-backup/config.sh
|
||||
pass gocrypt open || true
|
||||
sudo restic --password-file /dev/stdin -r "$RESTIC_BACKUP_REPO" $@ <<< $(pass show "$RESTIC_BACKUP_PASS")
|
Loading…
Add table
Reference in a new issue