Note

The Funtoo Linux project has transitioned to "Hobby Mode" and this wiki is now read-only.

User:Cuantar

From Funtoo
Revision as of 21:11, February 17, 2024 by Cuantar (talk | contribs) (move --rbinds to filesystem mount function)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search




Useful bits

It's often handy to be able to open a system quickly from a rescue disk. I use a script like the following:

   /root/unlock.sh (bash source code) - script to open a Funtoo rootfs
#!/bin/bash

mount_filesystems() {
        mkdir /mnt/funtoo -p
        mount /dev/${volgroup}/root /mnt/funtoo
        mkdir /mnt/funtoo/{usr,var,tmp,opt,boot} -p
        mount /dev/${volgroup}/boot /mnt/funtoo/boot
        mount /dev/${volgroup}/usr /mnt/funtoo/usr
        mount /dev/${volgroup}/var /mnt/funtoo/var
        mount /dev/${volgroup}/opt /mnt/funtoo/opt
        mount /dev/${volgroup}/tmp /mnt/funtoo/tmp
        mkdir /mnt/funtoo/var/{git,tmp,cache/portage} -p
        mount /dev/${volgroup}/var_tmp /mnt/funtoo/var/tmp/
        mount /dev/${volgroup}/var_cache /mnt/funtoo/var/cache/
        mount /dev/${volgroup}/var_git  /mnt/funtoo/var/git/
        swapon /dev/${volgroup}/swap
        mount --rbind /dev /mnt/funtoo/dev/
        mount --rbind /proc /mnt/funtoo/proc/
        mount --rbind /sys /mnt/funtoo/sys/
}


enter_chroot() {
        chroot /mnt/funtoo /bin/bash
}


main() {
        mount_filesystems
        enter_chroot
}


volgroup='v0' main

To use it yourself, change the volgroup variable to match your volume group and adjust the paths to agree with your fstab.