From ThePythonicCow, 10 Months ago, written in Plain Text.
This paste will give up the ghost in 3 Weeks.
This paste is a reply to Untitled from ThePythonicCow
- view diff
Embed
  1. $ cat $HOME/bin/do_chroot_artix
  2.  
  3. #!/bin/zsh
  4.  
  5. set -e  # exit on error
  6.  
  7. artix_mounts=$(mount | grep ' on /artix' | cut -d' ' -f3)
  8.  
  9. test -d /artix ||
  10.     mkdir /artix;            echo -n .
  11. echo "$artix_mounts" | grep -qFx /artix ||
  12.     mount -t ext4 /dev/nvme0n1p3 /artix;      echo -n .
  13. echo "$artix_mounts" | grep -qFx /artix/boot/efi ||
  14.     mount -t vfat /dev/nvme0n1p1 /artix/boot/efi;   echo -n .
  15. echo "$artix_mounts" | grep -qFx /artix/dev ||
  16.     mount -o bind /dev /artix/dev;        echo -n .
  17. echo "$artix_mounts" | grep -qFx /artix/dev/pts ||
  18.     mount -t devpts devpts /artix/dev/pts;      echo -n .
  19. echo "$artix_mounts" | grep -qFx /artix/proc ||
  20.     mount -t proc proc /artix/proc;        echo -n .
  21. echo "$artix_mounts" | grep -qFx /artix/run ||
  22.     mount -t tmpfs tmpfs /artix/run;        echo -n .
  23. echo "$artix_mounts" | grep -qFx /artix/sys ||
  24.     mount -t sysfs sys /artix/sys;        echo .
  25.  
  26. echo doing chroot to /artix/home/pj as login pj
  27. exec sudo chroot /artix su --login pj
captcha