SHARE
TWEET

Untitled

a guest Dec 10th, 2018 71 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. myEnvSpawn() {
  2.     die() {
  3.         [ $# -gt 0 ] && printf -- "%s\n" "$*"
  4.         exit 1
  5.     }
  6.     zedenv create $1
  7.     zedenv mount $1
  8.     systemd-nspawn -q --bind=/root --bind=/home/adam --bind=/usr/portage --bind=/var/tmp/portage --bind=/usr/local/portage --bind=/gentoo/ccache -D /tmp/zedenv-*$1 /bin/bash << EOF > /root/myEnvSpawn.log 2>&1
  9. # update portage
  10. emerge --sync
  11. update_kernel() {
  12.         # emerge new kernel sources, make new symlink
  13.         newver=$(emerge -pv gentoo-sources | grep ebuild | cut -d '-' -f 4 | cut -d ':' -f 1)
  14.         emerge gentoo-sources || die "emerging gentoo-sources failed"
  15.         ln -sf /usr/src/linux-${newver}-gentoo /usr/src/linux || die "symlink create failed"
  16.  
  17.         # use default kernel options for new kernel version options
  18.         cd /usr/src/linux || die "cd failed"
  19.         make olddefconfig || die "make olddefconfig failed"
  20.  
  21.         # genkernel do the rest
  22.         genkernel all \
  23.                   --clean \
  24.                   --no-mrproper \
  25.                   --kernel-config=/usr/src/linux/.config \
  26.                   --save-config \
  27.                   --zfs \
  28.                   --bootloader=grub \
  29.                   --callback="emerge @module-rebuild zfs" || die "genkernel all failed"
  30.  
  31.         # just keep one kernel around
  32.         eclean-kernel -n 1 || die "eclean failed"
  33.         emerge --depclean || echo "depclean failed"
  34.     }
  35. # check for new kernel version and update kernel
  36. [ -n "$(emerge -pv gentoo-sources | grep '\[ebuild.*U.*\]')" ] && update_kernel
  37.  
  38. # if it makes it this far, update everything and keep going on fails.
  39. emerge -vuDN --with-bdeps=y --keep-going @world
  40.  
  41. # just incase attr of grub.d files got slammed
  42. chmod -x /etc/grub.d/*
  43. chmod +x /etc/grub.d/{00_header,05_zfs_linux.py}
  44. EOF
  45.     # cleanup work dir from /tmp
  46.     zedenv umount $1
  47.     for emptyd in /tmp/zedenv-*$1 ; do rmdir $emptyd ; done
  48.  
  49.     # update bootloader with new boot environment added to the list
  50.     grub-mkconfig -o /boot/grub/grub.cfg
  51.  
  52.     activate_reboot() {
  53.         zedenv activate $1 && reboot
  54.     }
  55.     less /root/myEnvSpawn.log
  56.     read -p "activate new environment and reboot? (Y or N) " -n 1 -r
  57.     [[ $REPLY =~ ^[Yy]$ ]] && activate_reboot
  58. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top