#!/bin/bash # Perform the following operations on the installation dir # * Fix sym links to be relative # * Remove language catalogs that the user does not need # (Note: A black-list is used instead of a white-list) # * Remove dirs and files that are requested by the user # * For non-standard builds, delete useless documentation # * Remove empty dirs cleanInstallDir() { # Make all symlinks relative and remove dangling ones # Note: We need to run this twice since the first run sometimes does not do a complete job symlinks -cdrs $INSTALL_DIR >/dev/null 2>/dev/null symlinks -cdrs $INSTALL_DIR >/dev/null 2>/dev/null # Remove languages requested by user for L in $(cat $TT_ETC_DIR/removeLangs 2>/dev/null) do rm -rf $INSTALL_DIR/usr/share/locale/$L rm -rf $INSTALL_DIR/usr/share/man/$L rm -rf $INSTALL_DIR/usr/lib/X11/locale/$L done # Remove directories and files requested by user for D in $(cat $TT_ETC_DIR/removeDirs 2>/dev/null) do rm -rf $INSTALL_DIR$D done for F in $(cat $TT_ETC_DIR/removeFiles 2>/dev/null) do rm -f $INSTALL_DIR$F done # Remove cat dirs find $INSTALL_DIR/usr/share/man -type d -name "cat?" 2>/dev/null | xargs rm -rf # Remove documentation for bootstrap builds if [ "$BUILD_TYPE" != "standard" ] then find $INSTALL_DIR -type d -name man 2>/dev/null | xargs rm -rf find $INSTALL_DIR -type d -name info 2>/dev/null | xargs rm -rf find $INSTALL_DIR -type d -name doc 2>/dev/null | xargs rm -rf find $INSTALL_DIR -type d -name pod 2>/dev/null | xargs rm -rf fi # Remove empty dirs find $INSTALL_DIR -type d | xargs rmdir -p 2>/dev/null }