#!/bin/bash #Of course, put this file in the /bin directory and chmod 755 /bin/rcr_install green="\033[1;32m" red="\033[1;31m" yellow=" \033[1;33m" blue="\033[1;34m" purple=" \033[1;35m" cyan="\033[1;36m" white="\033[1;37m" normal="\033[0;39m" blink="\033[5m" clear echo -e ${green}Showing users currently connected... $normal w echo -e $green Executing as $USER $normal if [ "$USER" = "root" ] then echo -e $green Good, you are $USER, we shall contine $normal else echo -e $red You must be root user to run this script Aborting... $normal exit 1 fi #****************** # Apt section #****************** #Make backup of preferences if one doesn't exist. if [ -f /etc/apt/preferences.tweak ] then echo -e $blue Backup of original file "preferences" exist. skipping ... $normal else echo -e $green Backing up /etc/apt/preferences file! $normal cp /etc/apt/preferences /etc/apt/preferences.tweak fi #Make backup of sources if one doesn't exist. if [ -f /etc/apt/sources.tweak ] then echo -e $blue Backup of original file "sources.list" exist. skipping ... $normal else echo -e $green Backing up /etc/apt/sources.list file! $normal cp /etc/apt/sources.list /etc/apt/sources.tweak fi #Make backup of apt.conf if one doesn't exist. if [ -f /etc/apt/apt.tweak ] then echo -e $blue Backup of original file "apt.conf" exist. skipping ... $normal else echo -e $green Backing up /etc/apt/apt.conf file! $normal cp /etc/apt/apt.conf /etc/apt/apt.tweak fi # Ask if user wants to replace sources. Do no run this section if user chooses no. echo -e $cyan $red $blink NOTE:${normal}$cyan Only choose yes if you are running stable Debian$normal echo -en $yellow "Replace sources.list? with "stable" (y/N)" read answer if expr "$answer" : ' *[yY].*' > /dev/null; then echo -e $green Setting up apt sources, pinning distro stable, applying proxy $normal echo -e $green .... $normal echo -e $green Setting up apt sources, pinning distro stable, applying proxy $normal cat > /etc/apt/preferences << "End-of-file" # Note this will make unstable available if testing is not. Package: * Pin: release o=Debian,a=stable Pin-Priority: 900 Package: * Pin: release o=Debian,a=testing Pin-Priority: 400 Package: * Pin: release o=Debian,a=unstable Pin-Priority: 300 End-of-file cat > /etc/apt/sources.list << "End-of-file" #deb file:///cdrom/ etch main #deb cdrom:[Debian GNU/Linux 3.1 r0a _etch_ - Official i386 Binary-1 (20050607)]/ unstable contrib main deb http://security.debian.org/ stable/updates main contrib #deb http://ftp.us.debian.org/debian/ stable main deb http://ftp.us.debian.org/debian/ stable main non-free contrib deb-src http://ftp.us.debian.org/debian/ stable main # Volatile (Like clamav) deb http://ftp2.de.debian.org/debian-volatile etch/volatile main #Testing deb http://ftp.us.debian.org/debian/ testing main non-free contrib deb-src http://ftp.us.debian.org/debian/ testing main #Unstable deb http://ftp.us.debian.org/debian/ unstable main non-free contrib deb-src http://ftp.us.debian.org/debian/ unstable main End-of-file cat > /etc/apt/apt.conf << "End-of-file" 'Acquire::http::Proxy "http://192.168.0.186:3128"; End-of-file else echo -e $blue Skipping APT Configuration ... $normal fi # End apt configuration! apt-get update apt-get install vim lynx bzip2 unzip ntpdate ntp-simple unzoo arj zip lzop nomarch arc zoo rar lha dnsutils module-assistant postfix rcconf perl dpkg apt apt-utils debconf traceroute dnsutils net-tools sysutils configure-debian dnswalk ntop netmask cron-apt apt-get remove pcmcia-cs pppoe pppoeconf ppp pppconfig uw-imapd #****************** #BashRC Stuff #****************** if [ -f ~/.bashrc.tweak ] then echo -e $blue Backup of bashrc.tweak exists! We will not overwrite it. skipping... $normal else echo -e $green Backing up bashrc file! $normal cp ~/.bashrc ~/.bashrc.tweak fi echo -en $yellow "Replace Current users .bashrc file? $cyan [no] (y/N)" read answer if expr "$answer" : ' *[yY].*' > /dev/null; then cat > ~/.bashrc <<"End-of-file" #--------------RCR Tweaked Bashrc----------------------- export PS1="\[\e[36;1m\]\H \[\e[32;1m\]\w> \[\e[0m\]" umask 022 # You may uncomment the following lines if you want `ls' to be colorized: export LS_OPTIONS='--color=auto' eval `dircolors` alias ls='ls $LS_OPTIONS -F' alias ll='ls $LS_OPTIONS -l' alias l='ls $LS_OPTIONS -lA' # # Some more alias to avoid making mistakes: alias rm='rm -i' alias cp='cp -i' alias mv='mv -i' alias aai="aptitude install" alias aas="aptitude search" alias aar="aptitude remove" alias aau="aptitude update" alias aauu="aptitude upgrade" alias aadu="aptitude dist-upgrade" alias sv="/etc/init.d/" alias agr="apt-get remove" alias acs='apt-cache search' alias agi="apt-get install" alias agu="apt-get update" #edit the last file you opened alias lvim="vim -c \"normal '0\"" alias ssh-l="ssh -l root lists.rcrnet.net" alias ssh-c="ssh -l root channelvar.com" alias ssh-ns1="ssh -l root ns1.rcrnet.net" alias ssh-ns2="ssh -l root ns2.rcrnet.net" alias ssh-m="ssh -l root mx2.rcrnet.net" . /etc/bash_completion #--------------RCR Tweaked BashRC----------------------- End-of-file else echo -e $blue User chooses to skip bashrc Configuration ... $normal fi #****************** # Gvimrc section #****************** if [ -f ~/.gvimrc.tweak ] then echo -e $blue Backup of original file gvimrc exist, skipping ... $normal else echo -e $green Backing up Gvimrc file! $normal cp ~/.gvimrc ~/.gvimrc.tweak fi cat >~/.gvimrc<<"End-of-file" set background=dark set guifont=monospace\ 16 colorscheme blue " my color scheme if has("gui_kde") set guifont=helvetica/16/-1/5/50/0/0/0/0/0 endif End-of-file #****************** # Vimrc section #****************** if [ -f ~/.vimrc.tweak ] then echo -e $blue Backup of original file vimrc exist, skipping ... $normal else echo -e $green Backing up Vimrc file! $normal cp ~/.vimrc ~/.vimrc.tweak fi cat > ~/.vimrc <<"End-of-file" "#--------------RCR Tweaked Vimrc----------------------- set background=dark set ignorecase " When started as "evim", evim.vim will already have done these settings. if v:progname =~? "evim" finish endif " Use Vim settings, rather then Vi settings (much better!). " This must be first, because it changes other options as a side effect. set nocompatible " allow backspacing over everything in insert mode set backspace=indent,eol,start if has("vms") set nobackup " do not keep a backup file, use versions instead else set backup " keep a backup file endif set history=50 " keep 50 lines of command line history set ruler " show the cursor position all the time set showcmd " display incomplete commands set incsearch " do incremental searching " For Win32 GUI: remove 't' flag from 'guioptions': no tearoff menu entries " let &guioptions = substitute(&guioptions, "t", "", "g") " Don't use Ex mode, use Q for formatting map Q gq " This is an alternative that also works in block mode, but the deleted " text is lost and it only works for putting the current register. "vnoremap p "_dp " Switch syntax highlighting on, when the terminal has colors " Also switch on highlighting the last used search pattern. if &t_Co > 2 || has("gui_running") syntax on set hlsearch endif " Only do this part when compiled with support for autocommands. if has("autocmd") " Enable file type detection. " Use the default filetype settings, so that mail gets 'tw' set to 72, " 'cindent' is on in C files, etc. " Also load indent files, to automatically do language-dependent indenting. filetype plugin indent on " Put these in an autocmd group, so that we can delete them easily. augroup vimrcEx au! " For all text files set 'textwidth' to 78 characters. autocmd FileType text setlocal textwidth=78 " When editing a file, always jump to the last known cursor position. " Don't do it when the position is invalid or when inside an event handler " (happens when dropping a file on gvim). autocmd BufReadPost * \ if line("'\"") > 0 && line("'\"") <= line("$") | \ exe "normal g`\"" | \ endif augroup END else set autoindent " always set autoindenting on endif " has("autocmd") set nocindent set nosmartindent set noautoindent "#set indenexpr= filetype indent off filetype plugin indent off "#--------------RCR Tweaked Vimrc----------------------- End-of-file #********************************* #**** Static Network settings **** #********************************* if [ -f /etc/network/interfaces.tweak ] then echo -e $blue Backup of original file /etc/network/interfaces exist, skipping ... $normal else echo -e $green Backing up /etc/network/interfaces file! $normal cp /etc/network/interfaces /etc/network/interfaces.tweak fi cat >/etc/network/interfaces<<"End-of-file" #--------------RCR Tweaked Network Settings----------------------- # This file describes the network interfaces available on your system # and how to activate them. For more information, see interfaces(5). # The loopback network interface auto lo iface lo inet loopback # The primary network interface auto eth0 iface eth0 inet dhcp #iface eth0 inet static # address 192.168.0.50 # netmask 255.255.255.0 # # network 192.168.0.0 # broadcast 192.168.0.255 # gateway 192.168.0.1 #iface eth0 inet static # address 192.168.1.50 # netmask 255.255.255.0 # # network 192.168.1.0 # broadcast 192.168.1.255 # gateway 192.168.1.1 # iface eth0 inet static # address 65.16.101.i99 # netmask 255.255.255.224 # network 65.16.101.96 # broadcast 65.16.101.127 # gateway 65.16.101.97 # dns-* options are implemented by the resolvconf package, if installed # dns-nameservers 65.17.91.254 #dns-search rcrnet.net #--------------RCR Tweaked Network Settings----------------------- End-of-file if [ -f /etc/console-tools/config.tweek ] then echo -e $blue Backup of original file config.tweak exists, skipping... $normal else cp /etc/console-tools/config /etc/console-tools/config.tweek echo -e $green Editing /etc/console-tools/config to set numlock ON at boot... $normal sed -i.tweak 's/#LEDS=+num/LEDS=+num/' /etc/console-tools/config fi if [ -f /etc/cron.d/cron-apt.tweek ] then echo -e $blue Backup of original file config.tweak exists, skipping... $normal else cp /etc/cron.d/cron-apt /etc/cron-apt.tweak echo -e $green Backing up /etc/cron.d/cron-apt to /etc/cron-apt.tweak... $normal echo -e $green Editing /etc/cron.d/cron-apt to run daily with no email output... $normal echo "@daily root /usr/sbin/cron-apt && /usr/sbin/cron-apt >/dev/null 2>&1" > /etc/cron.d/cron-apt fi echo echo -e $yellow Please set /etc/apt/apt.conf if you need a proxy setup. $normal echo -e $yellow Please set the /etc/hostname if needed. Host name is $HOSTNAME $normal echo echo -e $purple RCR Tweaks installed Have a nice day! $normal