mirror of
https://github.com/deadc0de6/dotdrop.git
synced 2026-02-04 20:19:46 +00:00
testing uninstall
This commit is contained in:
@@ -74,21 +74,26 @@ class Uninstaller:
|
|||||||
|
|
||||||
def _descend(self, dirpath):
|
def _descend(self, dirpath):
|
||||||
ret = True
|
ret = True
|
||||||
for root, dirs, files in os.walk(dirpath):
|
self.log.dbg(f'recursively uninstall {dirpath}')
|
||||||
for file in files:
|
for sub in os.listdir(dirpath):
|
||||||
fpath = os.path.join(root, file)
|
subpath = os.path.join(dirpath, sub)
|
||||||
subret, _ = self._remove(fpath)
|
if os.path.isdir(subpath):
|
||||||
|
self.log.dbg(f'under {dirpath} uninstall dir {subpath}')
|
||||||
|
self._descend(subpath)
|
||||||
|
else:
|
||||||
|
self.log.dbg(f'under {dirpath} uninstall file {subpath}')
|
||||||
|
subret, _ = self._remove(subpath)
|
||||||
if not subret:
|
if not subret:
|
||||||
ret = False
|
ret = False
|
||||||
for directory in dirs:
|
|
||||||
dpath = os.path.join(root, directory)
|
|
||||||
self._descend(dpath)
|
|
||||||
if not os.listdir(dirpath):
|
if not os.listdir(dirpath):
|
||||||
# empty
|
# empty
|
||||||
|
self.log.dbg(f'remove empty dir {dirpath}')
|
||||||
if self.dry:
|
if self.dry:
|
||||||
self.log.dry(f'would \"rm -r {dirpath}\"')
|
self.log.dry(f'would \"rm -r {dirpath}\"')
|
||||||
return True, ''
|
return True, ''
|
||||||
return self._remove_path(dirpath)
|
return self._remove_path(dirpath)
|
||||||
|
self.log.dbg(f'not removing non-empty dir {dirpath}')
|
||||||
return ret, ''
|
return ret, ''
|
||||||
|
|
||||||
def _remove_path(self, path):
|
def _remove_path(self, path):
|
||||||
@@ -108,10 +113,11 @@ class Uninstaller:
|
|||||||
self.log.dbg(f'skip {path} ignored')
|
self.log.dbg(f'skip {path} ignored')
|
||||||
return True, ''
|
return True, ''
|
||||||
backup = f'{path}{self.backup_suffix}'
|
backup = f'{path}{self.backup_suffix}'
|
||||||
self.log.dbg(f'potential backup file {backup}')
|
|
||||||
if os.path.exists(backup):
|
if os.path.exists(backup):
|
||||||
self.log.dbg(f'backup exists for {path}: {backup}')
|
self.log.dbg(f'backup exists for {path}: {backup}')
|
||||||
return self._replace(path, backup)
|
return self._replace(path, backup)
|
||||||
|
else:
|
||||||
|
self.log.dbg(f'no backup file for {path}')
|
||||||
|
|
||||||
if os.path.isdir(path):
|
if os.path.isdir(path):
|
||||||
self.log.dbg(f'{path} is a directory')
|
self.log.dbg(f'{path} is a directory')
|
||||||
@@ -124,6 +130,7 @@ class Uninstaller:
|
|||||||
msg = f'Remove {path}?'
|
msg = f'Remove {path}?'
|
||||||
if self.safe and not self.log.ask(msg):
|
if self.safe and not self.log.ask(msg):
|
||||||
return False, 'user refused'
|
return False, 'user refused'
|
||||||
|
self.log.dbg(f'removing {path}')
|
||||||
return self._remove_path(path)
|
return self._remove_path(path)
|
||||||
|
|
||||||
def _replace(self, path, backup):
|
def _replace(self, path, backup):
|
||||||
|
|||||||
19
tests-ng/uninstall.sh
vendored
19
tests-ng/uninstall.sh
vendored
@@ -31,29 +31,26 @@ source "${cur}"/uninstall_
|
|||||||
|
|
||||||
export DOTDROP_TEST_NG_UNINSTALL_LINK_TYPE="nolink"
|
export DOTDROP_TEST_NG_UNINSTALL_LINK_TYPE="nolink"
|
||||||
echo "[+] testing uninstall link:${DOTDROP_TEST_NG_UNINSTALL_LINK_TYPE}..."
|
echo "[+] testing uninstall link:${DOTDROP_TEST_NG_UNINSTALL_LINK_TYPE}..."
|
||||||
uninstall_with_link
|
uninstall_with_link || exit 1
|
||||||
echo "[+] uninstall link ${DOTDROP_TEST_NG_UNINSTALL_LINK_TYPE} OK"
|
echo "[+] uninstall link:${DOTDROP_TEST_NG_UNINSTALL_LINK_TYPE} OK"
|
||||||
|
|
||||||
export DOTDROP_TEST_NG_UNINSTALL_LINK_TYPE="absolute"
|
export DOTDROP_TEST_NG_UNINSTALL_LINK_TYPE="absolute"
|
||||||
echo "[+] testing uninstall link:${DOTDROP_TEST_NG_UNINSTALL_LINK_TYPE}..."
|
echo "[+] testing uninstall link:${DOTDROP_TEST_NG_UNINSTALL_LINK_TYPE}..."
|
||||||
uninstall_with_link
|
uninstall_with_link || exit 1
|
||||||
echo "[+] uninstall link ${DOTDROP_TEST_NG_UNINSTALL_LINK_TYPE} OK"
|
echo "[+] uninstall link:${DOTDROP_TEST_NG_UNINSTALL_LINK_TYPE} OK"
|
||||||
|
|
||||||
export DOTDROP_TEST_NG_UNINSTALL_LINK_TYPE="relative"
|
export DOTDROP_TEST_NG_UNINSTALL_LINK_TYPE="relative"
|
||||||
echo "[+] testing uninstall link:${DOTDROP_TEST_NG_UNINSTALL_LINK_TYPE}..."
|
echo "[+] testing uninstall link:${DOTDROP_TEST_NG_UNINSTALL_LINK_TYPE}..."
|
||||||
uninstall_with_link
|
uninstall_with_link || exit 1
|
||||||
echo "[+] uninstall link ${DOTDROP_TEST_NG_UNINSTALL_LINK_TYPE} OK"
|
echo "[+] uninstall link:${DOTDROP_TEST_NG_UNINSTALL_LINK_TYPE} OK"
|
||||||
|
|
||||||
export DOTDROP_TEST_NG_UNINSTALL_LINK_TYPE="link_children"
|
export DOTDROP_TEST_NG_UNINSTALL_LINK_TYPE="link_children"
|
||||||
echo "[+] testing uninstall link:${DOTDROP_TEST_NG_UNINSTALL_LINK_TYPE}..."
|
echo "[+] testing uninstall link:${DOTDROP_TEST_NG_UNINSTALL_LINK_TYPE}..."
|
||||||
uninstall_with_link
|
uninstall_with_link || exit 1
|
||||||
echo "[+] uninstall link ${DOTDROP_TEST_NG_UNINSTALL_LINK_TYPE} OK"
|
echo "[+] uninstall link:${DOTDROP_TEST_NG_UNINSTALL_LINK_TYPE} OK"
|
||||||
|
|
||||||
# TODO test
|
# TODO test
|
||||||
# - symlink file (absolute, relative)
|
|
||||||
# - symlink directory (absolute, relative, link_children)
|
|
||||||
# - transformation
|
# - transformation
|
||||||
# - template
|
|
||||||
|
|
||||||
echo "OK"
|
echo "OK"
|
||||||
exit 0
|
exit 0
|
||||||
152
tests-ng/uninstall_
vendored
152
tests-ng/uninstall_
vendored
@@ -1,12 +1,27 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# author: deadc0de6 (https://github.com/deadc0de6)
|
||||||
|
# Copyright (c) 2023, deadc0de6
|
||||||
|
#
|
||||||
|
# returns 1 in case of error
|
||||||
|
#
|
||||||
|
|
||||||
################################################################
|
################################################################
|
||||||
# this is the test
|
# this is the test
|
||||||
################################################################
|
################################################################
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
ddpath="${DOTDROP_TEST_NG_UNINSTALL_DDPATH}"
|
||||||
|
bin="${DOTDROP_TEST_NG_UNINSTALL_BIN}"
|
||||||
|
LINK_TYPE="${DOTDROP_TEST_NG_UNINSTALL_LINK_TYPE:-nolink}"
|
||||||
|
PRE="[link:${LINK_TYPE}]"
|
||||||
|
PRO_TEMPL="{{@@ profile @@}}"
|
||||||
|
|
||||||
# $1 pattern
|
# $1 pattern
|
||||||
# $2 path
|
# $2 path
|
||||||
grep_or_fail()
|
grep_or_fail()
|
||||||
{
|
{
|
||||||
grep "${1}" "${2}" >/dev/null 2>&1 || (echo "pattern \"${1}\" not found in ${2}" && exit 1)
|
grep "${1}" "${2}" >/dev/null 2>&1 || (echo "${PRE} pattern \"${1}\" not found in ${2}" && return 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
# $1: basedir
|
# $1: basedir
|
||||||
@@ -18,6 +33,11 @@ create_hierarchy()
|
|||||||
echo "${2}" > "${1}"/y/file
|
echo "${2}" > "${1}"/y/file
|
||||||
mkdir -p "${1}"/y/subdir
|
mkdir -p "${1}"/y/subdir
|
||||||
echo "${2}" > "${1}"/y/subdir/subfile
|
echo "${2}" > "${1}"/y/subdir/subfile
|
||||||
|
echo "profile: ${PRO_TEMPL}" > "${1}"/t
|
||||||
|
mkdir -p "${1}"/z
|
||||||
|
echo "profile t1: ${PRO_TEMPL}" > "${1}"/z/t1
|
||||||
|
echo "profile t2: ${PRO_TEMPL}" > "${1}"/z/t2
|
||||||
|
echo "${2}" > "${1}"/z/file
|
||||||
}
|
}
|
||||||
|
|
||||||
# $1: basedir
|
# $1: basedir
|
||||||
@@ -25,34 +45,35 @@ clean_hierarchy()
|
|||||||
{
|
{
|
||||||
rm -f "${1}"/x
|
rm -f "${1}"/x
|
||||||
rm -rf "${1}"/y
|
rm -rf "${1}"/y
|
||||||
|
rm -f "${1}/"t
|
||||||
|
rm -rf "${1}"/z
|
||||||
}
|
}
|
||||||
|
|
||||||
uninstall_with_link()
|
uninstall_with_link()
|
||||||
{
|
{
|
||||||
ddpath="${DOTDROP_TEST_NG_UNINSTALL_DDPATH}"
|
|
||||||
bin="${DOTDROP_TEST_NG_UNINSTALL_BIN}"
|
|
||||||
|
|
||||||
# dotdrop directory
|
# dotdrop directory
|
||||||
basedir=$(mktemp -d --suffix='-dotdrop-tests' || mktemp -d)
|
basedir=$(mktemp -d --suffix='-dotdrop-tests' || mktemp -d)
|
||||||
mkdir -p "${basedir}"/dotfiles
|
mkdir -p "${basedir}"/dotfiles
|
||||||
echo "[+] dotdrop dir: ${basedir}"
|
echo "[+] dotdrop dir: ${basedir}"
|
||||||
echo "[+] dotpath dir: ${basedir}/dotfiles"
|
echo "[+] dotpath dir: ${basedir}/dotfiles"
|
||||||
tmpd=$(mktemp -d --suffix='-dotdrop-tests' || mktemp -d)
|
tmpd=$(mktemp -d --suffix='-dotdrop-tests' || mktemp -d)
|
||||||
|
tmpw=$(mktemp -d --suffix='-dotdrop-workdir' || mktemp -d)
|
||||||
|
|
||||||
clear_on_exit "${basedir}/dotfiles"
|
clear_on_return "${basedir}/dotfiles"
|
||||||
clear_on_exit "${tmpd}"
|
clear_on_return "${tmpd}"
|
||||||
|
clear_on_return "${tmpw}"
|
||||||
|
|
||||||
create_hierarchy "${basedir}/dotfiles" "modified"
|
create_hierarchy "${basedir}/dotfiles" "modified"
|
||||||
|
|
||||||
# create the config file
|
# create the config file
|
||||||
cfg="${basedir}/config.yaml"
|
cfg="${basedir}/config.yaml"
|
||||||
LINK_TYPE="${DOTDROP_TEST_NG_UNINSTALL_LINK_TYPE:-nolink}"
|
|
||||||
cat > "${cfg}" << _EOF
|
cat > "${cfg}" << _EOF
|
||||||
config:
|
config:
|
||||||
backup: true
|
backup: true
|
||||||
create: true
|
create: true
|
||||||
dotpath: dotfiles
|
dotpath: dotfiles
|
||||||
link_dotfile_default: ${LINK_TYPE}
|
link_dotfile_default: ${LINK_TYPE}
|
||||||
|
workdir: ${tmpw}
|
||||||
dotfiles:
|
dotfiles:
|
||||||
f_x:
|
f_x:
|
||||||
src: x
|
src: x
|
||||||
@@ -60,11 +81,19 @@ dotfiles:
|
|||||||
d_y:
|
d_y:
|
||||||
src: y
|
src: y
|
||||||
dst: ${tmpd}/y
|
dst: ${tmpd}/y
|
||||||
|
f_t:
|
||||||
|
src: t
|
||||||
|
dst: ${tmpd}/t
|
||||||
|
d_z:
|
||||||
|
src: z
|
||||||
|
dst: ${tmpd}/z
|
||||||
profiles:
|
profiles:
|
||||||
p1:
|
p1:
|
||||||
dotfiles:
|
dotfiles:
|
||||||
- f_x
|
- f_x
|
||||||
- d_y
|
- d_y
|
||||||
|
- f_t
|
||||||
|
- d_z
|
||||||
_EOF
|
_EOF
|
||||||
|
|
||||||
#########################
|
#########################
|
||||||
@@ -73,26 +102,45 @@ _EOF
|
|||||||
|
|
||||||
# install
|
# install
|
||||||
echo "[+] install (1)"
|
echo "[+] install (1)"
|
||||||
cd "${ddpath}" | ${bin} install -c "${cfg}" -f -p p1 | grep '^2 dotfile(s) installed.$'
|
( \
|
||||||
|
cd "${ddpath}" && ${bin} install -c "${cfg}" -f -p p1 | grep '^4 dotfile(s) installed.$' \
|
||||||
|
)
|
||||||
|
|
||||||
# tests
|
# tests
|
||||||
[ ! -e "${tmpd}"/x ] && echo "f_x not installed" && exit 1
|
[ ! -e "${tmpd}"/x ] && echo "${PRE} f_x not installed" && return 1
|
||||||
[ ! -e "${tmpd}"/y/file ] && echo "d_y not installed" && exit 1
|
[ ! -e "${tmpd}"/y/file ] && echo "${PRE} d_y not installed" && return 1
|
||||||
[ ! -e "${tmpd}"/y/subdir/subfile ] && echo "d_y not installed" && exit 1
|
[ ! -e "${tmpd}"/y/subdir/subfile ] && echo "${PRE} d_y not installed" && return 1
|
||||||
|
[ ! -e "${tmpd}"/t ] && echo "${PRE} f_t not installed" && return 1
|
||||||
|
[ ! -e "${tmpd}"/z/t1 ] && echo "${PRE} d_z t1 not installed" && return 1
|
||||||
|
[ ! -e "${tmpd}"/z/t2 ] && echo "${PRE} d_z t2 not installed" && return 1
|
||||||
|
[ ! -e "${tmpd}"/z/file ] && echo "${PRE} d_z file not installed" && return 1
|
||||||
grep_or_fail 'modified' "${tmpd}"/x
|
grep_or_fail 'modified' "${tmpd}"/x
|
||||||
grep_or_fail 'modified' "${tmpd}"/y/file
|
grep_or_fail 'modified' "${tmpd}"/y/file
|
||||||
|
grep_or_fail 'profile: p1' "${tmpd}"/t
|
||||||
|
grep_or_fail 'profile t1: p1' "${tmpd}"/z/t1
|
||||||
|
grep_or_fail 'profile t2: p1' "${tmpd}"/z/t2
|
||||||
|
grep_or_fail 'modified' "${tmpd}"/z/file
|
||||||
|
|
||||||
# uninstall
|
# uninstall
|
||||||
echo "[+] uninstall (1)"
|
echo "[+] uninstall (1)"
|
||||||
cd "${ddpath}" | ${bin} uninstall -c "${cfg}" -f -p p1 --verbose
|
( \
|
||||||
[ "$?" != "0" ] && exit 1
|
cd "${ddpath}" && ${bin} uninstall -c "${cfg}" -f -p p1 --verbose \
|
||||||
|
)
|
||||||
|
[ "$?" != "0" ] && return 1
|
||||||
|
|
||||||
# tests
|
# tests
|
||||||
[ ! -d "${basedir}"/dotfiles ] && echo "dotpath removed" && exit 1
|
[ ! -d "${basedir}"/dotfiles ] && echo "${PRE} dotpath removed" && return 1
|
||||||
[ -e "${tmpd}"/x ] && echo "f_x not uninstalled" && exit 1
|
[ -e "${tmpd}"/x ] && echo "${PRE} f_x not uninstalled" && return 1
|
||||||
[ -d "${tmpd}"/y ] && echo "d_y dir not uninstalled" && exit 1
|
[ -d "${tmpd}"/y ] && echo "${PRE} d_y dir not uninstalled" && return 1
|
||||||
[ -e "${tmpd}"/y/file ] && echo "d_y file not uninstalled" && exit 1
|
[ -e "${tmpd}"/y/file ] && echo "${PRE} d_y file not uninstalled" && return 1
|
||||||
[ -e "${tmpd}"/y/subdir/subfile ] && echo "d_y subfile not uninstalled" && exit 1
|
[ -e "${tmpd}"/y/subdir/subfile ] && echo "${PRE} d_y subfile not uninstalled" && return 1
|
||||||
|
[ -e "${tmpd}"/t ] && echo "${PRE} f_t not uninstalled" && return 1
|
||||||
|
[ -e "${tmpd}"/z/t1 ] && echo "${PRE} d_z subfile t1 not uninstalled" && return 1
|
||||||
|
[ -e "${tmpd}"/z/t2 ] && echo "${PRE} d_z subfile t2 not uninstalled" && return 1
|
||||||
|
[ -e "${tmpd}"/z/file ] && echo "${PRE} d_z subfile file not uninstalled" && return 1
|
||||||
|
|
||||||
|
# test workdir is empty
|
||||||
|
[ -z "$(ls -A "${tmpw}")" ] && (echo "${PRE} workdir (1) is not empty"; ls -r "${tmpw}"; return 1)
|
||||||
|
|
||||||
#########################
|
#########################
|
||||||
## with original
|
## with original
|
||||||
@@ -105,31 +153,67 @@ _EOF
|
|||||||
|
|
||||||
# install
|
# install
|
||||||
echo "[+] install (2)"
|
echo "[+] install (2)"
|
||||||
cd "${ddpath}" | ${bin} install -c "${cfg}" -f -p p1 | grep '^2 dotfile(s) installed.$'
|
cd "${ddpath}" | ${bin} install -c "${cfg}" -f -p p1 | grep '^4 dotfile(s) installed.$'
|
||||||
|
|
||||||
# tests
|
# tests
|
||||||
[ ! -e "${tmpd}"/x ] && echo "f_x not installed" && exit 1
|
[ ! -e "${tmpd}"/x ] && echo "${PRE} f_x not installed" && return 1
|
||||||
[ ! -d "${tmpd}"/y ] && echo "d_y not installed" && exit 1
|
[ ! -d "${tmpd}"/y ] && echo "${PRE} d_y not installed" && return 1
|
||||||
[ ! -e "${tmpd}"/y/file ] && echo "d_y file not installed" && exit 1
|
[ ! -e "${tmpd}"/y/file ] && echo "${PRE} d_y file not installed" && return 1
|
||||||
[ ! -e "${tmpd}"/y/subdir/subfile ] && echo "d_y subfile not installed" && exit 1
|
[ ! -e "${tmpd}"/y/subdir/subfile ] && echo "${PRE} d_y subfile not installed" && return 1
|
||||||
|
[ ! -e "${tmpd}"/t ] && echo "${PRE} f_t not installed" && return 1
|
||||||
|
[ ! -e "${tmpd}"/z/t1 ] && echo "${PRE} d_z t1 not installed" && return 1
|
||||||
|
[ ! -e "${tmpd}"/z/t2 ] && echo "${PRE} d_z t2 not installed" && return 1
|
||||||
|
[ ! -e "${tmpd}"/z/file ] && echo "${PRE} d_z file not installed" && return 1
|
||||||
grep_or_fail 'modified' "${tmpd}"/x
|
grep_or_fail 'modified' "${tmpd}"/x
|
||||||
grep_or_fail 'modified' "${tmpd}"/y/file
|
grep_or_fail 'modified' "${tmpd}"/y/file
|
||||||
|
grep_or_fail 'profile: p1' "${tmpd}"/t
|
||||||
|
grep_or_fail 'profile t1: p1' "${tmpd}"/z/t1
|
||||||
|
grep_or_fail 'profile t2: p1' "${tmpd}"/z/t2
|
||||||
|
grep_or_fail 'modified' "${tmpd}"/z/file
|
||||||
|
|
||||||
# uninstall
|
# uninstall
|
||||||
echo "[+] uninstall (2)"
|
echo "[+] uninstall (2)"
|
||||||
cd "${ddpath}" | ${bin} uninstall -c "${cfg}" -f -p p1 --verbose
|
( \
|
||||||
[ "$?" != "0" ] && exit 1
|
cd "${ddpath}" && ${bin} uninstall -c "${cfg}" -f -p p1 --verbose \
|
||||||
|
)
|
||||||
|
[ "$?" != "0" ] && return 1
|
||||||
|
|
||||||
tree "${tmpd}"
|
|
||||||
# tests
|
# tests
|
||||||
[ ! -d "${basedir}"/dotfiles ] && echo "dotpath removed" && exit 1
|
[ ! -d "${basedir}"/dotfiles ] && echo "${PRE} dotpath removed" && return 1
|
||||||
[ ! -e "${tmpd}"/x ] && echo "f_x backup not restored" && exit 1
|
[ ! -e "${tmpd}"/x ] && echo "${PRE} f_x backup not restored" && return 1
|
||||||
[ -e "${tmpd}"/x.dotdropbak ] && echo "f_x backup not removed" && exit 1
|
[ -e "${tmpd}"/x.dotdropbak ] && echo "${PRE} f_x backup not removed" && return 1
|
||||||
[ ! -d "${tmpd}"/y ] && echo "d_y backup not restored" && exit 1
|
[ ! -d "${tmpd}"/y ] && echo "${PRE} d_y backup not restored" && return 1
|
||||||
[ ! -e "${tmpd}"/y/file ] && echo "d_y backup not restored" && exit 1
|
[ ! -e "${tmpd}"/y/file ] && echo "${PRE} d_y backup not restored" && return 1
|
||||||
[ -e "${tmpd}"/y/file.dotdropbak ] && echo "d_y backup not removed" && exit 1
|
[ -e "${tmpd}"/y/file.dotdropbak ] && echo "${PRE} d_y backup not removed" && return 1
|
||||||
[ ! -e "${tmpd}"/y/subdir/subfile ] && echo "d_y sub backup not restored" && exit 1
|
[ ! -e "${tmpd}"/y/subdir/subfile ] && echo "${PRE} d_y sub backup not restored" && return 1
|
||||||
[ -e "${tmpd}"/y/subdir/subfile.dotdropbak ] && echo "d_y sub backup not removed" && exit 1
|
[ -e "${tmpd}"/y/subdir/subfile.dotdropbak ] && echo "${PRE} d_y sub backup not removed" && return 1
|
||||||
|
|
||||||
|
[ ! -e "${tmpd}"/t ] && echo "${PRE} f_t not restored" && return 1
|
||||||
|
[ -e "${tmpd}"/t.dotdropback ] && echo "${PRE} f_t backup not removed" && return 1
|
||||||
|
[ ! -e "${tmpd}"/z/t1 ] && echo "${PRE} d_z t1 not restore" && return 1
|
||||||
|
[ -e "${tmpd}"/z/t1.dotdropback ] && echo "${PRE} d_z t1 backup not removed" && return 1
|
||||||
|
[ ! -e "${tmpd}"/z/t2 ] && echo "${PRE} d_z t2 not restored" && return 1
|
||||||
|
[ -e "${tmpd}"/z/t2.dotdropback ] && echo "${PRE} d_z t2 backup not removed" && return 1
|
||||||
|
[ ! -e "${tmpd}"/z/file ] && echo "${PRE} d_z file not restored" && return 1
|
||||||
|
[ -e "${tmpd}"/z/file.dotdropbak ] && echo "${PRE} d_z file backup not removed" && return 1
|
||||||
|
|
||||||
grep_or_fail 'original' "${tmpd}"/x
|
grep_or_fail 'original' "${tmpd}"/x
|
||||||
grep_or_fail 'original' "${tmpd}"/y/file
|
grep_or_fail 'original' "${tmpd}"/y/file
|
||||||
|
grep_or_fail "profile: ${PRO_TEMPL}" "${tmpd}/t"
|
||||||
|
grep_or_fail "profile t1: ${PRO_TEMPL}" "${tmpd}/z/t1"
|
||||||
|
grep_or_fail "profile t2: ${PRO_TEMPL}" "${tmpd}/z/t2"
|
||||||
|
grep_or_fail 'original' "${tmpd}"/z/file
|
||||||
|
|
||||||
|
echo "testing workdir..."
|
||||||
|
|
||||||
|
# test workdir is empty
|
||||||
|
[ -n "$(ls -A "${tmpw}")" ] && ( \
|
||||||
|
echo "${PRE} workdir (2) - ${tmpw} - is not empty"; \
|
||||||
|
ls -r "${tmpw}"; \
|
||||||
|
return 1; \
|
||||||
|
)
|
||||||
|
|
||||||
|
echo "${PRE} done OK"
|
||||||
|
|
||||||
|
return 0
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user