Team Fortress 2 Source Code as on 22/4/2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

65 lines
1.8 KiB

  1. #! /bin/bash
  2. echo "Unpacking the Steam Runtime for your build environment"
  3. DIRNAME="$( dirname $( readlink -f "$0" ) )"
  4. if [[ $# != 3 ]]; then
  5. echo "Usage: $0 chroot_name chroot_tarball personality (linux32|linux)"
  6. exit 1
  7. fi
  8. if [ $EUID -ne 0 ]; then
  9. echo "$0 must be running as root"
  10. exit 1
  11. fi
  12. cd $DIRNAME
  13. CHROOT_NAME=$1
  14. TARBALL=$2
  15. PERSONALITY=$3
  16. echo Unmounting existing chroot...
  17. while $( mount | grep schroot/mount | grep -q $CHROOT_NAME ); do
  18. mount | grep schroot/mount | grep $CHROOT_NAME | awk '{print $3}' | xargs umount
  19. done
  20. echo Unpacking runtime $2...
  21. tar xaf $2.tar.xz
  22. touch $2/timestamp
  23. echo Configuring schroot at $DIRNAME/$TARBALL
  24. cat << EOF > /etc/schroot/chroot.d/$CHROOT_NAME.conf
  25. [$CHROOT_NAME]
  26. description=Steam Runtime
  27. directory=$DIRNAME/$TARBALL
  28. personality=$PERSONALITY
  29. groups=sudo
  30. root-groups=sudo
  31. preserve-environment=true
  32. type=directory
  33. setup.fstab=mount$CHROOT_NAME
  34. EOF
  35. cat << EOF > /etc/schroot/mount$CHROOT_NAME
  36. # fstab: static file system information for chroots.
  37. # Note that the mount point will be prefixed by the chroot path
  38. # (CHROOT_PATH)
  39. #
  40. # <file system> <mount point> <type> <options> <dump> <pass>
  41. proc /proc none rw,bind 0 0
  42. sys /sys none rw,bind 0 0
  43. dev /dev none rw,bind 0 0
  44. dev/pts /dev/pts none rw,bind 0 0
  45. home /home none rw,bind 0 0
  46. tmp /tmp none rw,bind 0 0
  47. # For PulseAudio and other desktop-related things
  48. var/lib/dbus /var/lib/dbus none rw,bind 0 0
  49. run/shm /run/shm none rw,bind 0 0
  50. EOF
  51. if [ -d /data ]; then
  52. cat << EOF >> /etc/schroot/mount$CHROOT_NAME
  53. data /data none rw,bind 0 0
  54. EOF
  55. fi