#!/bin/bash # Shell script to install GNOME # Note to users: if you find a bug in this shell script and are able to # fix it, or if you simply want to change something, copy the script to # some writable directory and edit it. Run it, and it will ask you what # directory the CDROM is at, and then it will continue with the installation # appropriately. # default... ARCH=i386 case `arch` in *86) ARCH=i386 ;; alpha) ARCH=alpha ;; sparc) ARCH=sparc ;; esac FINDME=RPMS/$ARCH/gnome-core-0.13-1998050518.$ARCH.rpm # Get in the right directory if necessary first! if [ ! -f $FINDME ] ; then relpath=$(echo $0 | sed 's:/[^/]*$::') [ -n "$relpath" ] && cd $relpath fi until [ -f $FINDME ] ; do # Now, as long as we are in the wrong directory, keep asking... echo 'This program must run from the CDROM. Please type the name of the directory where the CDROM is mounted, or press control-C to quit: ' read dir cd $dir done # Keep things consistent... BT='Install GNOME Beta Snapshot 1998/05/05/18' DG=whiptail D () { if [ -n "$O" ] ; then $DG --fb --backtitle "$BT" "$@" 2>$O || die 1 else $DG --fb --backtitle "$BT" "$@" || die 1 fi bluescreen } YN () { $DG --fb --backtitle "$BT" --yesno "$@" ret=$? bluescreen return $ret } die () { [ -s /tmp/ai.$$.log ] && { D --msgbox 'GNOME install failed with the following error from rpm: '"$(cat /tmp/ai.$$.log)" 21 72 } if [ -x /usr/bin/tput ] ; then tput rmcup ; tput sgr0 ; clear else reset ; clear fi rm -f $O exit $1 } rpm2dialog () { awk ' function telldialog(string, percent) { printf("XXX\n %s\n%s\nXXX\n", percent, string) fflush() next } /^%f/ { sub("^%f ", "") sub(":.*$", "") packagename=$0 telldialog(sprintf("Installing the %s package...", packagename), 0) } { sub("^%%", "") sub("\\..*$", "") } /100/ { telldialog(sprintf("Configuring the %s package...", packagename), 100) } { print fflush() next }' } findrpm () { (ls -1d RPMS/$ARCH/*; ls -1d RPMS/noarch/*) | \ grep '/'"$1"'-[^-][^-]*-[^-][^-]*\.rpm' } TP= [ -x /usr/bin/tput ] && { TP=''"$(tput cup 0 0)$(tput clear)$(tput bold)$BT" } bluescreen () { echo -n $TP } O=/tmp/do.$$ touch $O || { echo "Could not touch file $O -- check permissions" >&2 die 1 } bluescreen # welcome D --msgbox 'Welcome to the GNOME desktop installation. This technology preview version, made on 5 May 1998, will allow you to play with -- and even work with -- many programs that will be a part of the GNOME desktop. The various programs have not yet been integrated into a cohesive desktop, and some pieces are simply missing. However, many programs are quite useable on their own, and we encourage you to try them out. Plenty of us use them every day. More information on the GNOME project is available at http://www.gnome.org' \ 20 72 # package list selection # First, packages that we WILL be installing... # This package set should fulfill all interdependencies. pl="gmp gnome-core gnome-guile gnome-imglib gnome-objc gnome-rh5.1-release-notes guile mico xscreensaver" # "Optional" packages -- there should be no interdependencies between # these packages D --separate-output --checklist \ 'Each of these packages is an optional part of the GNOME environment; that is, you can run other gnome components with any of these packages not installed. However, they are all quite useful and you very likely will want to install them all, so the default is to install all of them. In many categories, we list the current contents; more components may be added to each category later.' \ 20 75 8 \ gmc 'GNOME file manager with drag-and-drop' on \ gnome-admin 'Print queue and SNMP management' on \ gnome-games 'The required set of desktop games' on \ gnome-graphics 'The ElectricEyes graphics display program' on \ gnome-media 'CD player and mixer applications' on \ gnome-network 'gnome network utilities' on \ gnome-utils 'editors, time tracking, calculators' on \ bezerk 'A gnome IRC client' on pl="$pl $(cat $O)" # if gmc is selected, see if we need to upgrade to included mc if echo $pl | grep gmc >/dev/null 2>&1 ; then if rpm --test -U `findrpm mc` ; then pl="$pl mc" fi fi # Development packages? if YN 'Do you wish to install the gnome development packages?' 10 60 ; then pl="$pl gmp-devel gnome-core-devel gnome-games-devel gnome-guile-devel gnome-objc-devel guile-devel mico-devel" fi # Make list of all packages to install... plt= for package in $pl ; do plt="$plt `findrpm $package`" done pl=$plt # Promised cancel button. # Try to test for free disk space FS=$(df /usr | tail -1 | awk '{print $4}') NS=$(($(for i in $pl; do rpm -qp --qf '%{size}\n' $i; done | \ awk '{sum += $1} END {print sum}') / 1024)) if [ $FS -lt $NS ] ; then if YN 'It appears that GNOME will not fit on your /usr partition Only '$(($FS/1024))'MB are free on /usr, but the packages you have chosen to install require '$(($NS/1024+1))'MB. If you wish to start over and configure the installation differently, press return. Otherwise, uninstall other software until '$(($NS/1024+1))'MB are free on /usr and then choose "yes" to attempt to install.' 20 75 --defaultno ; then die 1 fi else if YN 'The packages you have chosen will use '$(($NS/1024+1))'MB of the '$(($FS/1024))'MB available space in the filesystem containing the /usr directory. Choose yes to install, or no to abort.' 13 75 ; then : ; else die 0 fi fi rpm --percent -U $pl 2>/tmp/ai.$$.log | \ rpm2dialog | \ D --gauge 'Please wait while RPM inspects your system...' 6 60 0 # if no error in the install if [ ! -s /tmp/ai.$$.log ] ; then D --msgbox 'The GNOME beta snapshot has been successfully installed on your system. Read the README file and docs/index.html for more information.' 14 72 else die 1 fi rm -f /tmp/ai.$$.log die 0