Guest User

tomld opensuse script to install from source

a guest
Aug 13th, 2011
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.83 KB | None | 0 0
  1. #!/bin/sh
  2. # tomld opensuse script to install from source
  3.  
  4. if whoami | grep -q root; then echo "error: no root privileges needed"; exit 1; fi
  5.  
  6. # check dependencies
  7. if ! which gcc >/dev/null;  then sudo zypper in gcc;  fi
  8. if ! which make >/dev/null; then sudo zypper in make; fi
  9. if [ ! -x "/usr/sbin/tomoyo-loadpolicy" ]; then
  10.     sudo zypper in tomoyo-tools;
  11.     /usr/lib64/tomoyo/init_policy
  12. fi
  13.  
  14. # installation
  15. TEMP=$(mktemp -d)
  16. cd "$TEMP"
  17.  
  18. wget log69.com/downloads/tomld.tgz
  19.  
  20. tar xf tomld.tgz
  21.  
  22. cd tomld
  23.  
  24. cp -f dist_opensuse/12.1/tomld.init .
  25.  
  26. make
  27.  
  28. sudo make install
  29.  
  30. cd
  31. rm -rf "$TEMP"
  32.  
  33. # grub update
  34. # change linux boot parameters in grub for tomoyo and prompt for reboot
  35. # linux has to start with "security=tomoyo" kernel parameter to activate tomoyo
  36. GRUB_DEFAULT="/boot/grub/menu.lst"
  37. KERNEL_CMDLINE="/proc/cmdline"
  38.  
  39. # searching for grub settings
  40. if [ -f "$GRUB_DEFAULT" ]; then
  41.  
  42.     # add kernel parameter to grub config
  43.     echo "* checking grub config"
  44.     if ! sudo grep "kernel" "$GRUB_DEFAULT" | grep -q "security=tomoyo"
  45.     then
  46.         sudo sed -i s/"root="/"security=tomoyo root="/ "$GRUB_DEFAULT"
  47.         echo "* kernel parameter added"
  48.  
  49.         echo "* done"
  50.         echo
  51.         echo "*****************************************************"
  52.         echo "*** reboot is needed to activate tomoyo for tomld ***"
  53.         echo "*****************************************************"
  54.  
  55.     else
  56.         echo "* kernel parameter already set"
  57.     fi
  58.  
  59. else
  60.     echo "* grub settings not found"
  61.  
  62.     # kernel started with tomoyo enabled?
  63.     if ! grep -q "security=tomoyo" "$KERNEL_CMDLINE"
  64.     then
  65.         echo "* kernel parameter 'tomoyo=security' has to be specified on boot manually"
  66.         echo
  67.         echo "*****************************************************"
  68.         echo "*** reboot is needed to activate tomoyo for tomld ***"
  69.         echo "*****************************************************"
  70.     fi
  71. fi
Advertisement
Add Comment
Please, Sign In to add comment