Change borg setup to point to kserver
This commit is contained in:
parent
94df38d091
commit
a8a3d4038c
11
shells/zshrc
11
shells/zshrc
@ -1,3 +1,5 @@
|
|||||||
|
# Borg backup repository
|
||||||
|
export BORG_REPO="kserver:borg"
|
||||||
#zmodload zsh/zprof
|
#zmodload zsh/zprof
|
||||||
echo -ne '[ ]\r'
|
echo -ne '[ ]\r'
|
||||||
for config (~/.zsh/*.zsh) source $config
|
for config (~/.zsh/*.zsh) source $config
|
||||||
@ -99,7 +101,14 @@ mt(){
|
|||||||
run(){
|
run(){
|
||||||
test -f "${1:r}" && rm "${1:r}"
|
test -f "${1:r}" && rm "${1:r}"
|
||||||
echo "Building..." >&2
|
echo "Building..." >&2
|
||||||
gcc -Wall -std=c99 "${1:r}.c" -o "${1:r}" && (echo "Running..." >&2;./"${1:r}")
|
gcc -Wall -g -std=c99 "${1:r}.c" -o "${1:r}" && (echo "Running..." >&2;./"${1:r}")
|
||||||
|
}
|
||||||
|
upload() {
|
||||||
|
tar -cf - "$1" | base64 | curl --data-urlencode text@- -d title="File uploaded at $(date '+%d/%h/%y %H:%M:%S') on $(hostname)" -d name=$USER -d expire="1440" https://austenwares.com/paste/api/create | sed -e 's/view/view\/raw/'
|
||||||
|
}
|
||||||
|
download() {
|
||||||
|
URL="$(printf $1 | perl -pe 's/\/paste\/view(?!\/raw)/\/paste\/view\/raw/')"
|
||||||
|
curl "$URL" | base64 -d | tar -xf -
|
||||||
}
|
}
|
||||||
alias nmrestart='nmcli radio wifi off;nmcli radio wifi on'
|
alias nmrestart='nmcli radio wifi off;nmcli radio wifi on'
|
||||||
if ex mtr; then
|
if ex mtr; then
|
||||||
|
31
zsh/borg.zsh
31
zsh/borg.zsh
@ -1,16 +1,15 @@
|
|||||||
b-list() {
|
b-list() {
|
||||||
local REPO="aw:borg"
|
|
||||||
if [[ -z "$1" ]]; then
|
if [[ -z "$1" ]]; then
|
||||||
column -t <(borg list "$REPO")
|
column -t <(borg list "$BORG_REPO")
|
||||||
else
|
else
|
||||||
borg list "$REPO::$1"
|
borg list "$BORG_REPO::$1"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
b-delete() {
|
b-delete() {
|
||||||
while (( $# > 0 )); do
|
while (( $# > 0 )); do
|
||||||
if [[ ! -z "$1" ]]; then
|
if [[ ! -z "$1" ]]; then
|
||||||
echo "Deleting... $1"
|
echo "Deleting... $1"
|
||||||
borg delete "$REPO::$1"
|
borg delete "$BORG_REPO::$1"
|
||||||
fi
|
fi
|
||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
@ -23,16 +22,13 @@ b-create() {
|
|||||||
$SUDO /home/stonewareslord/syncthing/me/backup/$(hostname)/backup
|
$SUDO /home/stonewareslord/syncthing/me/backup/$(hostname)/backup
|
||||||
}
|
}
|
||||||
b-rename() {
|
b-rename() {
|
||||||
local REPO="aw:borg"
|
borg rename -v "$BORG_REPO::$1" "$2"
|
||||||
borg rename -v "$REPO::$1" "$2"
|
|
||||||
}
|
}
|
||||||
b-info() {
|
b-info() {
|
||||||
local REPO="aw:borg"
|
borg info "$BORG_REPO::$1"
|
||||||
borg info "$REPO::$1"
|
|
||||||
}
|
}
|
||||||
b-diff() {
|
b-diff() {
|
||||||
REPO="aw:borg"
|
borg list "$BORG_REPO"
|
||||||
borg list "$REPO"
|
|
||||||
echo -n "First ID: "
|
echo -n "First ID: "
|
||||||
read ID1
|
read ID1
|
||||||
echo -n "Second ID: "
|
echo -n "Second ID: "
|
||||||
@ -59,8 +55,8 @@ b-diff() {
|
|||||||
echo "FILE_SIZE_LIST2: $FILE_SIZE_LIST2"
|
echo "FILE_SIZE_LIST2: $FILE_SIZE_LIST2"
|
||||||
echo "COMPLETED_FILE1: $COMPLETED_FILE1"
|
echo "COMPLETED_FILE1: $COMPLETED_FILE1"
|
||||||
echo "COMPLETED_FILE2: $COMPLETED_FILE2"
|
echo "COMPLETED_FILE2: $COMPLETED_FILE2"
|
||||||
borg list --short "$REPO::$ID1" | pv -N "Getting List 1" > "$FILE_LIST1"
|
borg list --short "$BORG_REPO::$ID1" | pv -N "Getting List 1" > "$FILE_LIST1"
|
||||||
borg list --short "$REPO::$ID2" | pv -N "Getting List 2" > "$FILE_LIST2"
|
borg list --short "$BORG_REPO::$ID2" | pv -N "Getting List 2" > "$FILE_LIST2"
|
||||||
# Find differences and calculate them
|
# Find differences and calculate them
|
||||||
diff <(pv -cN "List 1 Diff" "$FILE_LIST1") <(pv -cN "List 1 Diff" "$FILE_LIST2") > >(ag '^<' | perl -pe 's/^< //' > "$A_DIFFS") > >(ag '^>' | perl -pe 's/^> //' > "$B_DIFFS")
|
diff <(pv -cN "List 1 Diff" "$FILE_LIST1") <(pv -cN "List 1 Diff" "$FILE_LIST2") > >(ag '^<' | perl -pe 's/^< //' > "$A_DIFFS") > >(ag '^>' | perl -pe 's/^> //' > "$B_DIFFS")
|
||||||
# Truncate everything
|
# Truncate everything
|
||||||
@ -87,8 +83,7 @@ b-diff() {
|
|||||||
echo "$COMPLETED_FILE2"
|
echo "$COMPLETED_FILE2"
|
||||||
}
|
}
|
||||||
b-size() {
|
b-size() {
|
||||||
REPO="aw:borg"
|
borg list "$BORG_REPO"
|
||||||
borg list "$REPO"
|
|
||||||
echo -n "ID: "
|
echo -n "ID: "
|
||||||
read ID
|
read ID
|
||||||
if [ -z "$ID" ]; then
|
if [ -z "$ID" ]; then
|
||||||
@ -101,7 +96,7 @@ b-size() {
|
|||||||
echo "FILE_LIST: $FILE_LIST"
|
echo "FILE_LIST: $FILE_LIST"
|
||||||
echo "FILE_SIZE_LIST: $FILE_SIZE_LIST"
|
echo "FILE_SIZE_LIST: $FILE_SIZE_LIST"
|
||||||
echo "COMPLETED_FILE: $COMPLETED_FILE"
|
echo "COMPLETED_FILE: $COMPLETED_FILE"
|
||||||
borg list --short "$REPO::$ID" | pv -N "Getting List" > "$FILE_LIST"
|
borg list --short "$BORG_REPO::$ID" | pv -N "Getting List" > "$FILE_LIST"
|
||||||
while read i
|
while read i
|
||||||
do
|
do
|
||||||
test -f /"$i" && du -sh /"$i" 2>/dev/null >> "$FILE_SIZE_LIST"
|
test -f /"$i" && du -sh /"$i" 2>/dev/null >> "$FILE_SIZE_LIST"
|
||||||
@ -112,12 +107,10 @@ b-size() {
|
|||||||
less "$COMPLETED_FILE"
|
less "$COMPLETED_FILE"
|
||||||
}
|
}
|
||||||
b-extract() {
|
b-extract() {
|
||||||
local REPO="aw:borg"
|
|
||||||
local BACKUP="$1"
|
local BACKUP="$1"
|
||||||
shift
|
shift
|
||||||
borg extract "$REPO::$BACKUP" $*
|
borg extract "$BORG_REPO::$BACKUP" $*
|
||||||
}
|
}
|
||||||
b-cmd() {
|
b-cmd() {
|
||||||
local REPO="aw:borg"
|
echo "$BORG_REPO" $*
|
||||||
echo "$REPO" $*
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user