File "debian_install.sh"

Full path: /www/wwwroot/fabriciovc.eti.br/downloads/scripts/torrent/debian/debian_install.sh
File size: 6.39 KiB (6544 bytes)
MIME-type: text/x-shellscript
Charset: utf-8

Download   Open   Back

#!/bin/bash
#
# debian_install.sh
# Script para realizar padronização dDebian GNU/Linux
# http://downloads.fabriciovc.eti.br/debian/debian_install.sh
# 
# Fabricio Vaccari Constanski | fabriciovc@fabriciovc.eti.br
# v1.0 20081022, FabricioVC - Versão inicia
# v1.1 20110311, FabricioVC - Adicao de confirmacao de cores
# v1.2 20110314, FabricioVC - Ajustes da funcao status
# v1.3 20120417, FabricioVC - Ajustes no ntp e uso de sources.list default
# v1.4 20120417, FabricioVC - Atualizana na lista de pacotes a serem instalados
#
# Creative Commons
# Atribuicao-Compartilhamento pela mesma Licenca 3.0 Brasil.
# http://creativecommons.org/licenses/by/3.0/br/
#
# Você tem a liberdade de:
# * Compartilhar: copiar, distribuir e transmitir a obra.
# * Remixar: criar obras derivadas.
#
# Sob as seguintes condições:
# * Atribuição: Você deve creditar a obra da forma especificada ao autor
# * Aviso: Para qualquer reutilização ou distribuição, você deve deixar claro
#          a terceiros os termos da licença a que se encontra submetida esta 
#          obra. A melhor maneira de fazer isso é com um link para a página
#          http://creativecommons.org/licenses/by/3.0/br/.
#=============================================================================#

#== COMANDOS =================================================================#
APTGET=$(which apt-get)
APTKEY=$(which apt-key)
APTITUDE=$(which aptitude)
CAT=$(which cat)
CP=$(which cp)
CRONTAB=$(which crontab)
DATE=$(which date)
GPG=$(which gpg)
HWCLOCK=$(which hwclock)
LOCALEDEF="$(which localedef)"
MKDIR=$(which mkdir)
MV=$(which mv)
NTPDATE=$(which ntpdate)
REBOOT=$(which reboot)
RM=$(which rm)
SLEEP=$(which sleep)
SH=$(which sh)
TZCONFIG=$(which tzconfig)
WGET=$(which wget)

#== HABILITANDO CORES NO SHELL ===============================================#
CINZA="\033[01;30m"
VERMELHO="\033[01;31m"  # Usado para mensagens de falha
VERDE="\033[01;32m"     # Usado para mensagens de sucesso
AMARELO="\033[01;33m"   # Usado para mensagens de alerta
AZUL="\033[01;34m"      # Usado para mensagens de informacao
ROXO="\033[01;35m"
CIANO="\033[01;36m"
BRANCO="\033[01;37m"    # Usado para perguntas
FECHA="\033[m"          # Usado para finalizar o uso de cores

#== FUNCAO DE STATUS DE COMANDOS =============================================#
Status () {
        if [ $? -eq 0 ]; then
                echo " ... [${VERDE}Concluido${FECHA}]"
        else
                echo " ... [${VERMELHO}Falhou${FECHA}]"
        fi
}

#== CABECALHO ================================================================#
clear
echo "${BRANCO}== SISTEMA DE PADRONIZACAO DE SO ==${FECHA}"
echo

#== AJUSTANDO O SISTEMA ======================================================#
# Ajustando o sources.list do sistema APT
APT="/etc/apt"
${WGET} http://downloads.fabriciovc.eti.br/debian/sources.list
${MV} ${APT}/sources.list ${APT}/sources.list.orig
${MV} sources.list ${APT}

# Atualizando todo o sistema
$APTITUDE -y update

# Ajustando o locale do sistema
${APTITUDE} -y install locales
${LOCALEDEF} pt_BR -i pt_BR -f UTF-8

# Ajustando data e hora do sistema
${APTITUDE} -y install ntpdate tzdata
#${NTPDATE} -v -u ntp.usp.br
#${HWCLOCK} --systohc

# Removendo pacotes desnecessários
${APTGET} -y --purge remove exim4*

# Instalando pacotes essenciais
${APTITUDE} -y install vim vim-scripts ctags sudo zip unzip rar p7zip bzip2 \
less links telnet pciutils locate openssh-server sysv-rc-conf htop nmap \
tcpdump rsync build-essential libncurses5-dev ethtool lshw

# Atualizando o sistema
${APTITUDE} -y dist-upgrade

# Ajustando o .bash_logout
echo "clear" > .bash_logout

# Ajustando o ~/.bashrc
${CAT} <<EOF > /root/.bashrc
# ~/.bashrc

# Note: PS1 and umask are already set in /etc/profile. You should not
# need this unless you want different defaults for root.
#export PS1='\u@\h:\w\\$ '

# Ajustando o umask
umask 022

# You may uncomment the following lines if you want 'ls' to be colorized:
alias ls='ls --color=auto'
alias ll='ls --color=auto -lah'
alias l='ls --color=auto -lh'
#
# Some more alias to avoid making mistakes:
alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'
alias df='df -hT'
#
alias grep='grep --color=auto'

alias cds='cd /etc/init.d ; ls'
alias ts='tail -f /var/log/syslog'

export EDITOR=vim
EOF

# Ajustando o ~/.profile
${CAT} <<EOF > /root/.profile
# ~/.profile

if [ -f ~/.bashrc ]; then
  . ~/.bashrc
fi

mesg n
# Installed by Debian Installer:
#  no localization for root because C
#  cannot be properly displayed at the Linux console
LANG=pt_BR.UTF-8
LANGUAGE=pt_BR.UTF-8
EOF

# Ajustando o editor de textos padrão
export EDITOR="vim"
echo "export EDITOR=vim" >> /etc/bash.bashrc

# Ajustando mensagens de login
${CAT} <<EOF > /etc/profile.d/login_info.sh
echo "# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #"
echo "# ESTA E UMA AREA DE ACESSO APENAS PARA USUARIOS PREVIAMENTE AUTORIZADOS!!    #"
echo "#                                                                             #"
echo "# SE VOCÊ NÃO ESTÁ AUTORIZADO A ACESSAR ESTA ÁREA, DESCONECTE IMEDIATAMENTE!! #"
echo "# O AMBIENTE ESTÁ SENDO DEVIDAMENTE MONITORADO E REGISTRADO.                  #"
echo "#                                                                             #"
echo "# OS TERMOS LEGAIS DESTE ACESSO ESTÃO SOB RESPONSABILIDADE DA EMPRESA.        #"
echo "# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #"
EOF

# Ajustando o /etc/vim/vimrc
${MV} /etc/vim/vimrc /etc/vim/vimrc.orig
${CAT} <<EOF > /etc/vim/vimrc
runtime! debian.vim

"set compatible
set background=dark
syntax on

"if has("autocmd")
"  filetype indent on
"endif

"set showcmd            " Show (partial) command in status line.
"set showmatch          " Show matching brackets.
"set ignorecase         " Do case insensitive matching
"set smartcase          " Do smart case matching
"set incsearch          " Incremental search
"set autowrite          " Automatically save before commands like :next and :make
"set hidden             " Hide buffers when they are abandoned
"set mouse=a            " Enable mouse usage (all modes) in terminals

if filereadable("/etc/vim/vimrc.local")
  source /etc/vim/vimrc.local
endif
EOF

# Ajustando o crontab
CRON=/tmp/cron.txt
${CAT} <<EOF > ${CRON}
#
# System Rules
0	*/8	*	*	*	/usr/bin/aptitude update
0	*/6	*	*	*	/usr/sbin/ntpdate pool.ntp.br
0	*/12	*	*	*	/usr/bin/updatedb
#
EOF
$CRONTAB -r 
$CRONTAB $CRON 
$RM -rf $CRON

echo
echo "${VERDE}INSTALACOES FINALIZADAS${FECHA}"

exit 0

PHP File Manager