Update core-restore-from-backup.sh
This commit is contained in:
parent
aa18221a45
commit
b029f3ef3a
1 changed files with 6 additions and 1 deletions
|
@ -10,6 +10,7 @@ CL=`echo "\033[m"`
|
||||||
BFR="\\r\\033[K"
|
BFR="\\r\\033[K"
|
||||||
HOLD="-"
|
HOLD="-"
|
||||||
CM="${GN}✓${CL}"
|
CM="${GN}✓${CL}"
|
||||||
|
CROSS="${RD}✗${CL}"
|
||||||
APP="Home Assistant Core"
|
APP="Home Assistant Core"
|
||||||
while true; do
|
while true; do
|
||||||
read -p "This will restore ${APP} from a backup. Proceed(y/n)?" yn
|
read -p "This will restore ${APP} from a backup. Proceed(y/n)?" yn
|
||||||
|
@ -41,6 +42,10 @@ function msg_ok() {
|
||||||
local msg="$1"
|
local msg="$1"
|
||||||
echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
|
echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
|
||||||
}
|
}
|
||||||
|
function msg_error() {
|
||||||
|
local msg="$1"
|
||||||
|
echo -e "${BFR} ${CROSS} ${RD}${msg}${CL}"
|
||||||
|
}
|
||||||
DIR=/root/.homeassistant/restore
|
DIR=/root/.homeassistant/restore
|
||||||
if [ -d "$DIR" ];
|
if [ -d "$DIR" ];
|
||||||
then
|
then
|
||||||
|
@ -49,7 +54,7 @@ else
|
||||||
mkdir -p /root/.homeassistant/restore
|
mkdir -p /root/.homeassistant/restore
|
||||||
msg_ok "Created Restore Directory."
|
msg_ok "Created Restore Directory."
|
||||||
fi
|
fi
|
||||||
if [ -z "$(ls -A /root/.homeassistant/backups/)" ]; then echo -e "${RD}No backups found!${CL} \n"; exit 1; fi
|
if [ -z "$(ls -A /root/.homeassistant/backups/)" ]; then msg_error "No backups found! \n"; exit 1; fi
|
||||||
cd /root/.homeassistant/backups/
|
cd /root/.homeassistant/backups/
|
||||||
PS3="Please enter your choice: "
|
PS3="Please enter your choice: "
|
||||||
files="$(ls -A .)"
|
files="$(ls -A .)"
|
||||||
|
|
Loading…
Reference in a new issue