forked from kiss-community/kiss
kiss-chroot: Minor changes. Closes #286
This commit is contained in:
parent
1c743cea46
commit
9f31e3db97
@ -1,4 +1,4 @@
|
|||||||
#!/bin/sh -e
|
#!/bin/sh
|
||||||
# Enter a kiss chroot
|
# Enter a kiss chroot
|
||||||
|
|
||||||
log() {
|
log() {
|
||||||
@ -16,8 +16,8 @@ run() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
clean() {
|
clean() {
|
||||||
log Unmounting host filesystems; {
|
log Unmounting host paths; {
|
||||||
run umount "$1/dev/shm"
|
run umount "$1/dev/shm" 2>/dev/null
|
||||||
run umount "$1/dev/pts"
|
run umount "$1/dev/pts"
|
||||||
run umount "$1/dev"
|
run umount "$1/dev"
|
||||||
run umount "$1/proc"
|
run umount "$1/proc"
|
||||||
@ -25,10 +25,7 @@ clean() {
|
|||||||
run umount "$1/sys/firmware/efi/efivars" 2>/dev/null
|
run umount "$1/sys/firmware/efi/efivars" 2>/dev/null
|
||||||
run umount "$1/sys"
|
run umount "$1/sys"
|
||||||
run umount "$1/tmp"
|
run umount "$1/tmp"
|
||||||
}
|
run umount "$1/etc/resolv.conf"
|
||||||
|
|
||||||
log Cleaning leftover host files; {
|
|
||||||
run rm -f "$1/etc/resolv.conf"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -62,19 +59,18 @@ main() {
|
|||||||
|
|
||||||
trap 'clean "${1%"${1##*[!/]}"}"' EXIT INT
|
trap 'clean "${1%"${1##*[!/]}"}"' EXIT INT
|
||||||
|
|
||||||
log Mounting host filesystems; {
|
log Mounting host paths; {
|
||||||
mmount "$1/dev" -o bind /dev
|
mmount "$1/dev" -o bind /dev
|
||||||
mmount "$1/dev/pts" -o bind /dev/pts
|
mmount "$1/dev/pts" -o bind /dev/pts
|
||||||
mmount "$1/dev/shm" -t tmpfs shmfs
|
mmount "$1/dev/shm" -t tmpfs shmfs 2>/dev/null
|
||||||
mmount "$1/proc" -t proc proc
|
mmount "$1/proc" -t proc proc
|
||||||
mmount "$1/run" -t tmpfs tmpfs
|
mmount "$1/run" -t tmpfs tmpfs
|
||||||
mmount "$1/sys" -t sysfs sys
|
mmount "$1/sys" -t sysfs sys
|
||||||
mmount "$1/sys/firmware/efi/efivars" -t efivarfs efivarfs 2>/dev/null
|
mmount "$1/sys/firmware/efi/efivars" -t efivarfs efivarfs 2>/dev/null
|
||||||
mmount "$1/tmp" -o mode=1777,nosuid,nodev -t tmpfs tmpfs
|
mmount "$1/tmp" -o mode=1777,nosuid,nodev -t tmpfs tmpfs
|
||||||
}
|
|
||||||
|
|
||||||
log Copying /etc/resolv.conf from host; {
|
touch "$1/etc/resolv.conf"
|
||||||
run cp -f /etc/resolv.conf "$1/etc"
|
mmount "$1/etc/resolv.conf" -o bind /etc/resolv.conf
|
||||||
}
|
}
|
||||||
|
|
||||||
log Entering chroot; {
|
log Entering chroot; {
|
||||||
@ -90,7 +86,7 @@ main() {
|
|||||||
CXXFLAGS="${CXXFLAGS:--march=x86-64 -mtune=generic -pipe -O2}" \
|
CXXFLAGS="${CXXFLAGS:--march=x86-64 -mtune=generic -pipe -O2}" \
|
||||||
MAKEFLAGS="${MAKEFLAGS:--j$(nproc 2>/dev/null || echo 1)}" \
|
MAKEFLAGS="${MAKEFLAGS:--j$(nproc 2>/dev/null || echo 1)}" \
|
||||||
/bin/sh -l
|
/bin/sh -l
|
||||||
}
|
} || die chroot failed
|
||||||
}
|
}
|
||||||
|
|
||||||
main "$1"
|
main "$1"
|
||||||
|
Loading…
Reference in New Issue
Block a user