1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251
|
#!/bin/bash
TESTFILE="testfile.ns.$$"
def_PKGS="netscape-java communicator-base communicator-nethelp communicator-spellchk"
def_ARCH=i386
TAR_OPTIONS=""
if [ ! -d tmp ];then
rm -rf tmp
mkdir tmp
fi
# exit 1 = bad parameter
# exit 2 = missing parameter
#
# Process any arguments. Let users see verbose output from tar (does
# anyone even care?), and (for _some_ versions of tar) override the file
# ownership when installing as root, if they wish.
#
PKGS=''
TARGET=''
ARCH=''
VER=''
verbose=0
no_exec_log=n
exe=`basename $0`
while test $# -ne 0
do
case $1 in
-O) TAR_OPTIONS="${TAR_OPTIONS}o" verbose=1;;
-V) TAR_OPTIONS="${TAR_OPTIONS}v";;
-v) shift ; VER="$1";;
-t) shift ; TARGET="$1";;
-a) shift ; ARCH="$1";;
-p) shift
case $1 in
communicator-base|communicator-[sd]motif|communicator-nethelp|communicator|\
navigator-base |navigator-[sd]motif |navigator-nethelp |navigator |\
communicator-spellchk|\
netscape-java|netscape-base|vreg|movemail) PKGS="${PKGS} $1";;
all) PKGS="java communicator-base netscape-base communicator-nethelp communicator-spellchk";;
*) echo "Unknown package: $1!" && exit 1 ;;
esac;;
*) ;;
esac
shift
done
exec 3>&1 4>&2
[ -z "$TARGET" ] && echo "Please supply a -t <target directory>" && exit 2
[ -z "$PKGS" ] && PKGS="$def_PKGS"
[ -z "$VER" ] && echo "Please supply a -v <version>" && exit 2
[ -z "$ARCH" ] && ARCH=$def_ARCH
ARCHf=${ARCH}_
[ ! -d $TARGET ] && install -d $TARGET
pushd $TARGET >/dev/null
tdir=`pwd -P`
popd >/dev/null
cdir=`pwd -P`
[ $tdir = $cdir ] && echo "Can't install to current directory!" && exit 1
id1=0
id2=0
exec 4>&2 3>&1
function sig_int(){
echo exiting
[ $id2 -gt 0 ] && kill $id2
sleep 2
[ $id1 -gt 0 ] && kill $id1
exit
}
function idle(){
echo -n "."
while :;do
sleep 1
echo -n "."
done
}
function start_it(){
exec 1> /dev/null 2>/dev/null
idle 1>&3 & id1=$!
eval "$@"
/bin/kill -9 $id1
exec 1>&3 2>&4
id1=0
}
function pkg_2_file(){
[ -z "$1" ] && return
local f
f=
echo -n src/
case $1 in
*-nethelp|*-spellchk)
b1=$(echo $1 | cut -d - -f 1)
b2=$(echo $1 | cut -d - -f 2)
f="$VER/$ARCH/$b1/$b2-v$VER.nif";;
communicator*|navigator*)
b=$(echo $1 | cut -d - -f 1)
f="$VER/$ARCH/$b/netscape-v$VER.nif";;
netscape-base|netscape-java)
f="$VER/$ARCH/navigator/netscape-v$VER.nif";;
movemail) f="$VER/$ARCH/communicator/communicator-v$VER.nif";;
vreg) f="$VER/$ARCH/vreg";;
esac
echo $f
}
function pkg_2_filelist(){
[ -z "$1" ] && return
local q
rm -f filelist filelist.ex
case $1 in
communicator|navigator|\
communicator-nethelp|communicator-spellchk|\
navigator-nethelp) return;;
netscape-base)
echo -e "netscape" >> filelist.ex
echo -e "netscape-dynMotif" >> filelist.ex
echo -e "vreg" >> filelist.ex
echo -e "movemail" >> filelist.ex
echo -e "movemail-src/*" >> filelist.ex
echo -e "README" >> filelist.ex
echo -e "talkback/master.ini" >> filelist.ex
echo -e "java/*" >> filelist.ex
echo -e "libjsd.so" >> filelist.ex;;
communicator-base|navigator-base)
echo -e "README" >> filelist
echo -e "talkback/master.ini" >> filelist
[ $1 = navigator-base ] &&
echo -e "libjsd.so" >> filelist
;;
movemail)
echo -e "movemail" >> filelist
echo -e "movemail-src/*" >> filelist;;
communicator-smotif|navigator-smotif)
echo -e "netscape" >> filelist;;
communicator-dmotif|navigator-dmotif)
echo -e "netscape-dynMotif" >> filelist;;
netscape-java)
echo -e "java/*" >> filelist;;
esac
q=`pwd -P`
[ -e filelist ] && echo "-T $q/filelist"
[ -e filelist.ex ] && echo "-X $q/filelist.ex"
}
function pkg_2_mvlist(){
[ -z "$1" ] && return
case $1 in
communicator-nethelp|communicator-spellchk|\
vreg|navigator-nethelp|movemail|\
communicator-base|navigator-base) return;;
communicator|navigator)
echo "mv -f netscape $1-smotif;"
[ $ARCH != powerpc ] && echo "mv -f netscape-dynMotif $1-dmotif;";;
communicator-smotif|navigator-smotif)
echo "mv -f netscape ${1/-smotif/}-smotif;";;
communicator-dmotif|navigator-dmotif)
echo "mv -f netscape-dynMotif ${1/-dmotif/}-dmotif;";;
netscape-java)
echo "rm -rf java/classes/{aix,hpux,irix};"
;;
esac
}
set -m
trap "got_child=1" 17
trap "sig_int" 15 2 3
function install_msg() {
a1="($VER)"
a2="($VER[$ARCH])"
case $1 in
communicator) msg="Communicator $a2";;
communicator-base) msg="Communicator base $a2";;
communicator-dmotif) msg="Communicator dynamic binary $a2";;
communicator-nethelp) msg="Communicator Documentation $a1";;
communicator-smotif) msg="Communicator static binary $a2";;
communicator-spellchk) msg="Communicator Spell Checking Dictionary $a1";;
navigator) msg="Navigator $a2";;
navigator-base) msg="Navigator base $a2";;
navigator-dmotif) msg="Navigator dynamic binary $a2";;
navigator-nethelp) msg="Navigator Documentation $a1";;
navigator-smotif) msg="Navigator static binary $a2";;
vreg) msg="Software Update Daemon $a2";;
movemail) msg="Mail locking software $a1";;
netscape-java) msg="Netscape Java $a1";;
netscape-base) msg="Netscape base $a2";;
esac
echo -n "Installing $msg "
}
function fix_files() {
#ELF 32-bit MSB shared object, PowerPC or cisco 4500, version 1, stripped
#ELF 32-bit MSB executable, PowerPC or cisco 4500, version 1, dynamically linked, not stripped
#ELF 32-bit LSB shared object, Intel 80386, version 1, not stripped
#ELF 32-bit LSB executable, Intel 80386, version 1, dynamically linked, stripped
[ $ARCH != powerpc ] && return
tag='ELF 32-bit.*(shared object|executable).*'
files="$(for fi in $(find $TARGET -type f);do
[ "$(file $fi | egrep "$TAG" )" ] && echo $fi
done)"
chmod 755 $files
fix961212 $files
}
function install_nif(){
# $1 = <pkg>.nif
# $2 = <target-dir>
local file
pk=$1
install_msg $pk $VER $ARCH
[ $pk = netscape-java ] && install_jar
file=`pkg_2_file $pk`
[ ! -e "$file" ] && echo "$file doesn't exist!" && exit 3
start_it "gzip -dc $file | (cd $2; tar -x `pkg_2_filelist $pk` -${TAR_OPTIONS}f -)"
q=`pkg_2_mvlist $pk`
[ -n "$q" ] && ( cd $2; eval $q )
fix_files
echo " done."
}
function install_jar(){
jd="java/classes"
[ ! -d $TARGET/$jd ] && mkdir -p $TARGET/$jd
start_it "(cd src/$VER;tar -cf - *.jar) | (cd $TARGET/$jd; tar -xf -)"
}
[ -f $TARGET ] && echo "Target is a file!" && exit 3
[ ! -e $TARGET ] && install -d $TARGET
if [ $ARCH = powerpc ];then
PKGS="`echo $PKGS|tr ' ' '\n'|grep -v dmotif|sort|uniq`"
else
PKGS="`echo $PKGS|tr ' ' '\n'|sort|uniq`"
fi
for i in $PKGS;do
install_nif $i $TARGET
done
rm -f filelist filelist.ex
rm -rf tmp
exit 0
|