summaryrefslogtreecommitdiff
path: root/setup_native/scripts/downloadscript.sh
blob: d86e8a884cff22a1adf3744aecdd4cd201c8ec3c (plain)
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
#!/bin/sh

linenum=LINENUMBERPLACEHOLDER

UNPACKDIR=/var/tmp/unpack_PRODUCTNAMEPLACEHOLDER

# Asking for the unpack directory

echo
echo "Where do you want to unpack the PRODUCTNAMEPLACEHOLDER download set ? [$UNPACKDIR] "
read reply leftover
if [ "x$reply" != "x" ]
then
  UNPACKDIR="$reply"
fi

# Unpacking

mkdir $UNPACKDIR

#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 $UNPACKDIR; exit 1' HUP INT QUIT TERM
echo "Unpacking ..."

#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 != <sum1replace> || expr $sum2 != <sum2replace> ; then
#   echo "The download file appears to be corrupted.  Please refer"
#   echo "to the Troubleshooting section of the Installation"
#   exit 1
#   fi
#else
#    echo "Can't find /usr/bin/sum to do checksum.  Continuing anyway."
#fi

# Determining current platform

platform=`uname -s`

case $platform in
SunOS)
  tail +$linenum $0 | (cd $UNPACKDIR; tar xvf -)
  ;;
Linux)
  tail +$linenum $0 | (cd $UNPACKDIR; tar xvf -)
  ;;
*)
  echo "Unsupported platform"
  exit 1
  ;;
esac

echo "Successfully unpacked..."

echo "Trying to start setup..."

if [ -f $UNPACKDIR/setup ]
then
    chmod 775 $UNPACKDIR/setup
    $UNPACKDIR/setup
fi

echo "Done"

exit 0