diff options
| author | John Ogness <john.ogness@linutronix.de> | 2018-05-04 17:25:10 +0200 |
|---|---|---|
| committer | John Ogness <john.ogness@linutronix.de> | 2018-05-04 17:25:10 +0200 |
| commit | ff8004d3e36bd01fb0ca8369fde056911d0c282e (patch) | |
| tree | 3668e223bbdcad1bc03dc9b152c52b06bfc46877 /lx-trainer-vm/dd-multi.sh | |
| parent | db24a8bfe1b90d09402b28608db7aae8477b894e (diff) | |
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 <john.ogness@linutronix.de>
Diffstat (limited to 'lx-trainer-vm/dd-multi.sh')
| -rwxr-xr-x | lx-trainer-vm/dd-multi.sh | 8 |
1 files 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' | \ |
