crablfs: ûİϵͳ -- ûֲ
crablfs: User Based Package Management System -- User's Concise Manual

Author: (Chowroc)
dATE: 2006-10-20
Email: chowroc.z@gmail.com

(1) 
crablfs ǻûİϵͳԭǣϵͳеÿһӦһûװһʱûݽвðϵͳɵļûȨ޶Ǹûͬʱеİûһ install УϵͳеһЩؼĿ¼ /usr/local, /usr/local/bin ӵ g+s,o+t Ȩޣ install 飬ڲͬİûЩĿ¼дԼļĿ¼

ַĺôԭľμ LFS hints
More Control and Package Management using Package Users (v1.2)
http://www.linuxfromscratch.org/hints/downloads/files/more_control_and_pkg_man.txt

ԭ userpack һнӿڣӵ rpm, paco İƵнӿڣԱɰɲֻһаװжءѯȲѯĳļİгϵͳǰеİ(rpm -qa)װİֺͰ汾Ϣָбļ

ͬʱÿһԼ HOME Ŀ¼ĬϷ /usr/src ¡ HOME Ŀ¼нԴ鵵еĲ(һЩļ patch)Լص"װϢļ"аϢû/汾šԴ鵵вͰװʱִеԼϵͳнʱ䡣

crablfs űһű˵һ ALFS ʵ֡ʹбļȻָԴ鵵"װϢļ"ڵĿ¼ʵԶĴҲָһԭϵͳ HOME ǰ׺Ŀ¼(/usr/src)ͬĿ¼ӶԺܷʵϵͳϵͳǨ -- ζκºܿݵĽԼĸԻϵͳ

Linux һа汾һа汾ĸ𣬾ڰʽĲͬLFS Ϊһа汾ʵȴûкƵİϵͳȻҲ LFS ģΪճʹãһƶ򵥵İϵͳǱҪġBLFS ĵнʹõľ User Based Managementֻ LFS hints ˻ԭԭд⣬ṩĽűǺƣûγһǢϵͳ²ϧֳһϣשá

(2) װ crablfs
Ϊ˱֤ crablfs Ҳڰ֮£ʹ·аװ
# export PYTHONPATH=/opt/lib/python2.4/site-packages
// sys.path  PYTHONPATH Ӱ
# tar xfz pexpect-2.1.tar.gz
# cd pexpect-2.1
# python setup.py install --prefix=/opt
# cd ..

# tar xfz crablfs-0.1.tar.gz
# cd crablfs-0.1
# vi userpack.dirs
// еĹؼĿ¼
// ЩĿ¼ install 飬ӵ g+s,o+t Ȩ
/usr/local/
/usr/local/bin/
/usr/local/doc/
/usr/local/etc/
/usr/local/include/
/usr/local/info/
/usr/local/lib/
/usr/local/libexec/
/usr/local/man/
/usr/local/man/man1/
/usr/local/man/man2/
/usr/local/man/man3/
/usr/local/man/man4/
/usr/local/man/man5/
/usr/local/man/man6/
/usr/local/man/man7/
/usr/local/man/man8/
/usr/local/sbin/
/usr/local/share/
/usr/local/share/doc/
/usr/local/share/info/
/usr/local/share/locale/
/usr/local/share/man/
/usr/local/share/man/man1/
/usr/local/share/man/man2/
/usr/local/share/man/man3/
/usr/local/share/man/man4/
/usr/local/share/man/man5/
/usr/local/share/man/man6/
/usr/local/share/man/man7/
/usr/local/share/man/man8/
/usr/local/share/misc/
/usr/local/share/terminfo/
/usr/local/share/zoneinfo/
/usr/lib/python2.4/site-packages/
/usr/lib64/python2.4/site-packages/
// ԼҪ
# python setup.py install --prefix=/opt
# cd ..

# /opt/bin/userpack init
# /opt/bin/userpack install -f /tmp/crablfs-0.1.tar.gz crablfs-0.1
crablfs> cmd tar xfz crablfs-0.1.tar.gz
crablfs> cmd cd crablfs-0.1
crablfs> cmd python setup.py install --install-scripts=/usr/local/bin
// ûи /usr/bin гʼָ
crablfs> cmd cd ..
crablfs> cmd rm -rf crablfs-0.1
crablfs> commit

# userpack install -f /tmp/pexpect-2.1.tar.gz pexpect-2.1
crablfs> cmd tar xfz pexpect-2.1.tar.gz
crablfs> cmd cd pexpect-2.1
crablfs> cmd python setup.py install
crablfs> cmd cd ..
crablfs> cmd rm -rf pexpect-2.1
crablfs> commit

# unset PYTHONPATH

(3) 
userpack

a. װһ
# userpack install $pkgname-$version

# userpack install rxvt-2.7.10
ʹԼķࣺ
# userpack install meida.mplayer-1.0pre8
Ϊϵͳû֧ "."

******
ע⣺
*  LFS ϵͳвˣLFS ϵͳʹõ shadow ֻ֧[-a-z0-9_]ЩַʹԼд shadow ģֱд /etc/passwd, /etc/group, /etc/shadow  /etc/gshadow Щļ

* ĿǰĹܻǿûоϸĲԡ
******

£ִĬϵĶΪԴİͲѾ HOME Ŀ¼ˣ /usr/src/$pkgnameӦڲָ
# userpack install -f /mnt/file/packages/rxvt-2.7.10.tar.gz rxvt-2.7.10
ԽӦİ HOME Ŀ¼¡

һʽн棬бȽϼ򵥣ֻΪļʵеһ shellִаװʱҪԷǳݲͬʹӦɡֻ֮ǰҪ"cmd"ʶ¼Ӧİװ HOME Ŀ¼µ .config(װϢļ)С
crablfs> cmd tar xfz rxvt-2.7.10.tar.gz
crablfs> cmd cd rxvt-2.7.10
crablfs> cmd ./configure
crablfs> cmd make
crablfs> cmd make install
crablfs> cmd cd ..
crablfs> cmd rm -rf rxvt-2.7.10
crablfs> commit
Ҫ˵ǣʱĵǰûûĿ¼ûĿ¼ԻȨ(ҲǰûϵͳĿ)

ôʱ list 鿴
crablfs> list
0, tar xfz rxvt-2.7.10.tar.gz
1, cd rxvt-2.7.10
2, ./configure
3, make
4, make install

ʹ rollback еֻɾĳʹ del N ɡ

 commitе¼ .config У $pkgname-$version Ҳ¼бļ(Ĭ /usr/src/packages.list)Աװˡʧܶ޷װų quit ˳Ӧݲᱻ¼ͨ鵵ȻᱻƵ HOME С

ļȣ
# userpack install -f /mnt/file/packages/MPlayer-1.0per8.tar.bz2 \
	-p /mnt/file/packages/all-20060611.tar.bz2 \
	-p /mnt/file/packages/Blue-1.6.tar.bz2 \
	mplayer-1.0pre8
// all  mplayer  codecsBlue  GUI Skin

ѾӵǰװʱϢļ -a|--auto ִԶװ
# userpack install -a rxvt-2.7.10
ʱζ $HOME/.config Ѿڣָ֮(-c|--profile)
# userpack install -ac /mnt/packages/confiles/rxvt-2.7.10 rxvt-2.7.10

Ѿ /usr/src ¼˹ϵ sources Ŀ¼ҲִµԶװ
# userpack install -as /mnt/dvdrom/sources rxvt-2.7.10

⣬װԴϣ ftp  ssh:
ssh://localhost/sources/mlterm-2.9.3.tar.gz
scp://localhost/sources/mlterm-2.9.3.tar.gz
һ˼
ftp://localhost/pub/sources/mlterm-2.9.3.tar.gz

# userpack install -f ftp://192.168.0.1/pub/sources/mlterm-2.9.3.tar.gz mlterm-2.9.3

******
ûָ $pkgname-$versionԴӰ(mlterm-2.9.3.tar.gz)
******

һѹ⣬ΪװʱԶ HOMEһΰȼ HOME ǷдѹѴĬϲ´µģҪָǿƿ(-C|--copy-force)
# userpack install -Caf libesmtp-1.0.3r1.tar.bz2

û IDԼ趨ΧĬֵǴ 1000  20000 /etc/login.defs ж壺
PACK_UID_MIN	10000
PACK_UID_MAX	25000
PACK_GID_MIN	10000
PACK_GID_MAX	25000

b. жأ
# userpack remove rxvt-2.7.10

c. гܰƵİ
# userpack packs
rxvt-2.7.10
mplayer-1.0pre8
crablfs-0.1
pexpect-2.1
mlterm-2.9.3

d. ѯһļǸ
# userpack owner /usr/local/bin/mlterm
mlterm-2.9.3

e. гһӵЩļ
# userpack files pexpect-2.1
/usr/lib/python2.4/site-packages/fdpexpect.py
/usr/lib/python2.4/site-packages/pxssh.py
/usr/lib/python2.4/site-packages/pexpect.py
/usr/lib/python2.4/site-packages/pxssh.pyc
/usr/lib/python2.4/site-packages/pexpect.pyc
/usr/lib/python2.4/site-packages/fdpexpect.pyc

(4) ڰ汾Լ
ݸĲʽΪ $pkgname-$version python re ģʽƥΪ
'^(?P<pkgname>(\w+-{0,1})+)(-(?P<version>(\d[\w]*[-\.])*\d[\w]*))'

 $pkgname Ϊ part1[-part2][-part3][...]ÿ part [-a-zA-Z0-9_]Կͷĸûƣʹĸͷ -[0-9][a-zA-Z0-9_]\. ģʽʱ(-һֿͷĴڴһ'.'ŵ)Ϊ $version ֣$version Ҳ԰'-'ţֿͷĲʱ $version ֣ݺԡ

(5) ALFS
ǰѾе¼ÿ HOME µ .config УҿЩԶװпʹһűڰװʱɵ packages.list һ԰װеİϣǿԽһ ALFS ʵ֡

 ALFS ʵ봫ͳ nALFS  jhalfs ĿչԻϵͳ磺һ̨ʹ step by step ķһ LFS ϵͳôһҿɵаװϢļԶҪԭϵͳһ£ζҿʵֶεǨƣͬʱҲҵİװϢļΪԼĸԻϵͳյĿ굱ȻҪʵֿƽ̨Ĳ

Ľű crablfs ˡ

******
Ŀǰֻ LFS Ѿ£ʹ crablfs  BLFS ˲ԣ˻ܽ LFS ϵͳаڰϵͳ֮¡
******

Ҫͨ python  crablfs ڱ֮£
# cd /blfs-sources
# tar xfj python-2.4.1.tar.bz2
# cd python-2.4.1
# patch -Np1 -i ../python-2.4.1-gdbm-1.patch
# ./configure --prefix=/opt --enable-shared
# make && make install
# cd ..
# rm -rf python-2.4.1
// ɾܻ

# export PYTHONPATH=/opt/lib/python2.4/site-packages
# tar xfz pexpect-2.1.tar.gz
# cd pexpect-2.1
# /opt/bin/python setup.py install --prefix=/opt
# cd ..
# rm -rf pexpect-2.1

# tar xfz crablfs-0.1.tar.gz
# cd crablfs-0.1
# cp userpack.dirs.blfs userpack.dirs
// ϵͳĿ¼б
// ԺĿ¼Ȩ޵⣬ֻҪ /etc/userpack.dirs
// Ȼ userpack init 
# /opt/bin/python setup.py install --prefix=/opt

# /opt/bin/userpack init
# /opt/bin/userpack install -f python-2.4.1.tar.bz2 -p
# python-2.4.1-gdbm-1.patch python-2.4.1
crablfs> cmd tar xfj python-2.4.1.tar.bz2
crablfs> cmd cd python-2.4.1
crablfs> cmd ./configure --prefix=/usr --enable-shared
crablfs> cmd make
crablfs> cmd make install
crablfs> cmd cd ..
crablfs> cmd rm -rf python-2.4.1
crablfs> commit

# /opt/bin/userpack install -f crablfs-0.1.tar.gz crablfs-0.1
crablfs> cmd tar xfz crablfs-0.1.tar.gz
crablfs> cmd cd crablfs-0.1
crablfs> cmd python setup.py install --install-scripts=/usr/local/bin
crablfs> cmd cd ..
crablfs> cmd rm -rf crablfs-0.1
crablfs> commit

# userpack install -f pexpect-2.1.tar.gz pexpect-2.1
crablfs> cmd tar xfz pexpect-2.1.tar.gz
crablfs> cmd cd pexpect-2.1
crablfs> cmd python setup.py install
crablfs> cmd cd ..
crablfs> cmd rm -rf pexpect-2.1
crablfs> commit

# unset PYTHONPATH
# userpack packs
python-2.4.1
crablfs-0.1
pexpect-2.1

ͬķʹ userpack ְװɰ
# userpack packs
# cat /usr/src/packages.list
python-2.4.1
crablfs-0.1
pexpect-2.1
openssl-0.9.7g
cracklib-2.8.3
Linux-PAM-0.80
iptables-1.3.3
gnupg-1.4.1
pcre-6.1
libxml-1.8.17
libxml2-2.6.20
libxslt-1.1.14
gdbm-1.8.3
pkg-config-0.19
glib2-2.6.4
expat-1.95.8
libesmtp-1.0.3r1
lzo-2.01
libusb-0.1.10a
libjpeg-6b
libpng-1.2.8
which-2.16

# mv /usr/src/packages.list /blfs-sources/
# config.copy /usr/src
// ڵǰĿ¼һ profiles Ŀ¼ /usr/src
// °װϢļĿ
//  shell űᰲװڰѹҵ
# mv profiles /blfs-sources
# crablfs -t alfs \
	-C /blfs-sources/profiles/ \
	-F /blfs-sources/ \
	/blfs-sources/packages.list

⣬֮ǰװһϵͳҽ /usr/src ȫ -- ¼ DVD-R ϣҲ
# crablfs -t crablfs[/default] \
	-s /mnt/dvdrom/sources/ \
	/mnt/dvdrom/sources/packages.list

crablfs ¼ǰɹװİֵ /var/log/crablfs/.mark СΪ֮䳣ǰϵĳһ crablfs ֹ̻ᰲװųԭԴӶϵ㿪ʼִС

 .mark ָ packages.list еһ crablfs ʲôע

⣬crablfs У packages.list ļаǷİȻʹ crablfs ֹκΰװ .mark еİ packages.list Уõ "x not in list" Ӧĵͨɾ .mark ɡ

Ŀǰû̫Ȩ⣬ҶͨװʱĲ⡣Ҫ chown, chmod, chgrp, install ЩдĿǰûп֮ٿԺԵɡ

(6) һļƻ
* BLFS  crablfs ű(shell script)
*  upgrade 
*  gettext ʻ֧
* ÿϢ
* PyUnit Ԫ
* ǿ cmdline ȫ
*  cmdline ȡ .config ʷ޸ָĹ
* һ༭
*  packages.list ļ
*  .config Ϊ $pkgname-$version ʽ
*  LFS ϵͳʵֿ
* ǿƽ̨֧֣
	ӻ cmdline ֧Ӧͬ $ARCH  $LOCALE
* ӶԶװԴ֧
* ǿ
* У
* ǿý: Plain Tree & XML
* Լ
* Ƶĵڲĵĵֲ

**************************************************************************
ҵһηԼƷˮƽޣл಻֮һԺŬĸĽƣͬʱϣҲߴͽ̣ܸҷԸ⣬Ҳ GPL 2.0 Э鼰汾Ľ롣

ϣԴãҲϣɴ˿һͨ͵ġ LFS а档

лл
**************************************************************************

crablfs Copyright (c) 2006, (chowroc.z@gmail.com)

This file is part of crablfs.

crablfs is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

crablfs is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with Foobar; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
