Fixing up few issues, adding resolv.conf linking to chroot script

This commit is contained in:
ngn
2024-01-18 15:51:19 +03:00
parent f849284043
commit a8b0feb57d
3 changed files with 24 additions and 31 deletions

View File

@ -31,6 +31,12 @@ error() {
####################
## util functions ##
####################
linkresolv(){
if [ ! -f "$TARGET/etc/resolv.conf" ]; then
ln -sf /run/systemd/resolve/resolv.conf "$TARGET/etc/resolv.conf"
fi
}
chrt() {
mount -t proc proc "$TARGET/proc"
mount -t sysfs sysfs "$TARGET/sys"
@ -40,13 +46,15 @@ chrt() {
mount -o bind /dev "$TARGET/dev"
mount -t devpts none "$TARGET/dev/pts"
mount -t tmpfs tmpfs "$TARGET/run"
mount --bind /run "$TARGET/run"
linkresolv
if [ -h $TARGET/dev/shm ]; then
mkdir -p $TARGET/$(readlink $TARGET/dev/shm)
else
mount -t tmpfs -o nosuid,nodev tmpfs "$TARGET/dev/shm"
fi
local prompt='\['$BOLD'\['$RED'(chroot)\['$RESET'\['$BOLD' \u@\h:\w#\['$RESET' '
chroot "$TARGET" /usr/bin/env -i \