-!/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() {
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
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}" \
+ "$@"