Advertisement
Guest User

Untitled

a guest
May 23rd, 2017
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.59 KB | None | 0 0
  1. #!/bin/bash
  2. MEMSIZE=200M
  3. mounted=false
  4.  
  5. . /sbin/functions.sh
  6.  
  7. mounttmpfs() {
  8.      mount -t tmpfs tmpfs -o size=$MEMSIZE /var/tmp/portage
  9.      mounted="true"
  10. }
  11.  
  12. compile() {
  13.      einfo "emerging ${*}"
  14.           emerge ${*}
  15. }
  16.  
  17. unmount() {
  18.      ebegin "unmounting tmpfs"
  19.           umount -f /var/tmp/portage
  20.      eend $?
  21. }
  22.  
  23. ebegin "Mounting $MEMSIZE of memory to /var/tmp/portage"
  24. if [ -z "$(mount | grep /var/tmp/portage)" ]
  25. then
  26.      mounttmpfs
  27. else
  28.      eerror "tmpfs already mounted!"
  29.      exit 0
  30. fi
  31. eend $?
  32.  
  33. compile ${*}
  34.  
  35. if [ -n "$mounted" ]
  36. then
  37.      unmount
  38. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement