summaryrefslogtreecommitdiff
path: root/setup_native/scripts/linuxpatchscript.sh
blob: 71de51057668f62d4e2d7ff77df56bc1dd2914e0 (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
#!/bin/sh

MYUID=`id | sed "s/(.*//g" | sed "s/.*=//"`

if [ $MYUID -ne 0 ]
then
    echo You need to have super-user rights to install this language package
    exit 1
fi

echo
echo "Searching for the PRODUCTNAMEPLACEHOLDER installation ..."

RPMNAME=`rpm -qa | grep PRODUCTNAMEPLACEHOLDER-core01`

if [ "x$RPMNAME" != "x" ]
then
  PRODUCTINSTALLLOCATION="`rpm -ql $RPMNAME | head -n 1`"
else
  echo "PRODUCTNAMEPLACEHOLDER is not installed"
  exit 1
fi

# Asking for the installation directory

echo
echo "Where do you want to install the patch ? [$PRODUCTINSTALLLOCATION] "
read reply leftover
if [ "x$reply" != "x" ]
then
  PRODUCTINSTALLLOCATION="$reply"
fi

# Unpacking

echo "Installing..."

BASEDIR=`dirname $0`

RPMLIST=""
for i in `ls $BASEDIR/RPMS/*.rpm`
do
  rpm -q `rpm -qp --qf "%{NAME}\n" $i` && RPMLIST="$RPMLIST $i"
done

rpm --prefix $PRODUCTINSTALLLOCATION -U $RPMLIST 

echo "Done..."

exit 0