ln -sf /tmp/tcloop/APPNAME/bin/chmod /bin/
export PATH="/bin:$PATH"
busybox addgroup -S sshd
busybox adduser -S -H -D -G sshd sshd
[ -d /etc/ssh ] || mkdir /etc/ssh
#touch /etc/ssh/sshd_config
[ -d /var/run/sshd ] || mkdir /var/run/sshd
chown root:root /var/run/sshd
chmod 755 /var/run/sshd

if [ -d /tmp/tcloop/APPNAME/ ]; then
   if [ ! -f /etc/ssh/sshd_config ]; then
	cp -a /tmp/tcloop/APPNAME/usr/local/share/openssh-server/sshd_config.example /etc/ssh/sshd_config
   fi

   if [ ! -f /etc/ssh/ssh_config ]; then
	cp -a /tmp/tcloop/APPNAME/usr/local/share/openssh-server/ssh_config.example /etc/ssh/ssh_config
   fi
else
   if [ ! -f /etc/ssh/sshd_config ]; then
	cp -a /usr/local/share/openssh-server/sshd_config.example /etc/ssh/sshd_config
   fi

   if [ ! -f /etc/ssh/ssh_config ]; then
	cp -a /usr/local/share/openssh-server/ssh_config.example /etc/ssh/ssh_config
   fi
fi


chown root:root /etc/ssh/sshd_config
chmod 644 /etc/ssh/sshd_config
chown root:root /etc/ssh/ssh_config
chmod 644 /etc/ssh/ssh_config

#ssh-keygen -A

exit 0

#if [ ! -f /etc/ssh/ssh_host_rsa_key ]; then
#  echo "Creating SSH RSA host key.."
#  ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key -C '' -N ''
#fi
#
#if [ ! -f /etc/ssh/ssh_host_dsa_key ]; then
#  echo "Creating SSH DSA host key.."
#  ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key -C '' -N ''
#fi
#
#
#if [ ! -f /etc/ssh/ssh_host_ecdsa_key ]; then
#  echo "Creating SSH ECDSA host key.."
#  ssh-keygen -t ecdsa -f /etc/ssh/ssh_host_ecdsa_key -C '' -N ''
#fi

