mirror of
https://github.com/ItsDrike/dotfiles.git
synced 2025-06-29 20:20:41 +00:00
Add chroot and backup scripts
This commit is contained in:
parent
db3fe3ff43
commit
8f37b3e30e
3 changed files with 54 additions and 0 deletions
23
home/.local/bin/gentoo-chroot
Executable file
23
home/.local/bin/gentoo-chroot
Executable file
|
@ -0,0 +1,23 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Make sure the partition is mounted according to fstab
|
||||
mount /mnt/gentoo 2>/dev/null
|
||||
|
||||
# Mount necessary directories for chroot to be possible
|
||||
mount --types proc /proc /mnt/gentoo/proc
|
||||
mount --rbind /sys /mnt/gentoo/sys
|
||||
mount --make-rslave /mnt/gentoo/sys
|
||||
mount --rbind /dev /mnt/gentoo/dev
|
||||
mount --make-rslave /mnt/gentoo/dev
|
||||
|
||||
# Chroot with bash shell
|
||||
chroot /mnt/gentoo /bin/bash
|
||||
|
||||
# Unmount recursively mounted directories
|
||||
umount -l /mnt/gentoo/dev{/shm,/pts,}
|
||||
umount -R /mnt/gentoo
|
||||
|
||||
# Remount partition accordingly to fstab
|
||||
# (the above umountings will unmount gentoo completely,
|
||||
# which means that remounting is necessary)
|
||||
mount /mnt/gentoo
|
Loading…
Add table
Add a link
Reference in a new issue