From: Mike Frysinger Date: Sat, 18 Jan 2014 10:14:08 +0000 (-0500) Subject: custom-chroot: skip files that do not exist X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=9ebe6122e5f7dd378bba60dc7249acecc0847cd7;p=home.git custom-chroot: skip files that do not exist --- diff --git a/.bin/custom-chroot b/.bin/custom-chroot index 113ccfa..1306cb9 100755 --- a/.bin/custom-chroot +++ b/.bin/custom-chroot @@ -38,10 +38,9 @@ init_chroot() { [[ -w . ]] || return 0 if [[ ! -L etc/mtab ]] ; then - rm -f etc/mtab - ln -sf /proc/mounts etc/mtab + ln -sfT /proc/mounts etc/mtab fi - local f + local f dst local etc=( hosts locale.gen @@ -57,14 +56,22 @@ init_chroot() { for f in \ $(printf 'etc/%s ' "${etc[@]}") \ ; do - if [ -e "/${f}" ] ; then - cp /${f} ${f} + if [[ -e /${f} ]] ; then + cp "/${f}" "${f}" fi done for f in "${home[@]}" ; do - cp "${HOME}/${f}" "root/${f}" + df="root/${f}" + f="${HOME}/${f}" + if [[ -e ${f} ]] ; then + cp "${f}" "${df}" + fi done - cat ~/.profile.d/aliases.sh > root/.bash_profile + + f="${HOME}/.profile.d/aliases.sh" + if [[ -e ${f} ]] ; then + cat "${f}" > root/.bash_profile + fi } usage() {