Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Script to ELIMINATE portage on any Stage3 (testing)
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Unsupported Software
View previous topic :: View next topic  
Author Message
cheater1034
Veteran
Veteran


Joined: 09 Sep 2004
Posts: 1558

PostPosted: Wed Jan 21, 2009 11:22 pm    Post subject: Script to ELIMINATE portage on any Stage3 (testing) Reply with quote

I am working on a script, and ideas, that will eliminate portage on any given stage3 tarball, and replace it completely with paludis,

Right now it is alpha and I am still testing it, but i successfully removed portage and no problems so far.
The only problems are, some ebuilds depend on portage still, either because of app-portage category or a bug in older than 2.1.2 portage (example: glibc). There are simple workarounds to these, just importare portage and mask anything newer, but if you installed gentoolkit or something i'd hope you'd realize it isn't going to work with paludis.

Here is the order of operation:
einfo " 1) install paludis with portage" - Ask if you want pink or not :), automatically appends inquisitio and ruby-bindings
einfo " 2) run portage2paludis" - Run this script, it works perfect since it's only default configuration
einfo " 3) make directories, and chmod as appropriate" - Of course a necessary stepp
einfo " 4) Copy portage to /var" - Instead of /usr/portage, /var/paludis/repositories/gentoo
einfo " 5) make repo configurations for paludis" - gentoo.conf and installed-unpackaged.conf (importare)
einfo " 6) edit the gentoo base profile to strip portage dependency" - Step for portage freeness
einfo " 7) sync paludis, masks and keywords for paludis" - Needs to be sync'd, some use for paludis such as pink (if you said y before), ruby-bindings, and inquisitio
einfo " 8.) Strip all portage directories, save the world" - Restore world file, strip all portage directories and files (except bin, such as commands like ebuild, repoman, etc)
einfo " 9) Importare portage because portage bug in pre-2.1.2 makes some ebuilds depend on it" - Not a desired step, will be taken to bugs.gentoo.org soon
einfo " 10) Change funtoo repository to gentoo repository" - Everything with funtoo is installed from funtoo repo (Same as gentoo but called funtoo), i find this annoying so a nested for in bash renames them all to gentoo
einfo " 11) Install portage python modules" - pym directory of portage source, for portage commands like ebuild, repoman, etc (i use them myself, others do to probably)

I'm going to get on bugs.gentoo.org about the glibc problem, they can make it depend on >=portage-2.1.2 || paludis || pkgcore (which a few other ebuilds do already so if portage isn't installed, it checks for pkgcore or paludis). The only problem i've gotten from a gentoo dev about this is that what is someone has portage < 2.1.2 installed and also has paludis installed, but isn't using paludis it will fail (due to the bug in pre-2.1.2 portage). I think that is too small of a population that will get that error, and they can attach a warning message too.

Here's the script
It's only coded to work on funtoo ~ stages, eventually i will plan on using regular funtoo stages that don't use the funtoo repository, and add paludis to package.keywords instead
But since this is only intended for testing, I am not going to work on that yet.
Code:

#!/usr/bin/env bash

VERSION="Alpha_1"

eerror() {
        echo -e "\033[0m\033[31m!!! \033[0m$*"
}

ewarn() {
        echo -e "\033[0m\033[1;33m* \033[0m$*"
}

einfo() {
        echo -e "\033[0m\033[32m* \033[0m$*"
}

einfo "Stage3 Portage Cleanser ${VERSION}"
einfo "Eliminate portage from stage3's! replace with paludis"
ewarn "ONLY FOR FUNTOO ~ STAGES!"
echo ""

# <---------------- Actually Begin ----------------->
echo "Make sure you are properly chrooted into the stage3 environment"
echo "1) Make sure you can go on the internet"
echo "2) Make sure /dev and /proc are mounted"
echo "3) Make sure you have already run emerge --sync"
echo "type YES if this is correct"
echo -n ": "
read input
if [ "$input" != "YES" ] ; then
   eerror "Go fix it then!"
   exit 0
fi

einfo "The procedure of this script is as follows:"
einfo " 1) install paludis with portage"
einfo " 2) run portage2paludis"
einfo " 3) make directories, and chmod as appropriate"
einfo " 4) Copy portage to /var"
einfo " 5) make repo configurations for paludis"
einfo " 6) edit the gentoo base profile to strip portage dependency"
einfo " 7) sync paludis, masks and keywords for paludis"
einfo " 8) Strip all portage directories, save the world"
einfo " 9) Importare portage because portage bug in pre-2.1.2 makes some ebuilds depend on it"
einfo " 10) Change funtoo repository to gentoo repository"
einfo " 11) Install portage python modules"
echo -n "Type QUIT to quit, any other key to continue."
read input
if [ "$input" == "QUIT" ] ; then
   error "Aborted by user"
   exit 0
fi
echo ""

einfo "Step 1 - Installing Paludis"
echo -n "Would you like pink paludis? (y/n) "
read pink
if [ "$pink" == "y" ] ; then
   USE="inquisitio pink ruby-bindings" emerge paludis
else
   USE="inquisitio -pink ruby-bindings" emerge paludis
fi
if [[ ! -x /usr/bin/paludis ]] ; then
   eerror "Paludis Failed to compile"
   exit 0
else
   einfo "Step 1 Successful!"
fi
echo ""

einfo "Step 2 - Run portage2paludis"
einfo " Now portage2paludis will download and run"
einfo " You will need to be present until the script is complete (< 1 minute)"
echo -n "type QUIT to exit, anything else or enter to continue"
read input
if [ "$input" == "QUIT" ] ; then
        error "Aborted by user"
        exit 0
fi
wget http://zen-sources.org/files/portage2paludis.txt
chmod +x portage2paludis.txt
einfo "Starting portage2paludis"
./portage2paludis.txt
rm portage2paludis.txt
echo ""

einfo "Step 3 - Making directories and adjusting permissions"
mkdir -p /var/cache/paludis/write-cache
mkdir /var/cache/paludis/names-cache
mkdir -p /var/paludis/repositories/gentoo/.cache/names/gentoo/
mkdir /var/paludis/repositories/gentoo/distfiles
mkdir -p /var/db/paludis/repositories/installed-unpackaged/
chmod  g+wx /var/tmp/paludis
chown -R paludisbuild:paludisbuild /var/paludis/repositories/gentoo/distfiles
chown -R paludisbuild:paludisbuild /var/tmp/paludis

einfo "Step 4 - Copying gentoo tree to /var"
cp -a /usr/portage/* /var/paludis/repositories/gentoo/

einfo "Step 5 - Making repository files for paludis"
# gentoo.conf
rm /etc/paludis/repositories/gentoo.conf
echo "location = /var/paludis/repositories/gentoo" >> /etc/paludis/repositories/gentoo.conf
echo "sync = rsync://rsync.gentoo.org/gentoo-portage" >> /etc/paludis/repositories/gentoo.conf
echo "sync_options = --exclude-from=/etc/paludis/repositories/sync.exclude" >> /etc/paludis/repositories/gentoo.conf
echo "profiles = /var/paludis/repositories/gentoo/profiles/default/linux/amd64/2008.0" >> /etc/paludis/repositories/gentoo.conf
echo "distdir = /var/paludis/repositories/gentoo/distfiles" >> /etc/paludis/repositories/gentoo.conf
echo "format = ebuild" >> /etc/paludis/repositories/gentoo.conf
echo "names_cache = /var/paludis/repositories/gentoo/.cache/names" >> /etc/paludis/repositories/gentoo.conf
echo "write_cache = /var/cache/paludis/metadata" >> /etc/paludis/repositories/gentoo.conf
# installed-unpackaged.conf
echo "format = installed_unpackaged" >> /etc/paludis/repositories/installed-unpackaged.conf
echo "location = /var/db/paludis/repositories/installed-unpackaged" >> /etc/paludis/repositories/installed-unpackaged.conf

einfo "Step 6 - Edit base profile"
wget http://zen-sources.org/files/packages.txt
mv packages.txt /var/paludis/repositories/gentoo/profiles/base/packages
echo "profiles" >> /etc/paludis/repositories/sync.exclude

einfo "Step 7 - Sync paludis, edit some configuration files"
# sync
paludis -s; paludis --regenerate-installed-cache
# environment
source /etc/profile; env-update
# configurations
echo "world="/var/db/pkg/world"" >> /etc/paludis/environment.conf
echo "PALUDIS_NO_WRITE_CACHE_CLEAN=yes" >> /etc/paludis/environment.conf
if [ "$pink" == "y" ] ; then
   echo "sys-apps/paludis inquisitio pink ruby-bindings" >> /etc/paludis/use.conf
else
        echo "sys-apps/paludis inquisitio -pink ruby-bindings" >> /etc/paludis/use.conf
fi
einfo "Step 8 - Save the world, and remove portage completely"
# save the world
rm /var/db/pkg/world
cp /var/lib/portage/world /var/db/pkg
# save portage binaries
mkdir temp
cp /usr/lib64/portage/bin/ebuild /usr/lib64/portage/bin/repoman /usr/lib64/portage/bin/xpak /usr/lib64/portage/bin/etc-update /usr/lib64/portage/bin/env-update /usr/lib64/portage/bin/quickpkg /usr/lib64/portage/bin/regenworld /usr/lib64/portage/bin/fixpackages temp
# portage cleanse begin
paludis -u portage --permit-unsafe-uninstalls
# restore bash executables
mv temp/* /usr/bin
rm -rf temp
# portage cleanse finish
rm -rf /etc/make.conf /etc/make.profile /etc/portage /usr/portage /usr/lib/portage /usr/lib64/portage /usr/lib32/portage /var/lib/portage /var/log/portage /var/cache/edb/dep/usr/portage

einfo "Step 9 - Importare portage and finish up"
# importare
mkdir dir
importare -il dir/ sys-apps/portage 2.1.6.7 0
rm -rf dir
# mask any newer portage upgrades
echo ">sys-apps/portage-2.1.6.7" >> /etc/paludis/package_mask.conf

einfo "Step 10 - Change funtoo repository to gentoo repository"
cd /var/db/pkg
for a in `ls`; do for b in `ls $a`;do c=`cat $a/$b/repository | sed 's/funtoo/gentoo/'`; echo $c > $a/$b/repository; done; done > /dev/null
cd /
echo ""

einfo "Step 11 - Installing portage python modules (for portage commands like ebuild, repoman, etc)"
wget http://zen-sources.org/files/portage-modules.tar_.bz2
tar jxvpf portage-modules.tar_.bz2
rm portage-modules.tar_.bz2

einfo "DONE!!!"

# <----------- Script End ------------->

exit 0


CC
_________________
IRC!: #zen-sources on irc.rizon.net
zen-kernel.org
--
Lost in android development land.


Last edited by cheater1034 on Thu Jan 22, 2009 2:42 am; edited 10 times in total
Back to top
View user's profile Send private message
cheater1034
Veteran
Veteran


Joined: 09 Sep 2004
Posts: 1558

PostPosted: Wed Jan 21, 2009 11:31 pm    Post subject: Reply with quote

That message at the bottom of the script is screwy for funtoo, when i make the next one it will be for standard stages.

And a special script for funtoo ~ stages using the funtoo git repository (but the way it is setup now to exclude the profiles directory with rsync, it would need to change for the git that funtoo uses)
_________________
IRC!: #zen-sources on irc.rizon.net
zen-kernel.org
--
Lost in android development land.
Back to top
View user's profile Send private message
cheater1034
Veteran
Veteran


Joined: 09 Sep 2004
Posts: 1558

PostPosted: Thu Jan 22, 2009 12:26 am    Post subject: Reply with quote

re-pasted it, fixed some syntax, missing quotation, and added a for clause to rename everything installed from :funtoo to :gentoo. (So the previous message can be forgotten)

*edit*
Ran the script, seems to be working perfect :)
_________________
IRC!: #zen-sources on irc.rizon.net
zen-kernel.org
--
Lost in android development land.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Unsupported Software All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum