2024-11-04 19:30:25 -05:00
|
|
|
function backup-firefox() {
|
|
|
|
local archive="$1"
|
|
|
|
local target="$2"
|
|
|
|
local hostname
|
|
|
|
local date
|
|
|
|
|
|
|
|
if [[ -z "$1" ]]; then
|
|
|
|
archive="$(grep -E '^ID=' /etc/os-release | cut -d'=' -f2)$(grep -E '^VERSION_ID=' /etc/os-release | cut -d'=' -f2)"
|
|
|
|
if [[ -z "$archive" ]]; then
|
|
|
|
archive="latest"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ -z "$2" ]]; then
|
|
|
|
if [[ -d "/mnt/storage/psi-jack/Backups" ]]; then
|
|
|
|
target="/mnt/storage/psi-jack/Backups"
|
|
|
|
else
|
|
|
|
target="/home/psi-jack/Backups"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ -f "/etc/hostname" ]]; then
|
|
|
|
hostname=$(< /etc/hostname)
|
|
|
|
else
|
|
|
|
hostname=$(hostname)
|
|
|
|
fi
|
|
|
|
|
|
|
|
date=$(date +"%Y-%m-%d")
|
|
|
|
|
|
|
|
mkdir -p "${target}/${archive}/${hostname}"
|
|
|
|
|
2024-11-04 20:31:29 -05:00
|
|
|
pushd "$HOME" &>/dev/null
|
|
|
|
tar -cvvf "${target}/${archive}/${hostname}/${hostname}-${date}_firefox.tar" .mozilla/firefox
|
2024-11-04 19:30:25 -05:00
|
|
|
zstd --rm -6 "${target}/${archive}/${hostname}/${hostname}-${date}_firefox.tar"
|
|
|
|
popd &>/dev/null
|
|
|
|
}
|
|
|
|
|
2024-11-04 20:07:35 -05:00
|
|
|
function backup-vivaldi() {
|
|
|
|
local archive="$1"
|
|
|
|
local target="$2"
|
|
|
|
local hostname
|
|
|
|
local date
|
|
|
|
|
|
|
|
if [[ -z "$1" ]]; then
|
|
|
|
archive="$(grep -E '^ID=' /etc/os-release | cut -d'=' -f2)$(grep -E '^VERSION_ID=' /etc/os-release | cut -d'=' -f2)"
|
|
|
|
if [[ -z "$archive" ]]; then
|
|
|
|
archive="latest"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ -z "$2" ]]; then
|
|
|
|
if [[ -d "/mnt/storage/psi-jack/Backups" ]]; then
|
|
|
|
target="/mnt/storage/psi-jack/Backups"
|
|
|
|
else
|
|
|
|
target="/home/psi-jack/Backups"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ -f "/etc/hostname" ]]; then
|
|
|
|
hostname=$(< /etc/hostname)
|
|
|
|
else
|
|
|
|
hostname=$(hostname)
|
|
|
|
fi
|
|
|
|
|
|
|
|
date=$(date +"%Y-%m-%d")
|
|
|
|
|
|
|
|
mkdir -p "${target}/${archive}/${hostname}"
|
|
|
|
|
|
|
|
pushd "$HOME" &>/dev/null
|
2024-11-04 20:27:02 -05:00
|
|
|
tar -cvvf "${target}/${archive}/${hostname}/${hostname}-${date}_vivaldi.tar" .config/vivaldi/Default
|
2024-11-04 20:07:35 -05:00
|
|
|
zstd --rm -6 "${target}/${archive}/${hostname}/${hostname}-${date}_vivaldi.tar"
|
|
|
|
popd &>/dev/null
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2024-11-04 16:18:03 -05:00
|
|
|
function backup-home() {
|
|
|
|
local archive="$1"
|
|
|
|
local target="$2"
|
|
|
|
local hostname
|
|
|
|
local date
|
|
|
|
|
|
|
|
if [[ -z "$1" ]]; then
|
|
|
|
archive="$(grep -E '^ID=' /etc/os-release | cut -d'=' -f2)$(grep -E '^VERSION_ID=' /etc/os-release | cut -d'=' -f2)"
|
|
|
|
if [[ -z "$archive" ]]; then
|
|
|
|
archive="latest"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ -z "$2" ]]; then
|
|
|
|
if [[ -d "/mnt/storage/psi-jack/Backups" ]]; then
|
|
|
|
target="/mnt/storage/psi-jack/Backups"
|
|
|
|
else
|
|
|
|
target="/home/psi-jack/Backups"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ -f "/etc/hostname" ]]; then
|
|
|
|
hostname=$(< /etc/hostname)
|
|
|
|
else
|
|
|
|
hostname=$(hostname)
|
|
|
|
fi
|
|
|
|
|
|
|
|
date=$(date +"%Y-%m-%d")
|
|
|
|
|
|
|
|
mkdir -p "${target}/${archive}/${hostname}"
|
|
|
|
|
|
|
|
pushd /home &>/dev/null
|
2024-11-04 19:48:58 -05:00
|
|
|
tar \
|
|
|
|
--exclude=psi-jack/.local/share/Trash \
|
|
|
|
--exclude=psi-jack/.local/share/Steam \
|
2024-11-04 16:18:03 -05:00
|
|
|
--exclude=psi-jack/.local/share/bottles \
|
|
|
|
--exclude=psi-jack/.local/share/lutris \
|
2024-11-04 19:51:29 -05:00
|
|
|
--exclude=psi-jack/Audible \
|
2024-11-04 16:18:03 -05:00
|
|
|
--exclude=psi-jack/Downloads \
|
2024-11-04 20:27:02 -05:00
|
|
|
--exclude=psi-jack/Downloads.old \
|
2024-11-04 19:48:58 -05:00
|
|
|
--exclude=psi-jack/Games \
|
2024-11-04 16:18:03 -05:00
|
|
|
--exclude=psi-jack/"GOG Games" \
|
|
|
|
--exclude=psi-jack/ISO \
|
2024-11-04 19:48:58 -05:00
|
|
|
--exclude=psi-jack/Libation \
|
2024-11-04 16:18:03 -05:00
|
|
|
--exclude=psi-jack/Music \
|
|
|
|
--exclude=psi-jack/Vaults \
|
2024-11-04 20:33:40 -05:00
|
|
|
--exclude=psi-jack/bin/SecondLife \
|
2024-11-04 16:18:03 -05:00
|
|
|
--exclude=psi-jack/tmp \
|
2024-11-04 20:39:41 -05:00
|
|
|
--exclude=psi-jack/tmp.old \
|
2024-11-04 19:49:51 -05:00
|
|
|
--exclude=psi-jack/.alchemynext/cache \
|
2024-11-04 19:53:57 -05:00
|
|
|
--exclude=psi-jack/.alchemynext/wine \
|
2024-11-04 16:18:03 -05:00
|
|
|
--exclude=psi-jack/.cache \
|
2024-11-04 20:38:37 -05:00
|
|
|
--exclude=psi-jack/.config/Code \
|
|
|
|
--exclude=psi-jack/.config/heroic \
|
2024-11-04 20:00:34 -05:00
|
|
|
--exclude=psi-jack/.config/rambox \
|
2024-11-04 20:31:29 -05:00
|
|
|
--exclude=psi-jack/.config/vivaldi/Default \
|
2024-11-04 16:18:03 -05:00
|
|
|
--exclude=psi-jack/.firestorm_x64/cache \
|
2024-11-04 20:31:29 -05:00
|
|
|
--exclude=psi-jack/.mozilla/firefox \
|
2024-11-04 16:18:03 -05:00
|
|
|
--exclude=psi-jack/.thunderbird \
|
2024-11-04 19:48:58 -05:00
|
|
|
--exclude=psi-jack/.steam \
|
2024-11-04 16:18:03 -05:00
|
|
|
--exclude=psi-jack/.var \
|
2024-11-04 20:00:34 -05:00
|
|
|
--exclude=psi-jack/.vscode \
|
2024-11-04 20:08:11 -05:00
|
|
|
--exclude=psi-jack/.wine \
|
2024-11-04 16:18:03 -05:00
|
|
|
-cvvf "${target}/${archive}/${hostname}/${hostname}-${date}_home.tar" \
|
|
|
|
psi-jack
|
|
|
|
zstd --rm -6 "${target}/${archive}/${hostname}/${hostname}-${date}_home.tar"
|
|
|
|
popd &>/dev/null
|
|
|
|
}
|
|
|
|
|
|
|
|
function backup-system() {
|
|
|
|
local archive="$1"
|
|
|
|
local target="$2"
|
|
|
|
local hostname
|
|
|
|
local date
|
|
|
|
|
|
|
|
if [[ -z "$1" ]]; then
|
|
|
|
archive="$(grep -E '^ID=' /etc/os-release | cut -d'=' -f2)$(grep -E '^VERSION_ID=' /etc/os-release | cut -d'=' -f2)"
|
|
|
|
if [[ -z "$archive" ]]; then
|
|
|
|
archive="latest"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ -z "$2" ]]; then
|
|
|
|
if [[ -d "/mnt/storage/psi-jack/Backups" ]]; then
|
|
|
|
target="/mnt/storage/psi-jack/Backups"
|
|
|
|
else
|
|
|
|
target="/home/psi-jack/Backups"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ -f "/etc/hostname" ]]; then
|
|
|
|
hostname=$(< /etc/hostname)
|
|
|
|
else
|
|
|
|
hostname=$(hostname)
|
|
|
|
fi
|
|
|
|
|
|
|
|
date=$(date +"%Y-%m-%d")
|
|
|
|
|
|
|
|
mkdir -p "${target}/${archive}/${hostname}"
|
|
|
|
|
|
|
|
pushd / &>/dev/null
|
|
|
|
sudo tar -cvvf "${target}/${archive}/${hostname}/${hostname}-${date}_system.tar" etc root
|
|
|
|
sudo chown psi-jack: "${target}/${archive}/${hostname}/${hostname}-${date}_system.tar"
|
|
|
|
zstd --rm -6 "${target}/${archive}/${hostname}/${hostname}-${date}_system.tar"
|
|
|
|
popd &>/dev/null
|
|
|
|
}
|
|
|
|
|