diff options
author | Tails developers <amnesia@boum.org> | 2012-03-23 12:54:17 +0100 |
---|---|---|
committer | Daniel Baumann <daniel@debian.org> | 2012-04-05 07:51:01 +0200 |
commit | 395a2b5f13edc3c3d39a414c403ed317711e9d1b (patch) | |
tree | c632ea5b7321538d7ab15d1b6ccb97040d5afee5 /scripts | |
parent | 72e4af787d6a44c35e97478a35a69b55cb33c191 (diff) | |
download | live-boot-395a2b5f13edc3c3d39a414c403ed317711e9d1b.tar.gz live-boot-395a2b5f13edc3c3d39a414c403ed317711e9d1b.zip |
Delete existing files in the destination's path when creating it.
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/live-helpers | 40 |
1 files changed, 18 insertions, 22 deletions
diff --git a/scripts/live-helpers b/scripts/live-helpers index 13a8cec..ce28742 100644 --- a/scripts/live-helpers +++ b/scripts/live-helpers @@ -1394,33 +1394,29 @@ activate_custom_mounts () continue fi - # FIXME: we don't handle already existing - # non-directory files in the paths of both $source and - # $dest. - if [ ! -d "${dest}" ] then - # if ${dest} is in /home/$user, try fixing - # proper ownership - # FIXME: this should really be handled by - # live-config since we don't know for sure - # which uid a certain user has until then - if trim_path ${dest} | grep -qe "^${rootmnt}/*home/[^/]\+" - then - path="/" - for dir in $(echo ${dest} | sed -e 's|/\+| |g') - do - path=${path}/${dir} - if [ ! -e ${path} ] + # create the destination and delete existing files in + # its path that are in the way + path="/" + for dir in $(echo ${dest} | sed -e 's|/\+| |g') + do + path=$(trim_path ${path}/${dir}) + if [ -f ${path} ] + then + rm -f ${path} + fi + if [ ! -e ${path} ] + then + mkdir -p ${path} + if echo ${path} | grep -qe "^${rootmnt}/*home/[^/]\+" then - mkdir -p ${path} - # assume that the intended user is the first, which is usually the case + # if ${dest} is in /home try fixing proper ownership by assuming that the intended user is the first, which is usually the case + # FIXME: this should really be handled by live-config since we don't know for sure which uid a certain user has until then chown 1000:1000 ${path} fi - done - else - mkdir -p ${dest} - fi + fi + done fi # if ${source} doesn't exist on our persistent media |