]> git.wh0rd.org Git - home.git/commitdiff
update chroot
authorMike Frysinger <vapier@gentoo.org>
Mon, 17 Aug 2009 03:07:58 +0000 (03:07 +0000)
committerMike Frysinger <vapier@gentoo.org>
Sat, 28 Apr 2012 19:36:08 +0000 (15:36 -0400)
.bin/custom-chroot [changed mode: 0644->0755]

old mode 100644 (file)
new mode 100755 (executable)
index 6ad7bb6..60da7af
@@ -1,10 +1,13 @@
-!/bin/bash -e
+#!/bin/bash -e
 
 [[ -w / ]] || exec sudo "$0" "$@"
-[[ $# -eq 0 ]] && set -- /bin/bash -l
+[[ $# -eq 0 ]] && set -- env HOME=/root /bin/bash -l
 mounts="proc sys dev dev/pts"
 
 chroot=${0%/*}
+case ${chroot} in
+       .) chroot=${PWD} ;;
+esac
 cd "${chroot}"
 
 maybe_mount() {
@@ -30,7 +33,7 @@ else
        setarch="setarch ${bin_dst}"
 fi
 
-if [[ ! -L /etc/mtab ]] ; then
+if [[ ! -L etc/mtab ]] ; then
        rm -f etc/mtab
        ln -sf /proc/mounts etc/mtab
 fi
@@ -40,16 +43,21 @@ etc="
        localtime
        resolv.conf
 "
-root="
+home="
        .inputrc
        .nanorc
 "
 for f in \
        $(printf 'etc/%s ' ${etc}) \
-       $(printf 'root/%s ' ${root}) \
 ; do
        cp /${f} ${f}
 done
+for f in ${home} ; do
+       cp ~/${f} root/${f}
+done
 
 unset LS_COLORS # format changes over time
-exec ${setarch} chroot "${chroot}" "$@"
+exec \
+       ${setarch} \
+       chroot "${chroot}" \
+       "$@"