#!/bin/bash
#Nifty: Fix TSM init script and dsmc alias to support DK charset

echo "Getting init script and replacing current one with this"
rm -f /etc/init.d/dsmcad
curl https://mirror.zitcom.dk/internal/nifty.sh/tsm/dsmcad.init > /etc/init.d/dsmcad
chmod +x /etc/init.d/dsmcad

if [ -e "/etc/init.d/tsm" ]; then
	rm -f /etc/init.d/tsm
	ln -s /etc/init.d/dsmcad /etc/init.d/tsm
fi


echo "Fixing alias for dsmc to make it work on command line too"
cat <<EOF > /usr/local/bin/dsmc
#!/bin/sh
echo "Setting Locale to en_US"
export LANG=en_US
export LC_ALL=en_US
exec /opt/tivoli/tsm/client/ba/bin/dsmc \$*
EOF

chmod +x /usr/local/bin/dsmc 