#!/bin/bash # Written by Nick Boldt, codeslave@ca.ibm.com, in a two-day fit of pique at not having an easily reproducable setup script for Notes 7 # $Id: Notes7.setup.sh.txt,v 1.1 2006-11-18 10:31:42 nickb Exp $ function fixperms () { chown -R $USERNAME:workplace $1; chmod -R +w $1; } # verify running as root if [ $UID -ne 0 ]; then # root echo "You must be root to run this script. Please sudo or su first."; exit 1; fi echo ""; echo "Setting up Lotus Notes 7 for ubuntu-based distro. If you encounter problems, see:"; echo " https://ltc.linux.ibm.com/wiki/LotusWorkPlace"; echo " https://ltc.linux.ibm.com/wiki/LinuxDesktop/NotesEmail"; echo " https://ltc.linux.ibm.com/wiki/LotusWorkPlaceDistroPackages"; # prompt user for their /home/USERNAME value echo ""; echo -n "Install Notes 7 for what user, as in /home/\$USERNAME/ ? "; read USERNAME; # scrub any old install lefovers or cache/tmp files echo ""; echo "Scrub any old install leftovers, cache/tmp files ..."; rm -rf /home/$USERNAME/IBM/RCP/*; rm -rf /home/$USERNAME/RCPMLCache; rm -rf /home/$USERNAME/workplace-tmp; # verify dependencies installed echo ""; echo -n "Install dependent packages [Y/n] ? "; read yn; if [ "$yn" = "" ] || [ "$yn" = "y" ] || [ "$yn" = "Y" ]; then echo ""; echo "Install rpm python2.4-glade2 python2.4-gtk2 libstdc++6 libgnomeprint2.2-0 libgnomeprintui2.2-0 libmotif3 ..." apt-get install -y rpm python2.4-glade2 python2.4-gtk2 libstdc++6 libgnomeprint2.2-0 libgnomeprintui2.2-0 libmotif3 fi installedFonts=0; echo ""; echo "Do you want to install a whole bunch of fonts? This might take a while or not be required."; echo "If you agree, this script will attempt to perform the following:"; echo " apt-get install ttf-opensymbol t1-xfree86-nonfree msttcorefonts \\"; echo " xfstt xfonts-mona type1inst libxfontcache1"; echo -n "Install these packages [Y/n] ? "; read yn; if [ "$yn" = "" ] || [ "$yn" = "y" ] || [ "$yn" = "Y" ]; then apt-get install ttf-opensymbol t1-xfree86-nonfree msttcorefonts xfstt xfonts-mona type1inst libxfontcache1 installedFonts=1; fi echo ""; echo -n "(Re)install fonts from debs from folder ./debs/ [Y/n] ? "; read yn; if [ "$yn" = "" ] || [ "$yn" = "y" ] || [ "$yn" = "Y" ]; then deblist=$(find ./debs/ -maxdepth 1 -type f -name "*.deb"); debcount=$(echo "$deblist" | grep -c "deb"); if [ $debcount -eq 0 ]; then echo ""; echo "WARNING!"; echo "No .debs found in folder ./debs/!"; echo "You will likely have to install additional fonts when this installer is done."; echo ""; else i=0; for f in $deblist; do (( i++ )); echo "[$i/$debcount] Installing $f ... "; dpkg -i $f; done fi fi libXm=`find /usr/lib -name "libXm.so.3"`; if [ "x$libXm" = "x" ]; then echo ""; echo "ERROR!"; echo "Cannot find /usr/lib/libXm.so.3. Please use 'apt-cache search motif' to find"; echo "the right package, install it with 'apt-get install ', then if"; echo "necessary, symlink the installed libXm.so.3 from its installed location to"; echo "/usr/lib/libXm.so.3: 'cd /usr/lib; ln -s /path/to/libXm.so.3'"; exit 1; fi echo ""; echo -n "Install RPMs from folder ./rpms/ [Y/n] ? "; read yn; if [ "$yn" = "" ] || [ "$yn" = "y" ] || [ "$yn" = "Y" ]; then rpmlist=$(find ./rpms/ -maxdepth 1 -type f -name "*.rpm"); rpmcount=$(echo "$rpmlist" | grep -c "rpm"); if [ $rpmcount -eq 0 ]; then echo ""; echo "ERROR!"; echo "No RPMs found in folder ./rpms/!"; exit 1; fi echo ""; echo "Setting up rpm:"; mkdir -p /var/lib/rpm rpmdb --initdb echo ""; echo -n "Remove existing RPMs first [y/N] ? "; read yn; if [ "$yn" = "y" ] || [ "$yn" = "Y" ]; then i=0; for f in $rpmlist; do (( i++ )); rpmpack=$f; rpmpack=${rpmpack/.\/rpms\//}; rpmpack=${rpmpack/.noarch.rpm/}; rpmpack=${rpmpack/.i386.rpm/}; echo "[$i/$rpmcount] Removing $rpmpack ... "; rpm -ev --nodeps $rpmpack done fi i=0; for f in $rpmlist; do (( i++ )); echo "[$i/$rpmcount] Installing $f ... "; rpm -Uvh --nodeps --allfiles --replacefiles $f; done fi echo ""; echo "** RPMs (re)installed. Check errors above and restart this script if necessary. **"; echo ""; echo "NOTE: If you encountered an error installing RPMs in the wrong order, please run"; echo "this script again until all RPMs are installed properly, or install them manually"; echo "using 'rpm -Uvh --nodeps filename.rpm'"; echo ""; echo "Fix /etc/ld.so.conf, then run ldconfig ..."; # check /etc/ld.so.conf using grep; if not found, append into file # need at least: /opt/IBM/notesplugin/bin/ and /usr/X11R6/lib/ for f in /opt/IBM/notesplugin/bin/ /usr/X11R6/lib/; do cnt=$(grep -c $f /etc/ld.so.conf); if [ $cnt -eq 0 ]; then echo $f >> /etc/ld.so.conf fi done ldconfig # fix /opt/IBM/notesplugin/notes.ini using USERNAME # change: __HOME_DIR/notesplugin/notesdata # to: /home/USERNAME/notesplugin/notesdata if [ ! -f /opt/IBM/notesplugin/notes.ini ]; then echo ""; echo "ERROR!"; echo "File /opt/IBM/notesplugin/notes.ini does not exist. Please reinstall missing RPMs to continue."; exit 1; fi echo ""; echo "Fix /opt/IBM/notesplugin/notes.ini ..."; cnt=$(grep -c "__HOME_DIR/notesplugin/notesdata" /opt/IBM/notesplugin/notes.ini); tmp=$(mktemp); if [ $cnt -eq 0 ]; then echo "Directory=/home/$USERNAME/notesplugin/notesdata" > $tmp; cat /opt/IBM/notesplugin/notes.ini >> $tmp; mv $tmp /opt/IBM/notesplugin/notes.ini; else cat /opt/IBM/notesplugin/notes.ini | sed -e "s/__HOME_DIR/\/home\/$USERNAME/g" > $tmp; mv $tmp /opt/IBM/notesplugin/notes.ini; fi fixperms /opt/IBM/notesplugin/notes.ini; # fix /opt/IBM/notesplugin/richclient.sh so path is resolved correctly rcscript="/opt/IBM/notesplugin/richclient.sh"; if [ $(grep -c "# Added by Notes 7 installer" $rcscript) -eq 0 ]; then # not already done, so we can add this tmp=$(mktemp); echo ""; echo "Fix \$PATH in $rcscript ..."; echo "#!/bin/bash" >> $tmp; echo "" >> $tmp; echo "# Added by Notes 7 installer" >> $tmp; echo "if [ \$(echo \$PATH | grep -c '/opt/IBM/notesplugin') -eq 0 ]; then export PATH=\$PATH:/opt/IBM/notesplugin; fi" >> $tmp; cat $rcscript | sed -e 's/#!\/bin\/bash//g' >> $tmp; mv $tmp $rcscript; fixperms $rcscript; chmod +x $rcscript; fi # add /opt/IBM/notesplugin into $PATH # tweak either /etc/bashrc or /home/$HOMEUSER/.bashrc (or both) goodpath=$(echo $PATH | grep -c "/opt/IBM/notesplugin"); if [ $goodpath -eq 0 ]; then echo ""; echo "The directory '/opt/IBM/notesplugin' should be added to your \$PATH."; echo "You can update /etc/bashrc, /home/$USERNAME/.bashrc, or both."; for f in /etc/bashrc /home/$USERNAME/.bashrc; do if [ $(grep -c '/opt/IBM/notesplugin' $f) -eq 0 ]; then # not already done, so we can add this echo -n "Edit $f [Y/n] ? "; read yn; if [ "$yn" = "" ] || [ "$yn" = "y" ] || [ "$yn" = "Y" ]; then echo "" >> $f; echo "# Added by Notes 7 installer" >> $f; echo "if [ \$(echo \$PATH | grep -c '/opt/IBM/notesplugin') -eq 0 ]; then export PATH=\$PATH:/opt/IBM/notesplugin; fi" >> $f; fi fi done echo "Changes to your \$PATH will not take effect in your current session."; echo "You must start a new terminal or process for this to work."; fi ## MIGHT NOT NEED THIS IF USING FF or Konq as default browser instead of Mozilla ## # fix /etc/gre.conf so it contains WMC's version of Mozilla # [1.6] # GRE_PATH=/usr/ibm/wmc/mozilla echo ""; echo -n "Do you plan to use Mozilla (not Firefox) as the default browser for Notes [y/N] ? "; read yn; if [ "$yn" = "y" ] || [ "$yn" = "Y" ]; then if [ ! -f /etc/gre.conf ]; then echo ""; echo "ERROR!" echo "File /etc/gre.conf does not exist. Please install its package to continue."; exit 1; fi cnt=$(grep -c "[1.6]" /etc/gre.conf); if [ $cnt -eq 0 ]; then echo "[1.6]" >> /etc/gre.conf; echo "GRE_PATH=/usr/ibm/wmc/mozilla" >> /etc/gre.conf; else cnt=$(grep -c "GRE_PATH=/usr/ibm/wmc/mozilla" /etc/gre.conf); if [ $cnt -eq 0 ]; then echo ""; echo "ERROR!"; echo "File /etc/gre.conf must be edited by hand. Please ensure the following two lines are included."; echo "Replace existing GRE_PATH= entry if necessary."; echo " [1.6]"; echo " GRE_PATH=/usr/ibm/wmc/mozilla"; exit 1; fi fi fi # prompt user for path to their config files: # copy user.id, user.nsf, bookmark.nsf, names.nsf to /home/user/notesplugin/notesdata/ echo ""; echo -n "Copy data files (user.id, user.nsf, bookmark.nsf, names.nsf) to /home/$USERNAME/notesplugin/notesdata/ [y/N] ? "; read yn; if [ "$yn" != "" ] && [ "$yn" != "n" ] && [ "$yn" != "N" ]; then mkdir -p /home/$USERNAME/notesplugin/notesdata/; for f in user.id user.nsf bookmark.nsf names.nsf; do echo -n "Enter /path/to/your/$f [Enter to skip] ? "; read path; if [ "x$path" != "x" ]; then cp $path /home/$USERNAME/notesplugin/notesdata/; fi done fixperms /home/$USERNAME/notesplugin/notesdata; fi # copy prefab .desktop shortcuts to user's Desktop echo ""; echo -n "Create .desktop shortcuts in /home/$USERNAME/Desktop [Y/n] ? "; read yn; if [ "$yn" = "" ] || [ "$yn" = "y" ] || [ "$yn" = "Y" ]; then mkdir -p /home/$USERNAME/Desktop cp -f ./shortcuts/*.desktop /home/$USERNAME/Desktop fixperms /home/$USERNAME/Desktop fi # echo details on starting Notes 7 echo ""; echo "** Notes 7 installed OK! **"; echo ""; echo "To run Notes 7, exit back to your normal login (eg., as $USERNAME)."; echo "Then, enter:"; echo " /opt/IBM/notesplugin/richclient.sh"; echo " - or -"; echo " ibm-workplace"; echo ""; echo "If you copied the desktop shortcuts, you'll have: " echo " Notes 7 (/opt/IBM/notesplugin/richclient.sh) "; echo " Zap Notes 7 (/usr/bin/ibm-workplace-zap)"; echo ""; echo "NOTE: running the first time may take a very long time. Be patient. "; echo "If anything goes wrong (missing packages or .so files), you can check "; echo "the error log. If you see anything listed, here:"; echo " ~/workplace-tmp/iwp-log-$USERNAME.txt"; echo ""; echo "If something went REALLY wrong, delete files from /opt/IBM or /opt/ibm,"; echo "then re-run this script, making sure to UNINSTALL the RPMs when asked."; if [ $installedFonts -eq 0 ]; then echo ""; echo "If you find that Notes is using ugly or badly sized fonts, you can configure"; echo "the Notes itself, or install new fonts. To search for font packages, use:"; echo " 'apt-cache search fonts', then 'apt-get install '"; echo "Though it might be overkill, the following packages have proven to work:" echo " ttf-opensymbol t1-xfree86-nonfree msttcorefonts"; echo " xfstt xfonts-mona type1inst libxfontcache1"; fi echo ""; echo "For additional issues or support for other distros, see:"; echo " https://ltc.linux.ibm.com/wiki/LotusWorkPlace"; echo " https://ltc.linux.ibm.com/wiki/LinuxDesktop/NotesEmail"; echo " https://ltc.linux.ibm.com/wiki/LotusWorkPlaceDistroPackages"; exit 0;