Fedora Remix maintained by the Rochester Institute of Technology (RIT) Linux Users Group, targeted at users new to Linux and RIT students, faculty, and staff
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.

63 lines
1.1 KiB

  1. #!/bin/bash
  2. # MIT Alloy installer script for TigerOS
  3. # author: Aidan Kahrs <axk4545@rit.edu>
  4. DEPS=java-1.8.0-openjdk
  5. PROG=Alloy
  6. FILE=/usr/share/java/alloy.jar
  7. FILE_URL=http://alloy.mit.edu/alloy/downloads/alloy4.2.jar
  8. LINK=/usr/local/bin/alloy
  9. # Check that the current user is root
  10. if [ $EUID != 0 ]
  11. then
  12. echo "Please run this script as root (sudo $@$0)."
  13. exit
  14. fi
  15. # Check if remove flag was passed
  16. if [ ! -z "$1" ] && [ "$1" = "--remove" ]
  17. then
  18. rm $LINK
  19. rm /usr/local/share/applications/$PROG.desktop
  20. rm $FILE
  21. rm /usr/local/share/icons/$PROG.jpg
  22. else
  23. # Install dependencies
  24. dnf install $DEPS -y
  25. # Get the files
  26. curl -o $FILE $FILE_URL
  27. # Make a link
  28. cat > $LINK <<EOF
  29. #!/bin/sh
  30. cd \$HOME
  31. java -jar $FILE
  32. EOF
  33. chmod +x $LINK
  34. chmod +x $FILE
  35. # Make a desktop file
  36. cat > /usr/local/share/applications/$PROG.desktop <<EOF
  37. [Desktop Entry]
  38. Type=Application
  39. Version=7.0
  40. Name=$PROG
  41. Comment=Experiment with formal languages topics
  42. Path=
  43. Exec=$LINK
  44. Icon=/usr/local/share/icons/$PROG.jpg
  45. Terminal=false
  46. Categories=Education;Languages;Java;
  47. EOF
  48. # Get the icons
  49. mkdir -p /usr/local/share/icons
  50. unzip -j "$FILE" "images/logo.gif" -d "alloy.gif"