--- 2003-02-18-04/mozilla-linux-setup Fri Mar 14 14:59:56 2003 +++ latest/mozilla-linux-setup Fri Mar 14 15:19:36 2003 @@ -1,5 +1,5 @@ #!/bin/bash - ver="0.3.5a" + ver="0.3.5a.2003031415" copy="2002, 2003" mail="PointedEars@gmx.de" mail_feedback="bug-mozilla@PointedEars.de" @@ -36,25 +36,29 @@ mail_feedback="bug-mozilla@PointedEars.d # http://white.sakura.ne.jp/~piro/xul/doc/installation.html.en#uninstall; # - New `-I' option: Can install all apps that match the Netscape installer # quasi-standard (-f && -x $archive/$installer/$installer) - # - Fixed bug caused by "wrong" pwd when using the installer - # * Removed unused code (from /etc/rc.status) + # - Fixed bug caused by "wrong" `pwd' when using the installer + # * Removed unused code (previously imported completely from /etc/rc.status) # * Approaching POSIX conformance: Order of options does not matter any longer # * Reversed exit codes - # * Fixed function-in-statement bug on `sh' (IRIX) # * New `-R' option: Allow repair of an existing installation, removing - # cache files - # * General update of file permissions in chrome/ to prevent permission bugs - # with XUL apps (such as `mozgest') + # XUL cache file + # * Added general `chmod go+r' in chrome/ to prevent permission bugs with + # XUL apps (such as `mozgest') # * Use MozKill and isMozRunning funct's from the Mozilla Process manager (moz), - # version 0.2.2b+ by this h4> /dev/null 2>&1 ; then + if test "$TERM" != "raw" && stty size >/dev/null 2>&1 ; then esc=`echo -en "\033"` extd="${esc}[1m" warn="${esc}[1;31m" @@ -150,7 +166,7 @@ if [ -z "$lg" ]; then lg=`echo $LC_CTYPE function L { case $lg in - de) if [ -n "$2" ]; then echo "$2"; else echo "$1"; fi;; + de) echo "${2:-$1}";; *) echo "$1";; esac } @@ -805,7 +821,7 @@ Bitte überprüfen Sie ihre Mozilla-Instal } function XULisInstd { - local chk=`grep chrome/$1 $mozdir/chrome/installed-chrome.txt 2> /dev/null` + local chk="`grep chrome/$1 $mozdir/chrome/installed-chrome.txt 2> /dev/null`" if [ -n "$chk" ]; then return 0 else @@ -817,22 +833,23 @@ function XULuninst { for u in $1; do if [ -n "$u" ]; then KillMoz echo -n " $u... " - if [ `XULisInstd "$u"` -eq 0 ]; then + if XULisInstd "$u"; then rm -rf $mozdir/chrome/$u* #2> /dev/null # Removing chrome.rdf first because overlayinfo/ is NOT automagically # recreated when chrome.rdf exists; otherwise an error removing # chrome.rdf would have "killed" $Joe_User's XUL apps without a - # (plausible) explanation which could cause some ... trouble for - # this $h3LL$cr1pt h4><0R. See <1231960.iDbeOVK0A0@pointedears.de> pp. :-> + # (plausible) explanation which could cause some ... trouble for this + # $|-|3|_|_$c|21|°' |-|4><0|2. + # See <1231960.iDbeOVK0A0@pointedears.de> pp. :-> test $? -eq 0 && rm -f $mozdir/chrome/chrome.rdf #2> /dev/null test $? -eq 0 && rm -rf $mozdir/chrome/overlayinfo #2> /dev/null test $? -eq 0 && grep -v chrome/$u $mozdir/chrome/installed-chrome.txt \ - 1> $mozdir/chrome/installed-chrome.txt.new + 1> $mozdir/chrome/installed-chrome.txt.new # echo # diff -u $mozdir/chrome/installed-chrome.txt \ - # $mozdir/chrome/installed-chrome.txt.new + # $mozdir/chrome/installed-chrome.txt.new test $? -eq 0 && cp -p $mozdir/chrome/installed-chrome.txt \ $mozdir/chrome/installed-chrome.txt.bak test $? -eq 0 && mv $mozdir/chrome/installed-chrome.txt.new \ @@ -875,7 +892,6 @@ function XPInst { mozilla "file://"`pwd`"/$f" if [ $? -eq 0 ]; then msg_done - return 0 else msg_failed return 1 @@ -903,8 +919,27 @@ Installing XPIs. You need to quit Mozill fi } + function MozRepairFiles { + local result=0 + for f in $1; do + test $verbose -eq 1 && echo -n " $f... " + find $HOME/.mozilla -name "$f" -print0 2>/dev/null | xargs -0r rm -R$sVerbose + if [ $? -eq 0 ]; then + test $verbose -eq 1 && msg_done + else + test $verbose -eq 1 && msg_failed + let result++; + fi + done + test $verbose -eq 1 -a $result -gt 0 && \ + L "Failed to remove $result file(s)." \ + "$result Datei(en) konnte(n) nicht entfernt werden." >&2 + return $result + } + function MozRepair { echo " + ${extd}`L "Repair of an existing installation" \ "Reparatur einer bestehenden Installation"`${norm} " @@ -912,13 +947,14 @@ ${extd}`L "Repair of an existing install test $verbose -eq 1 && sVerbose=v echo -n `L "Repairing" "Wird repariert"`"... " test $verbose -eq 1 && echo - find $HOME/.mozilla -name XUL.mfasl -print0 | xargs -0r rm -R$sVerbose - find $HOME/.mozilla -name chrome.rdf -print0 | xargs -0r rm -R$sVerbose - find $HOME/.mozilla -name localstore.rdf -print0 | xargs -0r rm -R$sVerbose - if [ $? -eq 0 ]; then - msg_done - else - msg_failed + MozRepairFiles XUL.mfasl # chrome.rdf localstore.rdf + sVerbose= + if [ $verbose -eq 0 ]; then + if [ $? -eq 0 ]; then + msg_done + else + msg_failed + fi fi } @@ -986,8 +1022,8 @@ while [ -n "$1" ]; do -C | -c | --copy) last="c"; import=1; copy=1; let copyOptLast+=1;; -S | -s | --symlinks) last="s"; import=1; link=1; let linkOptLast+=1;; -H | -h | --hardlinks) last="h"; import=1; hard=1; let hardOptLast+=1;; - -F | -f | --flash) last="f"; flash=1; flashPluginDir=""; - flashInstPath="";; + -F | -f | --flash) last="f"; flash=1; flashPluginDir="" + flashInstPath="";; -A | -a | --apps) last="i"; inst=1;; -i | --install) last="i"; inst=1;; -u | --uninstall) last="u"; uninst=1;; @@ -1001,7 +1037,6 @@ flashInstPath="";; installer=$1 last="";; c) - echo $copyOptLast if [ -z "${copyOpt[$copyOptLast]}" ]; then copyOpt[$copyOptLast]=$1 else @@ -1196,56 +1231,95 @@ the archive." >&2 && [ -x "$target/$installer/$installer" ]; then msg_done KillMoz - echo "starting $installer..." + echo -n " + Waiting for \`$installer' to finish + (close all Mozilla windows to continue!)... " # save current working directory before changing it (fixes XPI setup bug) cwd=`pwd 2> /dev/null` cd $target/$installer/ - ./$installer + out="`./$installer 2>&1`" if [ $? -eq 0 ]; then msg_done; echo + test -n "$out" && echo " + $out + " + # check if `df' is supported + chk="`df "$target" 2>/dev/null`" + if [ $? -eq 0 ]; then + # check if -h option is supported + chk2="`df -h "$target" 2>/dev/null`" + if [ $? -eq 0 ]; then + chk="$chk2" + else + # check if --human-readable option is supported + chk2="`df --human-readable "$target" 2>/dev/null`" + test $? -eq 0 && chk="$chk2" + fi + test -n "$chk" && echo "$chk + " + fi answer="0" while [ "$answer" != "y" ] && [ "$answer" != "n" ]; do read -p "Clean up NOW ([y]es | [n]o | [i]nfo)? " -n 1 answer echo - if [ "$answer" = "y" ]; then - echo - echo -n "cleaning up... " - - # up one directory before removal (secure method) - cd .. - - rm -r $target/$installer &> /dev/null - if [ $? -eq 0 ]; then - msg_done - else - msg_failed - fi - elif [ "$answer" = "n" ]; then - echo - echo "OK. If not needed anymore, you should \`rm -r \ - $target/$installler' - to save diskspace." - elif [ "$answer" = "i" ]; then - echo " - \"Yes\" means that the setup directory extracted from the archive will be \ - removed to free disk space. - \"No\" keeps the setup files and allows you to reinstall Mozilla with \ - $target/$installer/$installer if something goes wrong. - " | $fmt - fi + case "$answer" in + y) + echo + echo -n "cleaning up... " + + # up one directory before removal (secure method) + cd .. + + out="`rm -r $target/$installer 2>&1`" + if [ $? -eq 0 ]; then + msg_done + else + msg_failed + test -n "$out" && echo " + $out + " + fi + break;; + n) + echo " + -------------------------------------------------------------------- + OK. If not needed anymore, you should + + rm -r $target/$installer + + to free disk space. + --------------------------------------------------------------------" + break;; + i) + echo " + -------------------------------------------------------------------- + \"Yes\" means that the setup directory extracted from the archive will + be removed to free disk space. + + \"No\" keeps the setup files and allows you to reinstall Mozilla with + + $target/$installer/$installer + + if something goes wrong. + -------------------------------------------------------------------- + " | $fmt + ;; + esac done # back to previous directory test -n "$cwd" && cd "$cwd" else msg_failed - echo + test -n "$out" && echo " + $out + " exit 8 fi else - echo "not found or executable bit not set + echo "${warn}not found or executable bit not set${norm} " exit 7 fi @@ -1275,5 +1349,5 @@ UpdPerm echo " - ${extd}`L "Setup complete" "Installation vollständig"`.${norm} + ${extd}`L "Setup finished" "Installation beendet"`.${norm} "