2
0
Fork 0

various changes

main
Ducky 2022-03-02 00:35:53 +00:00
parent 9db131e54c
commit ca8cfe828f
10 changed files with 32 additions and 44 deletions

17
.gitignore vendored
View File

@ -1,7 +1,11 @@
/*
*~
!.gitignore
# /etc/
!/opt/
/opt/*
!/opt/zio/
!/etc/
/etc/*
@ -10,6 +14,11 @@
/etc/skel/*
!/etc/skel/.bashrc
# /etc/zio/backup/
!/etc/zio/backup/
/etc/zio/backup/*
!/etc/zio/backup/.gitkeep
# /root/
!/root/
/root/*
@ -23,6 +32,12 @@
!/usr/local/
/usr/local/*
# /usr/local/bin/
!/usr/local/bin/
/usr/local/bin/*
!/usr/local/bin/update-rootfs
!/usr/local/bin/zio-backup
# /usr/local/sbin/
!/usr/local/sbin/
/usr/local/sbin/*

View File

@ -2,8 +2,6 @@
#
# Everytime this is sourced, a new version is pulled from /etc/skel/.bashrc,
# rendering any changes you make here overwritten the next time you launch Bash.
#
# Put any extra aliases, functions, or other mess into ~/.bash_aliases.
# If not running interactively, don't do anything
case $- in
@ -93,11 +91,6 @@ else
PS1="\h:\W > "
fi
# Aliases
if [ -f ~/.bash_aliases ]; then
. ~/.bash_aliases
fi
# Completions
if ! shopt -oq posix; then
if [ -f /usr/share/bash-completion/bash_completion ]; then
@ -113,6 +106,6 @@ if [[ -z $SUDO_USER ]]; then
print_header
fi
if [[ $UID != 0 ]]; then
update_bashrc
fi
# Update prompt
# TODO: Tell user if something has updated
update_bashrc

View File

@ -4,7 +4,7 @@ env_dir=$1
base_dir="$(dirname "$(realpath -s "$0")")"
root_dir="$base_dir/../../.."
[[ -z $env_dir ]] && env_dir="/var/lib/zio-backup"
[[ -z $env_dir ]] && env_dir="/etc/zio/backup/"
function restic_exec() {
command="$1"
@ -98,7 +98,7 @@ function test_path() {
fi
}
host="de01"
host="$(hostname -s)"
repo="b2:zio-euc-servers"
excludes=()
@ -118,16 +118,16 @@ else
chown root:root -R $env_dir
chmod 660 -R $env_dir
[[ -f "$env_dir/$host.pre" ]] && pre_script="$env_dir/$host.pre"
[[ -f "$env_dir/$host.post" ]] && post_script="$env_dir/$host.post"
[[ -f "$env_dir/script-pre" ]] && pre_script="$env_dir/script-pre"
[[ -f "$env_dir/script-post" ]] && post_script="$env_dir/script-post"
if [[ -f "$env_dir/$host.var" ]]; then
[[ ! -z $(get_prop "$env_dir/$host.var" EXCLUDES) ]] && \
IFS=';' read -ra excludes <<< "$(get_prop "$env_dir/$host.var" EXCLUDES)"
[[ ! -z $(get_prop "$env_dir/$host.var" PATHS) ]] && \
IFS=';' read -ra paths <<< "$(get_prop "$env_dir/$host.var" PATHS)"
[[ ! -z $(get_prop "$env_dir/$host.var" SERVICES) ]] && \
IFS=';' read -ra services <<< "$(get_prop "$env_dir/$host.var" SERVICES)"
if [[ -f "$env_dir/confi" ]]; then
[[ ! -z $(get_prop "$env_dir/config" EXCLUDES) ]] && \
IFS=';' read -ra excludes <<< "$(get_prop "$env_dir/config" EXCLUDES)"
[[ ! -z $(get_prop "$env_dir/config" PATHS) ]] && \
IFS=';' read -ra paths <<< "$(get_prop "$env_dir/config" PATHS)"
[[ ! -z $(get_prop "$env_dir/config" SERVICES) ]] && \
IFS=';' read -ra services <<< "$(get_prop "$env_dir/config" SERVICES)"
fi
if [[ -f "$env_dir/passwd" ]]; then

View File

View File

@ -1 +0,0 @@
. /etc/skel/.bashrc

View File

@ -0,0 +1,2 @@
#!/bin/bash
/opt/zio/bin/backup $@

View File

@ -1,16 +0,0 @@
#!/bin/bash
sql_dump_dir="/srv/store/common/sql"
postgres_dump_file="/srv/store/common/sql/postgres_$host.sql"
postgres_password="5H4bsfAVXGFQFYfpPzDtcYpUXB8vjQUT"
mkdir -p $sql_dump_dir
say "Photoprism: Importing media..."
podman exec -it photoprism photoprism import
say "Postgres: Dumping database to '$postgres_dump_file'..."
podman exec -i -e PGPASSWORD=$postgres_password postgres /usr/local/bin/pg_dumpall -U postgres > $postgres_dump_file
chmod -R 660 $sql_dump_dir
chown -R root:root $sql_dump_dir

View File

@ -1,4 +0,0 @@
EXCLUDES="/var/lib/containers/storage/overlay;/var/lib/containers/storage/overlay-containers;/var/lib/containers/storage/overlay-images;/var/lib/containers/storage/overlay-layers"
PATHS="/etc"
#PATHS="/etc;/srv/store;/var"
SERVICES="container-photoprism"

View File

@ -1 +0,0 @@
9%62hqWZwgLWEJ4@k7gG3*o4Zt#%dBiA