#!/sbin/sh

set -a
set -u

#
#   This script creates nls links for CDE 
#   environment variable NEWDIR is supposed 
#   to be set up by caller
#

if [ "$NEWDIR" = "" ]
then
  echo "NEWDIR variable not set up"
  exit 1
fi

#   Make links for 10.0 style locale names
#
DEST=`echo $NEWDIR | sed -e 's!^/usr/tftpdir!!' -e 's!^/tftpboot!!'`
NLSDEST=$DEST/nls
BINDEST=$DEST/bin
XFONTDEST=$DEST/dt/usr/config/xfonts
APPDEFDEST=$DEST/dt/usr/app-defaults
JAPAPPDEFDEST=$DEST/lib
APPCONFIG=$DEST/dt/usr/appconfig/types
DTCONFIG=$DEST/dt/usr/config
NLSMSG=$DEST/dt/usr/lib/nls/msg

# directories
cd ${NLSDEST}
rm -f ja_JP.SJIS
rm -f ja_JP.eucJP
ln -s japanese         ja_JP.SJIS
ln -s japanese/euc     ja_JP.eucJP

# files
cd ${NLSDEST}/Xhp
rm -f ja_JP.SJIS
rm -f ja_JP.eucJP
ln -s japanese      ja_JP.SJIS
ln -s jeuc          ja_JP.eucJP

# directories
cd ${BINDEST}
rm -f ja_JP.SJIS
rm -f ja_JP.eucJP
ln -s japanese      ja_JP.SJIS
ln -s japanese/euc  ja_JP.eucJP

# fonts
cd ${XFONTDEST}
rm -f ja_JP.SJIS
rm -f ja_JP.eucJP
ln -s japanese ja_JP.SJIS 
ln -s japanese.euc ja_JP.eucJP

# app-defaults directories
cd ${APPDEFDEST}
rm -f japanese
rm -f japanese.euc
ln -s ja_JP.SJIS japanese
ln -s ja_JP.eucJP japanese.euc

# app-defaults directories
cd ${JAPAPPDEFDEST}
rm -f ja_JP.SJIS
rm -f ja_JP.eucJP
ln -s japanese      ja_JP.SJIS
ln -s japanese.euc  ja_JP.eucJP

# appconfig directories
cd ${APPCONFIG}
rm -f japanese
rm -f japanese.euc
ln -s ja_JP.SJIS japanese
ln -s ja_JP.eucJP japanese.euc

# dtconfig directories
cd ${DTCONFIG}
rm -f japanese
rm -f japanese.euc
ln -s ja_JP.SJIS japanese
ln -s ja_JP.eucJP japanese.euc

# msg directories
cd ${NLSMSG}
rm -f japanese
rm -f japanese.euc
ln -s ja_JP.SJIS japanese
ln -s ja_JP.eucJP japanese.euc


exit 0
