#!/bin/sh # # PostInstall [devel] by Hans Eric Sandstrom (hes@xinit.se) # # The general idea is to run this script directly after a minimal # installation. And then run it regularly when packages changes. # # This script: # 1. Removes bloat that is installed even if you choose minimal configuration. # 2. Installs your configured choice of packages using apt-get. # 3. Deactivates unwanted but installed services. # # Currently I use two different configurations on my machines, hence # the reason for a [devel] switch to this script. # TODO: Check that all packages that is installed with the devel # configuration is also removed when this script is executed later # without the devel switch. # # With modifications this script probably works on other distributions # but please browse thru it first so you understand what it does. # # Note: RedHat8.0 rpm has a very evil tendency to hang. # If this script hangs on rpm, this is probably the problem. # To fix this, kill all rpm processes (you'll probably have to use kill -9). # Then do: cd /var/lib/rpm; rm __db*; rpm --rebuilddb. I don't know # wether the script works for RedHat8 anymore since all my machines has # been updated and I keep no apt repository for RedHat8. /hes20040208 # # If you build your own packages you have to create a an apt-repository # for them and configure that repository into the sources.list file. # Remember to put your own sources.list file in $SRCDIR/etc. # # Configure here SRCDIR=/home/mailcore ARCH=`uname -i` # Catch 22, apt has to be present on a pristine machine # Configure the path to your apt rpm here: APTRPM=$SRCDIR/RPMS/$ARCH/apt-0.5.5cnc7-1.fr.$ARCH.rpm # Put all installed services to be deactivated here STOPSERVICES="rawdevices gpm" # Put all installed services to be activated here STARTSERVICES="named" # Put all "bloat" rpms to be removed here. Some rpms are not installed # on fedora and may later be removed from this list: # gd gd-devel gnome-list imlib lilo lokkit mouseconfig ORbit # redhat-config-mouse redhat-config-network-tui # Suggestion: Drop vi and keep nano instead (save 7Mb) RPMRM="\ apmd\ aspell\ aspell-en\ attr\ autofs\ comps\ dump\ gd\ gd-devel\ gnome-libs\ gnupg\ hotplug\ imlib\ isdn4k-utils\ jfsutils\ kernel-pcmcia-cs\ kudzu\ lftp\ libwvstreams\ lilo\ lokkit\ lrzsz\ minicom\ mouseconfig\ nano\ ORbit\ parted\ pcmcia-cs\ rdate\ redhat-config-mouse\ redhat-config-network-tui\ system-config-mouse\ system-config-network-tui\ setserial\ sendmail\ specspo\ star\ statserial\ tcsh\ up2date\ usbutils\ vconfig\ wireless-tools\ wget\ wvdial\ yp-tools\ ypbind\ yum\ " # Put all required rpms to install/update here: RPMREQ="\ apt\ caching-nameserver\ httpd\ lm_sensors\ MySQL-client\ MySQL-server\ bind\ net-snmp-devel\ nfs-utils\ ntp\ openldap\ openldap-clients\ openldap-servers\ perl-Net-DNS\ perl-Time-HiRes\ perl-HTML-Parser\ php\ postfix\ proftpd\ spamassassin\ sysstat\ " # Optional packages needed for a development node RPMOPT="\ apr-devel\ apr-util-devel\ autoconf\ automake\ bison\ bzip2-devel\ cpp\ cyrus-sasl-devel\ db4-devel\ expat-devel\ flex\ gcc\ gcc-c++\ gdbm-devel\ httpd-devel\ irda-utils\ krb5-devel\ libtool\ libxml2-devel\ MySQL-devel\ ncurses-devel\ openssl-devel\ openldap-devel\ pam-devel\ patch\ pcre-devel\ pkgconfig\ openldap-devel\ rpm-build\ strace\ zlib-devel\ " # Is this a development or a normal node? if [ "$1" == "devel" ]; then echo "Installing a development node" RPMREQ="$RPMREQ $RPMOPT" else RPMRM="$RPMRM $RPMOPT" fi # Remove unwanted rpms for pkg in $RPMRM; do rpm --quiet -q $pkg && RPRM="$RPRM $pkg"; done if [ "$RPRM" != "" ]; then echo "Removing: $RPRM" rpm --quiet -e $RPRM fi # Install apt if not alredy installed rpm --quiet -q apt || rpm -U $APTRPM # Configure apt if we have our own config of apt. if [ -f $SRCDIR/etc/sources.list ]; then diff -q /etc/apt/sources.list $SRCDIR/etc/sources.list if [ $? -ne 0 ]; then echo "Configuring /etc/apt/sources.list" if [ ! -f /etc/apt/sources.list.rpmorig ]; then cp -p /etc/apt/sources.list /etc/apt/sources.list.rpmorig fi cp -p $SRCDIR/etc/sources.list /etc/apt fi fi # Install/Upgrade all packages apt-get -qq update apt-get -qq dist-upgrade apt-get install $RPMREQ # Stop and deactivate services for s in $STOPSERVICES; do service $s status >/dev/null && service $s stop chkconfig $s off done # Activate and start services for s in $STARTSERVICES; do chkconfig $s on service $s status >/dev/null || service $s start done