Created
July 25, 2010 20:42
-
-
Save rtucker/489868 to your computer and use it in GitHub Desktop.
Downgrades an Ubuntu 10.04 LTS system to PHP 5.2, from Ubuntu 9.04
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Downgrades an Ubuntu 10.04 LTS system to PHP 5.2, from Ubuntu 9.04 | |
# Ryan Tucker <rtucker@gmail.com>, 2010/07/20 | |
# Based on http://mrkandy.wordpress.com/2010/04/16/install-php-5-2-x-in-ubuntu-10-04-lucid/ | |
# Get current PHP 5.3 packages from 10.04 LTS | |
PHP53PACKAGES=`mktemp php53packagesXXXXX` | |
dpkg -l | grep php | awk '{print $2}' > $PHP53PACKAGES | |
# Remove all of them | |
apt-get purge `tr "\n" " " < $PHP53PACKAGES` | |
# Set up pins for karmic versions | |
echo -e "Package: php5\nPin: release a=karmic\nPin-Priority: 991\n" | tee /etc/apt/preferences.d/php > /dev/null | |
apt-cache search php5-|grep php5-|awk '{print "Package:", $1,"\nPin: release a=karmic\nPin-Priority: 991\n"}'| tee -a /etc/apt/preferences.d/php > /dev/null | |
apt-cache search -n libapache2-mod-php5 |awk '{print "Package:", $1,"\nPin: release a=karmic\nPin-Priority: 991\n"}'| tee -a /etc/apt/preferences.d/php > /dev/null | |
echo -e "Package: php-pear\nPin: release a=karmic\nPin-Priority: 991\n" | tee -a /etc/apt/preferences.d/php > /dev/null | |
# set up source for karmic | |
grep '^deb http.* lucid.*' /etc/apt/sources.list|grep -v "#"| sed s/lucid/karmic/g | tee /etc/apt/sources.list.d/karmic.list > /dev/null | |
# update package db | |
apt-get update | |
# install what was installed before | |
apt-get -t karmic install `tr "\n" " " < $PHP53PACKAGES` | |
# restart apache | |
service apache2 restart |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment