#!/bin/sh
# Copyright (c) 2004 by SWsoft, Inc.
# All rights reserved
#
#ident "@(#)plesk 7.0 04/02/02 SWsoft"
#
# Plesk locale pack install script
#
# accumulates chown and chmod
set_ac()
{
u_owner="$1"
g_owner="$2"
perms="$3"
node="$4"
chown $u_owner:$g_owner $node || die "chown $u_owner:$g_owner $node"
chmod $perms $node || die "chmod $perms $node"
}
p_echo()
{
echo "$*" >> "$product_log" 2>&1
echo "$*" 1>&2
}
pno_echo()
{
echo "$*" >> "$product_log" 2>&1
}
pnnl_echo()
{
if [ -z $necho_defined ]; then
# set up echo
case "`echo 'x\c'`" in
'x\c')
echo="echo -n"
nnl=
;;
x)
echo="echo"
nnl="\c"
;;
*)
echo "ERROR: unable to set up echo."
;;
esac
necho_defined=true
fi
$echo "$*${nnl}" >> "$product_log" 2>&1
$echo "$*${nnl}"
}
die()
{
printf "\a\a"
p_echo
p_echo "ERROR while trying to $*"
p_echo "Check the error reason, fix and try again"
p_echo
p_echo "Aborting..."
p_echo
exit 1
}
err()
{
p_echo
p_echo "ERROR!"
p_echo "Check the error reason, fix and try again"
p_echo
p_echo "Exiting..."
p_echo
exit 1
}
echo_try()
{
msg="$*"
pnnl_echo " Trying to $msg... "
}
suc()
{
p_echo "done"
}
test_for_root()
{
my_id="`id`"
case "$my_id" in
uid=0\(root\)*)
;;
*) p_echo "$0: This script must be run as root"
p_echo "Became a root and then run this script"
p_echo
exit 1
;;
esac
}
chk_version()
{
if [ -d "$product_root" ]; then
product_real_ver="`cat $product_root/version | awk '{print $1}' -| awk -F'.' '{print $1"."$2}' -`"
case "$product_real_ver" in
$product_version)
;;
*) p_echo
p_echo "You have $product_bb version $product_real_ver"
p_echo "In order for this script to work properly, please ensure that the version"
p_echo "of the $product_bb that you're attempting to localizate is $product_version."
p_echo "OK. Goodbye! See you later"
p_echo
exit 0
;;
esac
fi
p_echo
p_echo
p_echo
p_echo
p_echo "\"$locale\" locale will be added to your control panel."
p_echo
if [ "$INTERACTIVE" = "NO" ]; then
return
fi
pnnl_echo "Do you want to continue? [N] "
read answer
case "$answer" in
y*|Y*)
;;
*)
p_echo
p_echo "OK. Goodbye! See you later"
p_echo
exit 0
;;
esac
p_echo
}
get_etc_conf()
{
if [ ! -f $config ]; then
p_echo "ERROR: Unable to open $config file."
exit 3
fi
product_root=`grep PRODUCT_ROOT_D $config | grep -v '^#' | awk '{print $2}'`
if [ -z "$product_root" ]; then
p_echo "ERROR: Unable to define $product root directory."
exit 3
fi
rc_dir=`grep PRODUCT_RC_D $config | grep -v '^#' | awk '{print $2}'`
if [ -z "$rc_dir" ]; then
rc_dir=$product_root/rc.d
fi
mysql_bin_dir=`grep MYSQL_BIN_D $config | grep -v '^#' | awk '{print $2}'`
if [ -z "$mysql_bin_dir" ]; then
mysql_bin_dir=$product_root/mysql/bin
fi
}
check_integrity()
{
#check of $product_bb intallation
if [ ! -d ${product_root} ]; then
p_echo "ERROR: $product_bb directory '${product_root}' not found! Install $product_bb first."
exit 1
fi
#check for free space
DISTSIZE=22512
FREESPACE=`df -kP ${product_root} | grep /dev/| awk '{ print $4 }'`
if [ "${DISTSIZE}" -ge "${FREESPACE}" ]; then
p_echo "ERROR: No free space for install Locale Pack."
p_echo "ERROR: No free space for install Locale Pack." >> $product_log
exit 2
fi
}
extract_report()
{
case $? in
0)
p_echo " Extraction successfully completed"
p_echo
;;
*)
p_echo
p_echo "ERROR: something wrong with distribution archive file"
p_echo "Exiting..."
p_echo
exit 1
;;
esac
}
set_def_perms()
{
chown -R root:$admin_group "$install_dir/htdocs/locales/$locale/"
chmod -R 440 "$install_dir/htdocs/locales/$locale/"
find "$install_dir/htdocs/locales/$locale/" -type d -exec chmod 550 {} \;
set_ac root $admin_group 440 "$install_dir/plib/locales/$locale/conhelp_$locale.php"
set_ac root $admin_group 440 "$install_dir/plib/locales/$locale/messages_$locale.php"
for dir in htdocs plib; do
set_ac root $admin_group 550 "$install_dir/$dir/locales"
set_ac root $admin_group 550 "$install_dir/$dir/locales/$locale"
done
}
get_pid()
{
proc_name="$1"
case "$machine" in
solaris)
PID=`ps -ef | grep "$proc_name" | grep -v grep | awk '{print $2}'`
;;
*)
PID=`ps axww | awk '$5 ~ "'$proc_name']*$" {print $1}'`
;;
esac
}
patch_symlink()
{
if [ ! -d "$product_root/mysql/share/mysql" -a ! -L "$product_root/mysql/share/mysql" ]; then
mkdir -p "$product_root/mysql/share" &&
ln -sf /usr/share/mysql "$product_root/mysql/share/mysql" ||
die "create symlink for MySQL default_charset fix"
fi
}
f_help=NO
INTERACTIVE=YES
while [ -n "$1" ]; do
case $1 in
--interactive)
INTERACTIVE=YES
;;
--no-interactive)
INTERACTIVE=NO
;;
--help | -h)
f_help=YES
;;
*)
echo $1: unknown argument
exit 1
;;
esac
shift
done
if [ "$f_help" = "YES" ]; then
cat <<EOF
Usage: $0 [--interactive | --no-interactive]
EOF
exit 0
fi
TARGET_OS="`uname -a`"
case "$TARGET_OS" in
FreeBSD*i386)
machine="BSD"
uudecode="uudecode -p"
;;
Linux*2.?.*i?86*| \
Linux*2.?.*x86_64*)
machine="linux"
uudecode="uudecode -o /dev/stdout"
;;
*) echo "Not supported OS for patch"
exit 1
;;
esac
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin
export PATH
my_name_0="`pwd`"
my_name_1="`basename ""$0""`"
my_name_2=`echo ""$0""|sed -e "s/^\.\///"`
case "$?" in
0)
my_name="$my_name_2"
;;
1)
my_name="$my_name_0"/"$my_name_2"
;;
*)
err
;;
esac
###!!!!!! GLOBAL VARIABLES !!!!!###
product=psa
product_bb="Plesk"
product_full="Plesk"
support_email=support@plesk.com
sales_email=sales@plesk.com
product_version="`echo "7.5.4" | awk '{print $1}' -| awk -F'.' '{print $1"."$2}' -`"
###!!!!!! end GLOBAL VARIABLES !!!!!###
product_log="/tmp/${my_name_1}.log"
config="/etc/$product/$product.conf"
test_for_root
get_etc_conf
install_dir="$product_root/admin"
admin_user="${product}adm"
admin_group="${product}adm"
admin_passwd="`cat /etc/$product/.psa.shadow`"
mysql="$mysql_bin_dir/mysql -N -uadmin -p$admin_passwd ${product}"
locale="de-DE"
locale_full="de-DE:GERMAN:GERMANIC:GERMANY;"
echo >> $product_log #initializing log
echo "START LOGGING: `date`" >> $product_log
check_integrity
chk_version
p_echo
p_echo "So, it's time to unpack distribution files"
p_echo "All files will be extracted into $product_root directory"
p_echo "This operation takes some time,"
p_echo "please, wait..."
p_echo
p_echo "===> Extracting files ..."
cat "$my_name" | $uudecode | tar -C "$install_dir/" -xz -m -f -
extract_report
set_def_perms
get_pid "mysqld"
if [ -z "$PID" ]; then
inten="start MySQL server"
echo_try $inten
$rc_dir/mysqld start >> $product_log 2>&1 &&
suc || die $inten
sleep 2
fi
res=`$mysql <<END
REPLACE INTO locales (id) VALUES('$locale');
END
`
if [ -z "$PID" ]; then
inten="stop MySQL server"
echo_try $inten
$rc_dir/mysqld stop >> $product_log 2>&1 &&
suc || die $inten
sleep 2
fi
patch_symlink
printf "\a\a\a"
p_echo
p_echo
p_echo
p_echo
p_echo " Congratulations!"
p_echo " All stages of installation were successfully completed"
p_echo
p_echo
p_echo " If the number of LP's installed exceeds the number of possible LP's"
p_echo " defined within the key, then the installed Locale packs that exceed"
p_echo " the number defined by the key will not be available via Plesk interface."
p_echo " Please contact your Plesk sales representative in order to purchase"
p_echo " an appropriate key."
p_echo
p_echo
exit 0
begin 644 psa_locale_de-DE.tar.gz
M'XL(`//9U$,``^S]VW;;YI8GCO9M

R_`\K][RRY_J1DG
...................
M[G_WO_O?_>_^=_^[_]W_[G_WO_O?_>_^=_^[_]W_[G_WO_O?_>^3?_\71$4%
%-0`P(```
`
end