Tuesday, July 21, 2009

Apt_ctrl - When yum isnt your thing.

Apt_ctrl or Apt Control -

This was really designed to simplify package management by myself. The initial implement came about as a response to those vendors out there whom like to remove yum, but later on even with yum reinstalled... well things just weren't all right. So..? I dev'd out this monster to attempt to bring some sainity. Granite this is not the end to the pain and suffer and yes it only works for Centos 5 atm and will probably only remain in support of centos until the need arises to move to fedora.
Give it a shot you might like it.


### Apt Control ###
# Written by L.C. to reduce the suffering of a Centos5 install.

# installs coreutils
yum install coreutils -y;
# sets the redhat release to a variable - maybe later they will change the location of this file?
# acquiring the Architecture
plat_arch=`uname -i`
# determines OS
plat_os=`cat $rh_file | cut -d" " -f1`
if [ $plat_os == CentOS ] ;
then plat_type=el ;
else plat_type=fc ;
# Creates the release for the link - ie centos 5 = el5
plat_release=$plat_type`cat $rh_file | cut -d"." -f1 | cut -d' ' -f3`
# All variables get pulled into the link and then we request the file & install it
rpm -Uhv http://apt.sw.be/redhat/$plat_release/en/$plat_arch/rpmforge/RPMS/rpmforge-release-0.3.6-1.$plat_release.rf.$plat_arch.rpm
# we clean current repo's of potentially crappy data
yum clean all;
# we now do a fresh install of Apt-get
yum install apt -y;
# we echo commands into the os.list file to provide repos
echo 'repomd http://mirror.centos.org centos/$(VERSION)/os/$(ARCH)' > /etc/apt/sources.list.d/os.list &&
echo 'repomd http://mirror.centos.org centos/$(VERSION)/updates/$(ARCH)' >> /etc/apt/sources.list.d/os.list &&
echo 'repomd http://mirror.centos.org centos/$(VERSION)/extras/$(ARCH)' >> /etc/apt/sources.list.d/os.list &&
echo 'repomd http://mirror.centos.org centos/$(VERSION)/fasttrack/$(ARCH)' >> /etc/apt/sources.list.d/os.list ;
# we now update our package list
apt-get update;
# we next will install required packages.
apt-get -y install php php-curl php-mysql php-cli postfix mysql-server php-pgsql nano screen mc vixie-cron rkhunter;

No comments: