宮脇です。
山口さん、ご教授ありがとうございます。
--- Kazuo Yamaguchi <yamaguch@xxxxxxxxxxxxx> wrote:
> こんばんは。山口です。
> 示された部分は「platformを調査しtailのoptionを決定する」ではなく
> 「platformを調査し"Linux"かどうかチェックする」ですね。
> 体験版ではSolarisもサポートしている為に「Linuxなら"-n"を付ける」
> という作業をしていますが、sourcenext版ではLinuxだけ(Windows除く)
> ですので、その部分は取り払っているのでしょう。
>
> 肝心なのは、その後に続く tailコマンドを叩いているところ 若しくは
> tailコマンドをoption付きで変数に代入しているところ(その後その
> 変数を使って実際tailコマンドを実行する形になりますが、変数を使っ
> ていない可能性もあります)になります。
>
> もし宮脇様がこの件の原因を追究する気持ちをお持ちでしたら、
> head -n 189 setup > script.sh などとしてファイルに保存し、メール
> に添付して頂ければ問題の部分を見させて頂きます。
>
> # Shell Scriptはそれ程難しくもなく、なんとなくわかる部分だけでも
> # 読みながら「アタリを付けて」行くような見方もできます。
> # これからもLinuxと付き合って行くのであれば多少でもわかると便利です。
> # ご自身で"tail"という文字のある前後だけでも読んでみて、徐々に理解
> # を深めて行くのが一番なのですが。
お教え頂いたように、次のように打ってみました。linuxは、これからも勉強して
いきたいと思っていますので、少々長くなりますが、貼り付けてみます。
[root@vine root]# cd /home/toshio/StarSuite8_Linux/StarSuite8/office
[root@vine office]# head -n 189 setup
#!/bin/sh
java_runtime='java'
linenum=190
usetempjre=0
check_platform="Linux"
check_failed=1
if [ "`uname` `uname -p`" = "$check_platform" ]; then
check_failed=0
elif [ "`uname`" = "$check_platform" ]; then
check_failed=0
fi
if [ $check_failed -ne 0 ]; then
current_plat="`uname` `uname -p`"
echo "This installer is for $check_platform but you are running
$current_plat. Exiting."
exit 1
fi
set OLDMASK=`umask`
umask 022
cd `dirname $0`
if [ -f install*.class ]; then
run_classfile=`echo install*.class | sed 's/\.class//'`
elif [ -f uninstall_*.class ]; then
run_classfile=`echo uninstall_*.class | sed 's/\.class//'`
else
echo "no suitable class file found, exiting"
exit 1
fi
#check installed java version
jversion=`$java_runtime -version 2>&1 | egrep -e '"[0-9]*\.[0-9]*\..*"' `
jversion=`echo $jversion | sed 's/.*\"\([0-9]*\.[0-9]*\..*\)\".*/\1/'`
major=`echo $jversion | sed 's/\..*//'`
minor=`echo $jversion | sed 's/[0-9]*\.\([0-9]*\)\..*/\1/'`
if [ -z "$major" -o -z "$minor" ]; then
usetempjre=1
elif [ $major != "1" -o $minor -lt 4 ]; then
usetempjre=1
fi
if [ $usetempjre -gt 0 ]; then
NODOT_VERSION=150_01
javahome=jre1.5.0_01
PACKED_JARS="lib/rt.jar lib/jsse.jar lib/charsets.jar
lib/ext/localedata.jar lib/plugin.jar jav aws/javaws.jar"
LINUX_RPM=
libthread_path=
localinstall=$1
diskSpaceRequired=50264
MIME_TYPE=application/x-java-jnlp-file
outdir=/var/tmp/install_$$
mkdir $outdir
outname=install.sfx
diskSpace=`df -k $outdir | tail -1 | awk '{if ( $4 ~ /%/) { print $3 } else
{ print $4 } }'`
if [ $diskSpace -lt $diskSpaceRequired ]; then
printf "You will need atleast %s kBytes of Disk Free\n"
$diskSpaceRequired
printf "Please free up the required Disk Space and try again\n"
exit 3
fi
trap 'rm -rf $outdir; exit 1' HUP INT QUIT TERM
echo "Unpacking..."
tail +$linenum $0 > $outdir/$outname
if [ -x /usr/bin/sum ] ; then
echo "Checksumming..."
sum=`/usr/bin/sum $outdir/$outname`
index=1
for s in $sum
do
case $index in
1) sum1=$s;
index=2;
;;
2) sum2=$s;
index=3;
;;
esac
done
if expr $sum1 != 61394 || expr $sum2 != 16106 ; then
echo "The download file appears to be corrupted. Please refer"
echo "to the Troubleshooting section of the Installation"
echo "Instructions on the download page for more information."
echo "Please do not attempt to install this archive file."
exit 1
fi
else
echo "Can't find /usr/bin/sum to do checksum. Continuing anyway."
fi
chmod +x $outdir/$outname
olddir=`pwd`
cd $outdir
echo "Extracting..."
./$outname 2>&1 >/dev/null
rm -f $outname #we dont need it anymore, so conserve disk space
if [ -z "$LINUX_RPM" ]; then
UNPACK_EXE=$javahome/bin/unpack200
if [ -f $UNPACK_EXE ]; then
chmod +x $UNPACK_EXE
packerror=""
for i in $PACKED_JARS; do
if [ -f $javahome/`dirname $i`/`basename $i .jar`.pack ]; then
$UNPACK_EXE $javahome/`dirname $i`/`basename $i .jar`.pack
$javahome/$i
if [ ! -f $javahome/$i ]; then
printf "Failed to unpack jar files %s. Please refer\n" $i
printf "to the Troubleshooting section of the
Installation\n"
printf "Instructions on the download page for more
information.\n"
packerror="1"
fi
rm -f $javahome/`dirname $i`/`basename $i .jar`.pack
fi
done
if [ x$packerror = x1 ]; then
printf "ERROR: Installation failed. Please refer to the
Troubleshooting Section of\n"
printf "the Installation Instructions on the download page.\n"
if [ -d $javahome ]; then
/bin/rm -rf $javahome
exit 2
fi
fi
fi
if [ -n "$libthread_path" ] && [ -f "$libthread_path/`uname
-r`/libthread.so.1" ]; then
echo "Making libthread links"
ln -s `uname -r`/libthread.so.1 $libthread_path/libthread.so.1
ln -s libthread.so.1 $libthread_path/libthread.so
fi
userid=`expr "\`id\`" : ".*uid=[0-9]*(\(.[0-9a-z]*\)) .*"`
if [ -f $HOME/.java/properties$NODOT_VERSION ]; then
if [ x$userid = "xroot" ] ; then
su $USER -c "mv -f $HOME/.java/properties$NODOT_VERSION
$HOME/.java/_properties$NODOT_VERSI ON"
else
mv -f $HOME/.java/properties$NODOT_VERSION
$HOME/.java/_properties$NODOT_VERSION
fi
fi
if [ ! x$javahome = "x" ]; then
PREFS_LOCATION=$javahome
subdir=`echo $javahome "jre" | awk '{if ( index($1,"jdk") ) { print $2 }
}'`
if [ "$subdir" = "jre" ]; then
PREFS_LOCATION=$PREFS_LOCATION/jre
fi
if [ x$userid = "xroot" ] ; then
PREFS_LOCATION=/etc/.java
fi
if [ ! -d $PREFS_LOCATION ] ; then
mkdir -m 755 $PREFS_LOCATION
fi
if [ ! -d $PREFS_LOCATION/.systemPrefs ] ; then
mkdir -m 755 $PREFS_LOCATION/.systemPrefs
fi
if [ ! -f $PREFS_LOCATION/.systemPrefs/.system.lock ] ; then
touch $PREFS_LOCATION/.systemPrefs/.system.lock
chmod 644 $PREFS_LOCATION/.systemPrefs/.system.lock
fi
if [ ! -f $PREFS_LOCATION/.systemPrefs/.systemRootModFile ] ; then
touch $PREFS_LOCATION/.systemPrefs/.systemRootModFile
chmod 644 $PREFS_LOCATION/.systemPrefs/.systemRootModFile
fi
# fix for: 4728032 - Install needs to generate shared class files(32bit
only)
if [ x$ARCH = "x32" ]; then
$javahome/bin/java -client -Xshare:dump > /dev/null 2>&1
fi
fi
fi
echo "Done."
cd $olddir
java_runtime=$outdir/$javahome/bin/java
fi
echo "Running installer"
$java_runtime -DREGISTRY_SUFFIX=_Office $run_classfile
if [ "x$outdir" != "x" -a -d "$outdir" ]; then
rm -rf $outdir
fi
umask $OLDMASK
exit 0
[root@vine office]#
-------------------------------------------------------
今回、問題になっているのは、以下の部分でしょうか。
outdir=/var/tmp/install_$$
mkdir $outdir
outname=install.sfx
diskSpace=`df -k $outdir | tail -1 | awk '{if ( $4 ~ /%/) { print $3 } else
{ print $4 } }'`
if [ $diskSpace -lt $diskSpaceRequired ]; then
printf "You will need atleast %s kBytes of Disk Free\n"
$diskSpaceRequired
printf "Please free up the required Disk Space and try again\n"
exit 3
-----------------------------------
これがどのようなことを言っているのか、いまいちよくわかりません。
お教え頂ければ、ありがたいです。