1
0
mirror of https://github.com/deadc0de6/dotdrop.git synced 2026-02-04 18:34:48 +00:00

enable force on install

This commit is contained in:
deadc0de6
2020-11-16 14:25:16 +01:00
parent 7dd8019582
commit 315a898e77
10 changed files with 16 additions and 13 deletions

View File

@@ -242,7 +242,7 @@ echo "nomode" > ${tmps}/dotfiles/nomode
chmod 600 ${tmps}/dotfiles/nomode
echo "nomode" > ${tmpd}/nomode
chmod 600 ${tmpd}/nomode
cd ${ddpath} | ${bin} install -c ${cfg} -p p2 -V f_nomode
cd ${ddpath} | ${bin} install -c ${cfg} -f -p p2 -V f_nomode
has_rights "${tmpd}/nomode" "600"
## no user confirmation with force
@@ -262,7 +262,7 @@ echo "nomode" > ${tmps}/dotfiles/nomode
chmod 600 ${tmps}/dotfiles/nomode
echo "nomode" > ${tmpd}/nomode
chmod 700 ${tmpd}/nomode
cd ${ddpath} | printf 'y\ny\n' | ${bin} install -c ${cfg} -p p2 -V f_nomode
cd ${ddpath} | printf 'y\ny\n' | ${bin} install -f -c ${cfg} -p p2 -V f_nomode
has_rights "${tmpd}/nomode" "600"
## CLEANING

View File

@@ -56,6 +56,8 @@ basedir=`mktemp -d --suffix='-dotdrop-tests' || mktemp -d`
echo "[+] dotdrop dir: ${basedir}"
echo "[+] dotpath dir: ${basedir}/dotfiles"
export DOTDROP_WORKERS=1
# create the config file
cfg="${basedir}/config.yaml"
cat > ${cfg} << _EOF

View File

@@ -98,7 +98,7 @@ mkdir -p ${tmps}/dotfiles/
echo "abc" > ${tmps}/dotfiles/abc
# install
cd ${ddpath} | ${bin} install -c ${cfg} -p p1 -V
cd ${ddpath} | ${bin} install -c ${cfg} -f -p p1 -V
# checks
[ ! -e ${tmpd}/abc ] && echo "dotfile not installed" && exit 1

View File

@@ -143,7 +143,7 @@ cd ${ddpath} | ${bin} files -c ${cfg1} -p pup -V | grep f_sub
cd ${ddpath} | ${bin} files -c ${cfg1} -p psubsub -V | grep f_sub
# test compare too
cd ${ddpath} | ${bin} install -c ${cfg1} -p p2 -V
cd ${ddpath} | ${bin} install -c ${cfg1} -p p2 -V -f
cd ${ddpath} | ${bin} compare -c ${cfg1} -p p2 -V
# test with non-existing dotpath this time

View File

@@ -97,9 +97,9 @@ cd ${ddpath} | ${bin} import -c ${cfg} -p p1 --verbose ${dftoimport}
[ "$?" != "0" ] && exit 1
echo "[+] install"
cd ${ddpath} | ${bin} install -c ${cfg} -p p1 --verbose | grep '^5 dotfile(s) installed.$'
cd ${ddpath} | ${bin} install -c ${cfg} -f -p p1 --verbose | grep '^5 dotfile(s) installed.$'
rm -f ${dftoimport}
cd ${ddpath} | ${bin} install -c ${cfg} -p p1 --verbose | grep '^6 dotfile(s) installed.$'
cd ${ddpath} | ${bin} install -c ${cfg} -f -p p1 --verbose | grep '^6 dotfile(s) installed.$'
nb=`cd ${ddpath} | ${bin} files -c ${cfg} -p p1 --verbose | grep '^[a-zA-Z]' | wc -l`
[ "${nb}" != "6" ] && echo 'error in dotfile list' && exit 1

View File

@@ -55,6 +55,7 @@ tmpd=`mktemp -d --suffix='-dotdrop-tests' || mktemp -d`
# temporary
tmpa=`mktemp -d --suffix='-dotdrop-tests' || mktemp -d`
export DOTDROP_WORKERS=1
# create the config file
cfg="${tmps}/config.yaml"

View File

@@ -87,7 +87,7 @@ profiles:
_EOF
echo "[+] install"
cd ${ddpath} | ${bin} install -c ${cfg} -p p1 --verbose | grep '^5 dotfile(s) installed.$'
cd ${ddpath} | ${bin} install -c ${cfg} -f -p p1 --verbose | grep '^5 dotfile(s) installed.$'
[ "$?" != "0" ] && exit 1
## CLEANING

View File

@@ -82,7 +82,7 @@ echo "new data" > ${basedir}/dotfiles/${tmpd}/readmes/README.md
# install
rm -rf ${tmpd}
echo "[+] install normal"
cd ${ddpath} | ${bin} install --showdiff -c ${cfg} --verbose
cd ${ddpath} | ${bin} install --showdiff -c ${cfg} --verbose -f
[ "$?" != "0" ] && exit 1
nb=`find ${tmpd} -iname 'README.md' | wc -l`
echo "(1) found ${nb} README.md file(s)"
@@ -96,7 +96,7 @@ cat ${cfg2}
# install
rm -rf ${tmpd}
echo "[+] install with ignore in dotfile"
cd ${ddpath} | ${bin} install -c ${cfg2} --verbose
cd ${ddpath} | ${bin} install -c ${cfg2} --verbose -f
[ "$?" != "0" ] && exit 1
nb=`find ${tmpd} -iname 'README.md' | wc -l`
echo "(2) found ${nb} README.md file(s)"
@@ -110,7 +110,7 @@ cat ${cfg2}
# install
rm -rf ${tmpd}
echo "[+] install with ignore in config"
cd ${ddpath} | ${bin} install -c ${cfg2} --verbose
cd ${ddpath} | ${bin} install -c ${cfg2} --verbose -f
[ "$?" != "0" ] && exit 1
nb=`find ${tmpd} -iname 'README.md' | wc -l`
echo "(3) found ${nb} README.md file(s)"
@@ -118,7 +118,7 @@ echo "(3) found ${nb} README.md file(s)"
## reinstall to trigger showdiff
echo "showdiff" > ${tmpd}/program/a
cd ${ddpath} | echo "y" | ${bin} install --showdiff -c ${cfg} --verbose
cd ${ddpath} | echo "y" | ${bin} install --showdiff -c ${cfg} --verbose -f
[ "$?" != "0" ] && exit 1
## CLEANING

View File

@@ -84,7 +84,7 @@ echo 'test_y' > ${basedir}/dotfiles/y
echo "00000000 01 02 03 04 05" | xxd -r - ${basedir}/dotfiles/z
echo "[+] install"
cd ${ddpath} | ${bin} install -c ${cfg} -p p1 --showdiff --verbose --temp | grep '^3 dotfile(s) installed.$'
cd ${ddpath} | ${bin} install -f -c ${cfg} -p p1 --showdiff --verbose --temp | grep '^3 dotfile(s) installed.$'
[ "$?" != "0" ] && exit 1
## CLEANING

View File

@@ -88,7 +88,7 @@ cat > ${tmps}/dotfiles/abc << _EOF
_EOF
# install
cd ${ddpath} | ${bin} install -c ${cfg} -p p0 -V
cd ${ddpath} | ${bin} install -c ${cfg} -p p0 -V -f
# test file content
cat ${tmpd}/abc