#!/bin/sh

ROOT=/ ; [ -d /a/etc/. ] && ROOT=/a


# Copying JAVA, MySQL, Autossh, ANT, TOP, etc. and all of the source........

echo "Copying JAVA, MySQL, Autossh, ANT, TOP, and all of the source........"

(cd $SI_CONFIG_DIR/Profiles/$SITE/Config/etc/. && tar cf - .) | (cd $ROOT/etc/. && tar xf -)

(cd $SI_CONFIG_DIR/Profiles/$SITE/Config/usr/. && tar cf - .) | (cd $ROOT/usr/. && tar xf -)

(cd $SI_CONFIG_DIR/Profiles/$SITE/Config/sshroot/. && tar cf - .) | (cd $ROOT/. && tar xf -)

(cd $SI_CONFIG_DIR/Profiles/$SITE/Config/yp/. && tar cf - .) | (cd $ROOT/var/yp/binding/. && tar xf -)

(cd $JS_PKGS_DIR/top/. && tar cf - .) | (cd $ROOT/usr/local/bin/. && tar xf -)

(cd $JS_PKGS_DIR/apps/. && tar cf - .) | (cd $ROOT/apps/. && tar xf -)


# SSH2 Startup Scripts


cat $SI_CONFIG_DIR/Profiles/$SITE/Config/S89sshd2 >/$ROOT/etc/rc3.d/S89sshd2

cat $SI_CONFIG_DIR/Profiles/$SITE/Config/S89sshd2 >/$ROOT/etc/init.d/sshd2



# MySQL Startup Scripts

cat $SI_CONFIG_DIR/Profiles/$SITE/Config/S80mysqld >/$ROOT/etc/rc3.d/S80mysqld

cat $SI_CONFIG_DIR/Profiles/$SITE/Config/K05mysqld >/$ROOT/etc/rc1.d/K05mysqld

cat $SI_CONFIG_DIR/Profiles/$SITE/Config/K05mysqld >/$ROOT/etc/rcS.d/K05mysqld

cat $SI_CONFIG_DIR/Profiles/$SITE/Config/etc/rc.d/rc.mysql >/$ROOT/etc/init.d/mysqld

cat $SI_CONFIG_DIR/Profiles/$SITE/Config/mysqld >/$ROOT/apps/mysql-standard-4.1.7-sun-solaris2.9-sparc/support-files/mysqld



# Changing Permissions for the MySQL Startup Scripts

chmod +x $ROOT/apps/mysql-standard-4.1.7-sun-solaris2.9-sparc/support-files/mysqld
chmod +x $ROOT/etc/init.d/mysqld $ROOT/etc/rc3.d/S80mysqld $ROOT/etc/rc1.d/K05mysqld $ROOT/etc/rcS.d/K05mysqld


# Changing Permissions for the SSH2 Startup Scripts

chmod +x $ROOT/etc/init.d/sshd2 $ROOT/etc/rc3.d/S89sshd2
