tag 683837 patch söndagen den 5 augusti 2012 00:10:16 skrev Daniel Baumann: > the problem with the patch is that it will not copy dotfiles in the root > to the target, which is why i'm not copying ${root}/* but ${root}, on > purpose.
Well, the cache don't contain any dotfiles, but I guess that for a generic solution it won't do to skip them nontheless. Thankfully, the solution is quite simple, just copy .../{.?*,*} instead of .../*. Updated patch attached.
--- /usr/share/lxc/templates/lxc-debconf.distrib 2012-08-04 14:46:16.000000000 +0200 +++ /usr/share/lxc/templates/lxc-debconf 2012-08-05 11:23:02.804091649 +0200 @@ -454,7 +454,8 @@ then # system cache in the form of a directory echo -n "Copying system cache to ${_ROOTFS}..." - cp -a "/usr/share/lxc/cache/${_MODE}/${_DISTRIBUTION}_${_ARCHITECTURE}" "${_ROOTFS}" || return 1 + [ -e "${_ROOTFS}" ] || mkdir -p "${_ROOTFS}" + cp -a "/usr/share/lxc/cache/${_MODE}/${_DISTRIBUTION}_${_ARCHITECTURE}"/{.?*,*} "${_ROOTFS}" || return 1 elif ls "/usr/share/lxc/cache/${_MODE}/${_DISTRIBUTION}_${_ARCHITECTURE}".* > /dev/null 2>&1 then # system cache in the form of a tarball @@ -463,8 +464,7 @@ if [ -e "/usr/share/lxc/cache/${_MODE}/${_DISTRIBUTION}_${_ARCHITECTURE}.${_FORMAT}" ] then echo -n "Extracting system cache to ${_ROOTFS}..." - - mkdir -p "${_ROOTFS}" + [ -e "${_ROOTFS}" ] || mkdir -p "${_ROOTFS}" tar xf "/usr/share/lxc/cache/${_MODE}/${_DISTRIBUTION}_${_ARCHITECTURE}.${_FORMAT}" -C "${_ROOTFS}" || return 1 break fi @@ -478,7 +478,8 @@ # make a local copy of the minimal system echo -n "Copying local cache to ${_ROOTFS}..." - cp -a "${_CACHE}/${_DISTRIBUTION}_${_ARCHITECTURE}" "${_ROOTFS}" || return 1 + [ -e "${_ROOTFS}" ] || mkdir -p "${_ROOTFS}" + cp -a "${_CACHE}/${_DISTRIBUTION}_${_ARCHITECTURE}"/{.?*,*} "${_ROOTFS}" || return 1 fi # Add local repositories configured from preseed file
signature.asc
Description: This is a digitally signed message part.