All pastes #349106 Raw Edit

Unnamed

public text v1 · immutable
·published 2007-02-10 15:54 UTC
rendered paste body
#!/bin/bash
# It's my first serious bash script
# This script tunns my Ubuntu after system crash and reinstall...
#Parts of the functions are guiven from automatix - http://getautomatix.com
# Thanks to Arnieboy, Jimmyjazz and the others from the automatix team...
##########################################################################
#### THE VARIABLES #####
BACKUPHOME='/home/backup'
function dir_ch { cd $BACKUPHOME }
#Users#
user1='eniac'
user2='pecata'
user3='mimi'
#users - end#
###conf files###
SOURCESconf='$BACKUPHOME/etc/apt/sources.list'
RESOLVconf='$BACKUPHOME/etc/resolv.conf'
HOSTNAMEconf='$BACKUPHOME/etc/hostname'
HOSTSconf='$BACKUPHOME/etc/hosts'
INTERFACESconf='/home/backup/etc/network/interfaces'
####conf files - end###
####literals###
#*about users
userstart1="Now I \'ll create the user - $user1 ."
userstart2="Now I \'ll create the user - $user2 ."
userstart3="Now I \'ll create the user - $user3 ."
userconf1="Now I \'ll configure $user1 ."
userconf2="Now I \'ll configure $user2 ."
userconf2="Now I \'ll configure $user3 ."
userdone1="$user1 is created"
userdone2="$user2 is created"
userdone3="$user3 is created"
userset1="$user1 \'s settings are created"
userset2="$user2 \'s settings are created"
userset3="$user3 \'s settings are created"
userseterr1="The $user1 \'s settings are not created"
userseterr2="The $user2 \'s settings are not created"
userseterr3="The $user3 \'s settings are not created"
usererror1="The user $user1 could\'nt be created."
usererror2="The user $user2 could\'nt be created."
usererror3="The user $user3 could\'nt be created."
#*About configuration files
#**Network
resolvecho="Configuring the /etc/resolv.conf."
hostnameecho="Configuring the /etc/hostname."
hostsecho="Configuring the /etc/hosts."
interfacesecho="Configuring the /etc/network/interfaces."
#**APT
sourceslistecho="Configuring the /etc/apt/sources.list ."
#software
softerror="Instalation was unsuccesful."
softdone="Instalation was succesful."

### literals - end ###
### END OF VARIABLES ###
########FUNCTIONS#######

# Adding the new users
function adduser1 { echo "$userstart1"; \n && sudo adduser -- ....................... && echo "$userdone1"; \n
                    then echo " $

                    exit 1
                               }
function adduser2 { echo $userstart2 \n && sudo adduser - ...............................

                    exit 1
                               }

function adduser3 { echo $userstart3 \n && sudo adduser - ..............................

                    exit 1
                               }
# configuring users

function configuser1 { echo $userconf1 \n && sudo chown -R $user1:$user1 /home/$user1 && sudo chmod 775 -R /home/$user1
                      then echo $userset1
                      else echo $useterr1

                    exit 1
                               }

function configuser2 { echo $userconf2 \n && sudo chown -R $user2:$user2 /home/$user2 && sudo chmod 775 -R /home/$user2
                     then echo $userset1


                    exit 1
                               }

function configuser3 { echo $userconf3 \n && sudo chown -R $user3:$user3 /home/$user3 && sudo chmod 775 -R /home/$user3

                    exit 1
                               }
#configuring the internet settings

function resolv { echo $resolvecho \n && sudo chown root:root $RESOLVconf  && sudo chmod 777 $RESOLVconf && sudo cp $RESOLVconf /etc/resolv.conf

                   exit 1
                               }
function hostname { echo $hostnameecho \n && sudo chown root:root $HOSTNAMEconf && sudo chmod 664 $HOSTNAMEconf && sudo cp $HOSTNAMEconf /etc/hostname

                   exit 1
                               }
function hosts { echo $hostsecho \n && sudo chown root:root $HOSTSconf && sudo chmod 664 $HOSTSconf && sudo cp $HOSTSconf /etc/hosts

                   exit 1
                               }
function interfaces { echo $interfacesecho \n && sudo chown root:root $INTERFACESconf && sudo chmod 664 $INTERFACESconf && sudo cp $INTERFACESconf /etc/network/interfaces

                  exit 1
                               }
#Apt sources.list configuration...
function aptsources { echo $sourceslistecho \n && sudo chown root:root $SOURCESconf && sudo chmod 664 $SOURCESconf && sudo cp $SOURCESconf /etc/apt/sources.list && sudo apt-get update && sudo apt-get upgrade

                  exit 1
                               }
#Functions for installing applications

function codecs {
       sleep 1
       dpkg_check
       sudo apt-get --assume-yes install totem-xine libxvidcore4 lame sox ffmpeg mjpegtools vorbis-tools mpg321 libxine-main1 gstreamer0.10-ffmpeg gstreamer0.10-gl gstreamer0.10-plugins-base gstreamer0.10-plugins-good gstreamer0.10-plugins-bad gstreamer0.10-plugins-bad-multiverse gstreamer0.10-plugins-ugly gstreamer0.10-plugins-ugly-multiverse libxine-extracodecs gstreamer0.10-fluendo-mp3 gstreamer0.10-fluendo-mpegdemux gstreamer0.10-gnonlin gstreamer0.10-sdl faac faad alsa-oss
sleep 1
if ! ((dpkg -s libdivx0-binary | grep "Version: 6.1.1-1duo1") && (dpkg -s libdivx0-binary | grep "Status: install ok installed"));
then
	dir_ch
	if wget --tries=1 --timeout=30 http://ftp.debian-unofficial.org/debian/pool/restricted/d/divx-binary-i386/libdivx0-binary_6.1.1-1duo1_i386.deb
	then
	sleep 1
	sudo dpkg -i lib:divx0-binary_6.1.1-1duo1_i386.deb
	sleep 1
	rm -f $BACKUPHOME/libdivx0-binary_6.1.1-1duo1_i386.deb
	elif wget --tries=1 --timeout=30 http://ftp.ch.debian-unofficial.org/debian/pool/restricted/d/divx-binary-i386/libdivx0-binary_6.1.1-1duo1_i386.deb
	then
	sleep 1
	sudo dpkg -i libdivx0-binary_6.1.1-1duo1_i386.deb
	sleep 1
	rm -f $BACKUPHOME/libdivx0-binary_6.1.1-1duo1_i386.deb
       else
       echo "DivX 6 codecs could not be downloaded.";
       fi
fi 
if ! dpkg -s libdivxdecore0-binary | grep "Version: 5.0.5-1duo1" 
then
	dir_ch
	if wget --tries=1 --timeout=30 http://ftp.debian-unofficial.org/debian/pool/restricted/d/divx4linux-binary-i386/libdivxdecore0-binary_5.0.5-1duo1_i386.deb
	then
	sudo dpkg -i libdivxdecore0-binary_5.0.5-1duo1_i386.deb
	sleep 1
	rm -f $BACKUPHOME/libdivxdecore0-binary_5.0.5-1duo1_i386.deb
	elif wget --tries=1 --timeout=30 http://ftp.ch.debian-unofficial.org/debian/pool/restricted/d/divx4linux-binary-i386/libdivxdecore0-binary_5.0.5-1duo1_i386.deb
	then
	sudo dpkg -i libdivxdecore0-binary_5.0.5-1duo1_i386.deb
	sleep 1
	rm -f $BACKUPHOME/libdivxdecore0-binary_5.0.5-1duo1_i386.deb
       else
       AX_warning "DivX 5 decoder could not be downloaded.";
       fi
fi
if ! ((dpkg -s libdivxencore0-binary | grep "Version: 5.0.5-1duo1") && (dpkg -s libdivxencore0-binary | grep "Status: install ok installed"));
then
	dir_ch
	if wget --tries=1 --timeout=30 http://ftp.debian-unofficial.org/debian/pool/restricted/d/divx4linux-binary-i386/libdivxencore0-binary_5.0.5-1duo1_i386.deb
	then
	sudo dpkg -i libdivxencore0-binary_5.0.5-1duo1_i386.deb
	sleep 1
	rm -f $BACKUPHOME/libdivxencore0-binary_5.0.5-1duo1_i386.deb
	elif wget --tries=1 --timeout=30 http://ftp.ch.debian-unofficial.org/debian/pool/restricted/d/divx4linux-binary-i386/libdivxencore0-binary_5.0.5-1duo1_i386.deb
	then
	sudo dpkg -i libdivxencore0-binary_5.0.5-1duo1_i386.deb
	sleep 1
	rm -f $BACKUPHOME/libdivxencore0-binary_5.0.5-1duo1_i386.deb
       else
       echo "DivX 5 encoder could not be downloaded.";
       fi
fi
}

function skypeinstall {
       # Install the Skype
       sleep 1
       dir_ch
       if wget --tries=2 --timeout=30 http://www.skype.com/go/getskype-linux-deb
       then
       sleep 1
       sudo apt-get install --assume-yes alsa-oss libqt3-mt libasound2 libc6 libgcc1 libstdc++5
       sleep 1
       dir_ch
       sudo dpkg -i skype_debian-1.3.0.53-1_i386.deb
       sleep 1
       dir_ch
       rm -f $BACKUPHOME/skype_debian-1.3.0.53-1_i386.deb
       else
       echo "Skype could not be downloaded.";
       fi
}

function getsomesoft {
       sleep 1
       dir_ch
       if ! sudo apt-get install --assume-yes gftp k3b kopete beagle beagle-backend-evolution vorbis-tools sox mjpegtools ffmpeg lame imagemagick toolame mpeg2dec gstreamer0.8-mpeg2dec gstreamer0.8-a52dec kino kinoplus audacity easytag acroread mozilla-acroread acroread-escript acroread-plugins gnump3d apache2 php5 mysql mysqli rar unace unrar p7zip arj unzoo lha libarchive1 libarchive-tar-perl libarchive-zip-perl dpkg-dev
       then
       echo " $getsomeerror ";

#Other functions...
function start {
setterm -background black -foreground green && dir_ch
echo 'Wellcome to the matrixXx!!! :D' \n
 if echo 'The user manipulation script is started' \n
     then 

  if
               fi

  if