feat: move config to .env
This commit is contained in:
+10
-43
@@ -1,50 +1,17 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
# "smb" or "nfs"
|
DIR=$(cd "$(dirname "$0")" && pwd)
|
||||||
STORAGE_TYPE="nfs"
|
ENV_FILE="$DIR/.env"
|
||||||
|
|
||||||
# ip or hostname
|
if [ -f "$ENV_FILE" ]; then
|
||||||
S_HOST="nfs.lan"
|
. "$ENV_FILE"
|
||||||
|
else
|
||||||
# /path/to/backup
|
echo " [!] Error: .env file not found at $ENV_FILE"
|
||||||
S_PATH="/mnt/media1/backup"
|
exit 1
|
||||||
|
fi
|
||||||
SMB_USER="guest"
|
|
||||||
SMB_PASS="guest"
|
|
||||||
|
|
||||||
LOCAL_KEEP=10
|
|
||||||
HOST_KEEP=30
|
|
||||||
|
|
||||||
HNAME=$(uci get system.@system[0].hostname)
|
HNAME=$(uci get system.@system[0].hostname)
|
||||||
DATE=$(date +%Y-%m-%d_%H-%M)
|
DATE=$(date +%Y-%m-%d_%H-%M)
|
||||||
|
|
||||||
S_MOUNT="/tmp/share"
|
|
||||||
|
|
||||||
C_LIST="
|
|
||||||
/etc/config
|
|
||||||
/etc/xray
|
|
||||||
/etc/unbound
|
|
||||||
/root/.ssh
|
|
||||||
/opt/.xray-config
|
|
||||||
/opt/.backup-manager
|
|
||||||
/etc/nftables.d/10-netmap.nft
|
|
||||||
/etc/hotplug.d/iface/99-xray-restart
|
|
||||||
/etc/zabbix_agentd.conf
|
|
||||||
/etc/dropbear
|
|
||||||
/etc/banner
|
|
||||||
/etc/init.d/xray
|
|
||||||
"
|
|
||||||
|
|
||||||
C_EXCLUDE="
|
|
||||||
/opt/.backup-manager/local_backups
|
|
||||||
/etc/xray/ipset
|
|
||||||
/etc/xray/ipnet
|
|
||||||
"
|
|
||||||
|
|
||||||
H_REPLACE="wpad dnsmasq"
|
|
||||||
|
|
||||||
DIR=$(cd "$(dirname "$0")" && pwd)
|
|
||||||
#DIR="/opt/.backup-manager"
|
|
||||||
L_BACKUP_DIR="$DIR/local_backups"
|
L_BACKUP_DIR="$DIR/local_backups"
|
||||||
SCR_BACKUP="$DIR/backup-configs.sh"
|
SCR_BACKUP="$DIR/backup-configs.sh"
|
||||||
SCR_OPKG="$DIR/backup-opkg.sh"
|
SCR_OPKG="$DIR/backup-opkg.sh"
|
||||||
@@ -71,8 +38,8 @@ check_network() {
|
|||||||
check_dependencies() {
|
check_dependencies() {
|
||||||
printf "Checking %s dependencies... " "$STORAGE_TYPE"
|
printf "Checking %s dependencies... " "$STORAGE_TYPE"
|
||||||
local pkgs=""
|
local pkgs=""
|
||||||
[ "$STORAGE_TYPE" = "nfs" ] && pkgs="nfs-utils"
|
[ "$STORAGE_TYPE" = "nfs" ] && pkgs="nfs-utils kmod-fs-nfs kmod-fs-nfs-v3 kmod-fs-nfs-v4"
|
||||||
[ "$STORAGE_TYPE" = "smb" ] && pkgs="cifsmount"
|
[ "$STORAGE_TYPE" = "smb" ] && pkgs="cifsmount kmod-fs-cifs"
|
||||||
local missing=""
|
local missing=""
|
||||||
for pkg in $pkgs; do
|
for pkg in $pkgs; do
|
||||||
opkg list-installed | grep -q "^$pkg " || missing="$missing $pkg"
|
opkg list-installed | grep -q "^$pkg " || missing="$missing $pkg"
|
||||||
|
|||||||
Reference in New Issue
Block a user