Newer
Older
Digital_Repository / OARiNZ / DIY / LiveCD / Makefile.chroot
  1. #!/usr/bin/make -f
  2.  
  3.  
  4. SHELL=/bin/sh
  5.  
  6.  
  7. # Directories.
  8. APT_CACHE=/var/cache/apt/archives
  9.  
  10.  
  11. # Commands.
  12. APTGET=/usr/bin/apt-get -q
  13. APTGET_REM=$(APTGET) remove --purge --assume-yes
  14. APTGET_INS=$(APTGET) install --assume-yes
  15. DPKG=/usr/bin/dpkg
  16. SED=/bin/sed -i -e
  17.  
  18.  
  19. # Packages to be removed using apt-get. Note that some additional
  20. # dependent packages will be automatically removed as well.
  21. REM_MISC=diveintopython gaim gaim-data \
  22. screensaver-default-images sound-juicer totem-gstreamer \
  23. totem-mozilla totem rhythmbox linux-headers-2.6.17-10 \
  24. linux-headers-2.6.17-10-generic linux-headers-generic \
  25. xsane-common example-content
  26.  
  27. REM_GNOME=gnome-games gnome-games-data gnome2-user-guide
  28.  
  29. REM_OPENOFFICE=openoffice.org openoffice.org-base openoffice.org-calc \
  30. openoffice.org-common openoffice.org-core openoffice.org-draw \
  31. openoffice.org-evolution openoffice.org-gnome openoffice.org-gtk \
  32. openoffice.org-help-en-us openoffice.org-impress \
  33. openoffice.org-java-common openoffice.org-l10n-common \
  34. openoffice.org-l10n-en-gb openoffice.org-l10n-en-za \
  35. openoffice.org-math openoffice.org-style-default \
  36. openoffice.org-style-industrial openoffice.org-thesaurus-en-us \
  37. openoffice.org-writer python-uno
  38.  
  39. REM_EVOLUTION=evolution evolution-data-server evolution-data-server-common \
  40. evolution-exchange evolution-plugins evolution-webcal nautilus-sendto
  41.  
  42. REM_GIMP=gimp gimp-data gimp-print gimp-python libgimp2.0
  43.  
  44.  
  45. # Packages to be added using apt-get. Some may already be installed,
  46. # but that's OK, it won't hurt. It's safer than assuming they're there
  47. # and getting it wrong! These will most likely install some other
  48. # dependent packages as well.
  49. ADD_EPRINTS=apache2 mysql-server perl libapache2-mod-perl2 \
  50. libunicode-string-perl libdbi-perl libdbd-mysql-perl \
  51. libxml-parser-perl wget tar gzip unzip poppler-utils wv lynx \
  52. tetex-bin imagemagick adduser findutils sendmail
  53.  
  54. ADD_WEBMIN=bash perl libnet-ssleay-perl openssl libauthen-pam-perl \
  55. libpam-runtime libio-pty-perl libmd5-perl
  56.  
  57. ADD_ECONFIG=perl libxml-dom-perl libppi-perl libstring-random-perl \
  58. libexpect-perl libunicode-string-perl libhtml-parser-perl \
  59. libmail-rfc822-address-perl libjson-perl
  60.  
  61. ADD_MISC=#openssh-server
  62.  
  63.  
  64. # Local packages to be installed using dpkg.
  65. DEB_EPRINTS=$(APT_CACHE)/eprints_3.0-0ubuntu2_all.deb
  66.  
  67. DEB_WEBMIN=$(APT_CACHE)/webmin-oarinz_1.340-0ubuntu1_all.deb
  68.  
  69. DEB_CONFIG=$(APT_CACHE)/oarinz-eprints-config_0.0.1-2_all.deb
  70.  
  71. DEB_MODULE=$(APT_CACHE)/webmin-eprints_0.0.1-1_all.deb
  72.  
  73.  
  74.  
  75. .PHONY: all add remove dpkg-add
  76.  
  77.  
  78. all: remove add dpkg-add cleanup
  79.  
  80.  
  81. remove:
  82. @echo
  83. @echo "=== Removing unnecessary packages."
  84. $(APTGET_REM) $(REM_OPENOFFICE)
  85. @rm -rf /etc/openoffice
  86. $(APTGET_REM) $(REM_EVOLUTION)
  87. $(APTGET_REM) $(REM_GIMP)
  88. $(APTGET_REM) $(REM_GNOME)
  89. $(APTGET_REM) $(REM_MISC)
  90.  
  91. add:
  92. @echo
  93. @echo "=== Adding prerequisite packages."
  94. @# Normally you'd just apt-get update here, but I've been having
  95. @# problems with the servers. Since it takes so long to get
  96. @# back to this point in the process, I've cheated and pre-generated
  97. @# the cache index files. They are copied in before this Makefile
  98. @# is called.
  99. @#$(APTGET) update
  100. $(APTGET_INS) $(ADD_EPRINTS)
  101. $(APTGET_INS) $(ADD_WEBMIN)
  102. $(APTGET_INS) $(ADD_ECONFIG)
  103. # $(APTGET_INS) $(ADD_MISC)
  104.  
  105.  
  106. dpkg-add:
  107. @echo
  108. @echo "=== Adding EPrints packages."
  109. @# In order: eprints, webmin, oarinz-eprints-config, webmin-eprints
  110. $(DPKG) -i $(DEB_EPRINTS)
  111. $(DPKG) -i $(DEB_WEBMIN)
  112. $(DPKG) -i $(DEB_CONFIG)
  113. $(DPKG) -i $(DEB_MODULE)
  114. @# Patch the webmin module to fix the permissions problem
  115. @# (TEMPORARY HACK UNTIL A PERMANENT UPDATE ARRIVES).
  116. @$(SED) '61i system("chown -R eprints:eprints /opt/eprints3/archives/" . $$in{archive}); \ ' \
  117. /usr/share/webmin/eprints/create.cgi
  118.  
  119.  
  120. cleanup:
  121. @echo
  122. @echo "=== Cleaning up."
  123. $(APTGET) clean
  124. $(APTGET) autoclean
  125. $(SED) 's/NO_START=1/NO_START=0/' /etc/default/apache2
  126. $(SED) 's/root@ou075136/root@localhost/' /etc/mail/submit.cf \
  127. /etc/cron.d/sendmail