#!/bin/bash
####################################################################################
#
# File : deb_preins.sh
# Project: SonATA
# Authors: The SonATA code is the result of many programmers
# over many years
#
# Copyright 2011 The SETI Institute
#
# SonATA is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# SonATA is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with SonATA. If not, see.
#
# Implementers of this code are requested to include the caption
# "Licensed through SETI" with a link to setiQuest.org.
#
# For alternate licensing arrangements, please contact
# The SETI Institute at www.seti.org or setiquest.org.
#
####################################################################################
cd /tmp
exec > >(tee ${0##*/}-$(date +"%b-%d-%y").log) ## Log the Script
clear
####################################################################################
# Installing the dependencies for SonATA #
####################################################################################
echo "#Installing the dependencies for SonATA#"
echo "#Creating a backup of /etc/apt/sources.list#"
echo "######as we will create a new file##########"
echo "#######for the duration of script.##########"
sudo cp /etc/apt/sources.list /etc/apt/sources.list-sonbackup
sudo sh -c 'cat > /etc/apt/sources.list < ~/sonata_install/bin/test_sonata </dev/null || (mkdir ~/.ssh && chmod 700 ~/.ssh) && cd ~/.ssh
echo "Creating the ssh key"
ssh-keygen -f id_rsa -t rsa -q
ssh-copy-id -i ~/.ssh/id_rsa.pub `whoami`@`hostname`
echo "###########################################################"
echo "# Type ssh `whoami`@`hostname` and then exit #"
echo "###########################################################"
sleep 3
echo "This will set the automatic key usage without password"