From ff8004d3e36bd01fb0ca8369fde056911d0c282e Mon Sep 17 00:00:00 2001 From: John Ogness Date: Fri, 4 May 2018 17:25:10 +0200 Subject: dd-multi.sh: check if /home is empty before copying /home shouldn't be empty, but check just in case. Getting an error in the middle of the script is very annoying. Signed-off-by: John Ogness --- lx-trainer-vm/dd-multi.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lx-trainer-vm/dd-multi.sh b/lx-trainer-vm/dd-multi.sh index dc205a6..e68e16a 100755 --- a/lx-trainer-vm/dd-multi.sh +++ b/lx-trainer-vm/dd-multi.sh @@ -134,9 +134,11 @@ for dest in $DESTS; do mount ${dest}${ROOTPT} ${TMP_ROOT}${dest}${ROOTPT} mount ${dest}${HOMEPT} ${TMP_ROOT}${dest}${HOMEPT} - # move home directories to home partition - echo "moving /home/* to ${dest}${HOMEPT}" - mv ${TMP_ROOT}${dest}${ROOTPT}/home/* ${TMP_ROOT}${dest}${HOMEPT}/ + # move home directories (if any) to home partition + if [ -n "`ls ${TMP_ROOT}${dest}${ROOTPT}/home`" ]; then + echo "moving /home/* to ${dest}${HOMEPT}" + mv ${TMP_ROOT}${dest}${ROOTPT}/home/* ${TMP_ROOT}${dest}${HOMEPT}/ + fi # setup home partition to be mounted as /home echo 'LABEL=lxhome /home ext4 defaults 0 0' | \ -- cgit v1.2.3