Changeset 1067

Show
Ignore:
Timestamp:
01/28/07 22:52:53 (2 years ago)
Author:
tushar
Message:

Updated Hint: crablfs

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/crablfs.txt

    r1065 r1067  
    1 AUTHOR: ????(Chowroc) <chowroc dot z at gmail dot com> 
    2  
    3 DATE: 2006-10-2
     1AUTHOR: Zhou Peng(Chowroc) <chowroc dot z at gmail dot com> 
     2 
     3DATE: 2006-12-0
    44 
    55LICENSE: GNU Free Documentation License Version 1.2 
     
    88 
    99DESCRIPTION: 
    10        Every package and its files belong to a system normal user, and 
     10        Every package and its files belong to a system normal user, and 
    1111a batch script to rebuild or migrate your personalized LFS/BLFS 
    1212system by install all your packages all at once. 
    1313 
    1414ATTACHMENTS: 
    15         http://cheeseshop.python.org/packages/source/c/crablfs/ 
     15    http://cheeseshop.python.org/pypi?:action=display&name=crablfs 
     16    https://sourceforge.net/project/showfiles.php?group_id=180695 
    1617 
    1718PREREQUISITES: 
    18        python-2.4 
    19         pexpect-2.1 
     19    python-2.4 
     20    pexpect-2.1(optional) 
    2021 
    2122HINT: 
    22          
     23 
    2324(1) Introduction: 
    24 crablfs: User Based Package Management System which is 
    25 written in python. Every package and its files belong to a system 
    26 normal user, and a batch script to rebuild or migrate your 
    27 personalized LFS/BLFS system by install all your packages 
    28 automatically all at once. The goal of "crablfs" is to exert more 
    29 control on packages that compiled from source, and reduce the costs 
    30 of system migration and backup. 
     25crablfs: User Based Package Management System which is written in 
     26python. Every package and its files belong to a system normal user, 
     27and a batch script to rebuild or migrate your personalized LFS/BLFS 
     28system by install all your packages automatically all at once. The 
     29goal of "crablfs" is to exert more control on packages that compiled 
     30from source, and reduce the costs of system migration and backup. 
    3131 
    3232The basic theory is: every package in the system has a corresponding 
     
    6666mode. 
    6767 
    68 The script "crablfs" is a batch script write in python, it is 
    69 another ALFS instance in other words, which make use of the 
    70 automated ability of "userpack". It can use the list 
    71 file(/usr/src/packages.list) mentioned before, to operate the 
    72 compressed source archives and installation profiles you appointed 
    73 automatically. And you can also specified a directory that has the 
    74 same structure as $homepre(/usr/src) to build a ALFS system 
    75 automatically. This means that you can migrate from an old system to 
    76 new ones more easily -- and rebuild your personalized system more 
    77 quickly. 
     68The script "crablfs" is a batch script write in python, it is another 
     69ALFS instance in other words, which make use of the automated ability 
     70of "userpack". It can use the list file(/usr/src/packages.list) 
     71mentioned before, to operate the compressed source archives and 
     72installation profiles you appointed automatically. And you can also 
     73specified a directory that has the same structure as $homepre 
     74(/usr/src) to build a ALFS system automatically. This means that you 
     75can migrate from an old system to new ones more easily -- and rebuild 
     76your personalized system more quickly. 
    7877 
    7978The essential differences among Linux distributions is the 
    8079differences of the package management ways. As a distribution, LFS 
    81 actually does not has a mature package manager itself, this of 
    82 course roots to the flexibility of LFS, but for daily use, a mature 
    83 package management system is necessary. It is recommended to use 
    84 User Based Management in the BLFS document, but the LFS hints only 
    85 give the basic principles which is very creative, but the shell 
    86 scripts is not enough to form a self-consistency system. So I write 
    87 one regardless of unveil my superficialness, a hope that my crude 
    88 remarks may draw forth by abler people. 
    89  
    90 Of course crablfs is not only used for LFS, it aims to those 
    91 packages that build from source code, so it can used on other 
    92 distributions, too. 
    93  
    94 (2) Install crablfs 
     80actually does not has a mature package manager itself, this of course 
     81roots to the flexibility of LFS, but for daily use, a mature package 
     82management system is necessary. It is recommended to use User Based 
     83Management in the BLFS document, but the LFS hints only give the basic 
     84 principles which is very creative, but the shell scripts is not 
     85enough to form a self-consistency system. So I write one regardless of 
     86unveil my superficialness, a hope that my crude remarks may draw forth 
     87by abler people. 
     88 
     89Of course crablfs is not only used for LFS, it aims to those packages 
     90that build from source code, so it can used on other distributions, too. 
     91 
     92It's now available from: 
     93https://sourceforge.net/project/showfiles.php?group_id=180695 
     94http://cheeseshop.python.org/pypi?:action=display&name=crablfs 
     95 
     96(2) install crablfs 
    9597To make sure that crablfs also under the control of package 
    96 management, to install by this way
     98management, to install by the following way to build the tools chain
    9799# export PYTHONPATH=/opt/lib/python2.4/site-packages 
    98100// sys.path will not be influenced by PYTHONPATH 
     101 
     102*** Now the pexpect package is optional *** 
    99103# tar xfz pexpect-2.1.tar.gz 
    100104# cd pexpect-2.1 
     
    105109# cd crablfs-0.1 
    106110# vi userpack.dirs 
    107 // define all key directory 
    108 // these dirs will belong to install group??and have g+s,o+t mode 
     111*** define all key directories *** 
     112*** these dirs will belong to 'install' group.and have g+s,o+t mode *** 
    109113/usr/local/ 
    110114/usr/local/bin/ 
     
    156160crablfs> commit 
    157161 
     162*** Now the pexpect package is optional *** 
    158163# userpack install -f /tmp/pexpect-2.1.tar.gz pexpect-2.1 
    159164crablfs> cmd tar xfz pexpect-2.1.tar.gz 
     
    166171# unset PYTHONPATH 
    167172 
    168 (3) Package Management: 
    169 manager: userpack 
     173(3) package management: 
     174Manager is 'userpack'. 
    170175 
    171176a. install a package: 
     
    177182because the system support '.' for user name. 
    178183 
    179 *** 
     184The short way is: 
     185# upm i $pkgname-$version 
     186 
     187****** 
    180188NOTICE: 
    181189* It is not true for LFS system,the shadow package that LFS use 
     
    183191/etc/passwd, /etc/group, /etc/shadow, /etc/gshadow directly. 
    184192 
    185 *. The classification function have not been tested strictly. 
    186 *** 
     193*. So far the classification function have not been tested strictly. 
     194****** 
    187195 
    188196Under the conditions above, the default action will taken, that is: 
     
    193201to make those archive and patches to be copied to HOME. 
    194202 
    195 This command will start an interactive command line, it is simple 
    196 and only several command. In fact it is like a shell, you can type 
    197 any 'shell' command to install the package, only need add 'cmd' 
    198 before the command to make the 'userpack' records the commands. 
    199 These commands will be stored into HOME/.config(installation 
    200 profile). 
     203This command will start an interactive command line, it is simple and 
     204only several command. In fact it is like a shell, you can type any 
     205'shell' command to install the package, only need add 'cmd' before the 
     206command to make the 'userpack' records the commands. These commands 
     207will be stored into HOME/.config(installation profile). 
    201208crablfs> cmd tar xfz rxvt-2.7.10.tar.gz 
    202209crablfs> cmd cd rxvt-2.7.10 
     
    208215crablfs> commit 
    209216 
    210 You should known that the current user is the package user, not 
    211 root; and current working directory is the user's HOME, so there may 
    212 be ownership problem(What is the purpose of User Based Package 
     217You should known that the current user is the package user, not root; 
     218and current working directory is the user's HOME, so there may be 
     219ownership problem(What is the purpose of User Based Package 
    213220Management System). 
    214221 
     
    224231command. 
    225232 
    226 You must 'commit/cmt' at last, thus all the commands will be 
    227 recorded to the .config, the $pkgname-$version couple will been add 
    228 to list file(/usr/src/packages.list for default), to indicate that 
    229 the package has been installed. If there is a command error makes 
    230 the installation failed, and the fault can't been clean up by 
    231 yourself, just type 'quit' and the installation terminated, but the 
    232 archive and patches will still be copied to HOME. 
     233If you want to execute a command but not want it to be recorded into 
     234the 'list', just 'do': 
     235crablfs> do ls 
     236 
     237You must 'commit/cmt' at last, thus all the commands will be recorded 
     238to the .config, the $pkgname-$version couple will been add to list 
     239file(/usr/src/packages.list for default), to indicate that the package 
     240has been installed. If there is a command error makes the installation 
     241failed, and the fault can't been clean up by yourself, just type 
     242'quit' and the installation terminated, but the archive and patches 
     243will still be copied to HOME. 
    233244 
    234245If there is any other supplementary files: 
     
    236247    -p /mnt/file/packages/all-20060611.tar.bz2 \ 
    237248    -p /mnt/file/packages/Blue-1.6.tar.bz2 mplayer-1.0pre8 
    238 // all is mplayer's codecs??Blue is GUI Skin. 
     249// all is mplayer's codecs.Blue is GUI Skin. 
    239250 
    240251If you have the installation profile before, you can use -a|--auto 
     
    257268    -f ftp://192.168.0.1/pub/sources/mlterm-2.9.3.tar.gz mlterm-2.9.3 
    258269 
    259 *** 
     270****** 
    260271If the package name(mlterm-2.9.3) is not given, it can be parsed 
    261 from the archive name(mlterm-2.9.3.tar.gz) automatically by 
    262 'userpack'. 
    263 *** 
     272from the archive name(mlterm-2.9.3.tar.gz) automatically by 'userpack'. 
     273****** 
    264274 
    265275If a archive has problem and makes installation failed, the archive 
    266 still has been copied to HOME, and the next time 'userpack' will 
    267 check whether the archive exists in HOME, if true, copy will not 
    268 occur. To change this, use -C|--copy-force: 
     276still has been copied to HOME, and the next time 'userpack' will check 
     277whether the archive exists in HOME, if true, copy will not occur. To 
     278change this, use -C|--copy-force: 
    269279# userpack install -Caf libesmtp-1.0.3r1.tar.bz2 
    270280 
    271281About the user/group ID, 'userpack' can define its own range, 
    272 default from 1000 to 20000, U can define in /etc/login.defs: 
    273 PACK_UID_MIN    10000 
    274 PACK_UID_MAX    25000 
    275 PACK_GID_MIN    10000 
    276 PACK_GID_MAX    25000 
     282default from 1000 to 20000, U can define in 
     283/usr/lib/python2.4/site-packages/crablfs/shadow.py: 
     284UID_MIN        1000 
     285UID_MAX        20000 
     286GID_MIN        1000 
     287GID_MAX        20000 
     288ADM_MIN        950 
     289ADM_MAX        1000 
     290 
     291This mean the normal user ids range is (1000, 19999), admin group ids 
     292is (950, 999). So 'install' group will be 950 by default. 
     293 
     294Besides the 'install', other admin groups will be used as 'application 
     295groups'. For example, 'glib2', 'atk', 'gtk', 'gtk2' all belongs to 
     296'GTK' group for some limited directories sharing, such as 
     297/usr/share/gtk-doc/ 
     298/usr/share/gtk-doc/html 
     299thus no modification of userpack.dirs is necessary. 
     300 
     301Correspondingly, add a '-G' option to support multiple groups, for 
     302example, 'xfce4' belogs to 'xfce4', 'install' and 'GTK' group. 
     303(default is 'xfce4' and 'install'). 
     304 
     305Now I can do this to support 'applications group' and 'multiple groups': 
     306# upm i -G GTK glib2-2.6.4 
     307crablfs> ... 
     308...... 
     309crablfs> chgrp GTK /usr/share/gtk-doc/{,html} 
     310crablfs> chmod g+w,o+t /usr/share/gtk-doc/{,html} 
     311...... 
     312 
     313# upm i -G GTK atk-1.9.1 
     314...... 
     315 
     316These all can be read from the installation profiles and be executed 
     317automatically. 
    277318 
    278319b. remove: 
    279320# userpack remove rxvt-2.7.10 
     321or 
     322# upm r rxvt-2.7.10 
    280323 
    281324c. list all packages under the control: 
    282325# userpack packs 
     326or 
     327# upm a 
    283328rxvt-2.7.10 
    284329mplayer-1.0pre8 
     
    289334d. query a file's package owner: 
    290335# userpack owner /usr/local/bin/mlterm 
     336or 
     337# upm o /usr/local/bin/mlterm 
    291338mlterm-2.9.3 
    292339 
    293340e. list all files a package contains: 
    294341# userpack files pexpect-2.1 
     342or 
     343# upm l pexpect-2.1 
    295344/usr/lib/python2.4/site-packages/fdpexpect.py 
    296345/usr/lib/python2.4/site-packages/pxssh.py 
     
    299348/usr/lib/python2.4/site-packages/pexpect.pyc 
    300349/usr/lib/python2.4/site-packages/fdpexpect.pyc 
     350 
     351This will read $HOME/.files to print all files the package have. This 
     352file is generated by the Package Manager 'userpack' as soon as the 
     353installation is finished, but you can force 'userpack' to regenerate 
     354it by run: 
     355# upm L pexpect-2.1 
     356This command will also print all the files of the package. 
    301357 
    302358(4) About the pkgname & version rule: 
     
    333389This batch script is 'crablfs'. 
    334390 
    335 *** 
     391****** 
    336392So far, it is only tested under the condition that the LFS base 
    337393system has been built, to use 'crablfs' to build a bunch of BLFS 
    338394packages, so it is the future to make the LFS base system under the 
    339395control of package management system. 
    340 *** 
     396****** 
    341397 
    342398At first, adjust the tool chain: 
     
    352408 
    353409# export PYTHONPATH=/opt/lib/python2.4/site-packages 
     410 
     411*** Now pexpect is optional *** 
    354412# tar xfz pexpect-2.1.tar.gz 
    355413# cd pexpect-2.1 
     
    386444crablfs> commit 
    387445 
     446*** Now the pexpect is optional *** 
    388447# userpack install -f pexpect-2.1.tar.gz pexpect-2.1 
    389448crablfs> cmd tar xfz pexpect-2.1.tar.gz 
     
    400459pexpect-2.1 
    401460 
     461****** 
     462Now there is a script 'scripts/setup-blfs' to do these all! 
     463****** 
     464 
    402465And use the same way, I installed some packages: 
    403466# userpack packs 
    404467# cat /usr/src/packages.list 
    405468python-2.4.1 
    406 crablfs-0.1 
     469crablfs-0.1.1 
    407470pexpect-2.1 
     471net-tools-1.60 
    408472openssl-0.9.7g 
    409473cracklib-2.8.3 
     
    417481gdbm-1.8.3 
    418482pkg-config-0.19 
     483glib-1.2.10 
    419484glib2-2.6.4 
    420485expat-1.95.8 
     
    425490libpng-1.2.8 
    426491which-2.16 
    427  
     492unzip-5.52 
     493zip-2.32 
     494pciutils-2.1.11 
     495cpio-2.6 
     496libpcap-0.9.3 
     497ppp-2.4.3 
     498rp-pppoe-3.8 
     499libsoup-2.2.3 
     500subversion-1.1.4 
     501wget-1.9.1 
     502bind-9.3.1 
     503gc-6.8 
     504w3m-0.5.1 
     505gpm-1.20.1 
     506dhcpcd-1.3.22 
     507freetype-2.1.10 
     508fontconfig-2.3.2 
     509Xorg-6.9.0 
     510915resolution-0.5.2 
     511gtk-1.2.10 
     512pango-1.8.1 
     513atk-1.9.1 
     514gtk2-2.6.7 
     515startup-notification-0.8 
     516hicolor-icon-theme-0.8 
     517xfce-4.2.2 
     518mlterm-2.9.3 
     519 
     520The X Window is OK and xfce is usable, so I try to *migrate*: 
    428521# mv /usr/src/packages.list /blfs-sources/ 
    429 # config.copy /usr/src 
     522# copy-profiles /usr/src 
    430523// This will generate a profiles dir in current dir, 
    431524// which contains all the profiles from $homepre(/usr/src) 
    432 // This shell script will not be installed, 
    433 // you can find it in the archive 
    434525# mv profiles /blfs-sources 
    435526# crablfs -t alfs \ 
     
    439530 
    440531If you have installed such a BLFS system and burned /usr/src all to 
    441 the DVD-R, you can do this: 
     532the DVD-R, you can do the following for another system to install all 
     533package once a time: 
    442534# crablfs -t crablfs[/default] \ 
    443535    -s /mnt/dvdrom/sources/ \ 
    444536    /mnt/dvdrom/sources/packages.list 
     537 
     538You may want to adjust 'packages.list' for your own needs, if you want 
     539, you can also edit the profiles. 
    445540 
    446541crablfs will record current successfully installed package name to 
     
    463558neccessary. To dicide this for further using and testing. 
    464559 
    465 (6) The Next Plans 
    466 * BLFS crablfs tool chain adjusting shell script 
     560(6) The next plan 
    467561* Add upgrade part 
    468562* Add gettext internationlized support 
    469563* Whole infomations show of a package 
    470564* PyUnit 
    471 * Enganced cmdline completion function 
    472565* Add code for cmdline to read .config history commands 
     566* Make cmdline can execute 'root' commands, as 'sudo', by IPC? 
    473567* A command editor? 
    474568* File lock of packages.list 
     
    482576* Consider package dependencies problems 
    483577* Better documents: internal, design doc and manual 
     578* Make 'userpack init' can adjust those dir items deleted from 'userpack.dirs' 
     579 
     580****** 
     581*** LIMITATIONS *** 
     582When want to install 'glib2-2.6.4', but type in error with 
     583'glib-2.6.4': 
     584# upm i -a -c profiles/glib2 glib-2.6.4 
     585This will mistakenly remove all files of glib-1.2.10!!! Because when a 
     586package installation failed, the Manager will remove all the files 
     587that generated by 'install', 'cp', 'mv' commands during the process. 
     588 
     589So far, this limitation roots in the limitation of package version 
     590control, this also makes 'upgrade' not easy. 
     591****** 
    484592 
    485593ACKNOWLEDGEMENTS: 
    486         Matthias S. Benkmann built the original principles 
     594    Matthias S. Benkmann built the original principle 
    487595 
    488596CHANGELOG: 
     5972006-12-05: 
     598    For crablfs-0.1.1beta. 
     599 
    4896002006-10-25: 
    490         crablfs-0.1 has been distributed at 2006-10-20, so I write this 
    491 hint. 
     601    crablfs-0.1 has been distributed at 2006-10-20, so I write this hint.