LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 991|回复: 5

做一个包管理的设想

[复制链接]
发表于 2010-8-9 17:57:36 | 显示全部楼层 |阅读模式
很多人都说LFS没有包管理是一个弊病,其实,这些弊病只要Linuxsir论坛就可以解决:
1.LFS的软件包均为散兵游勇:解决方法为建立民间{,C}{,B}LFS服务器。
2.无成型包管理:可以下列方法制作:

制作一个简单的shell或ncurses外壳,并将tar.bz2软件包中加入以下脚本:

chkdep 检查依赖
mkprogram 编译
mkinstall 安装
mkuninstall 反安装

这样一来,就可以同时使用预编译包与非预编译包

另:本人建议将包装入/usr/local代替/usr或/usr/X11R6

下面是脚本举例:

Firefox3   zh_CN   预编译:

#! /bin/bash
# this file is 'chkdep'
rm -rfp .chkdep > /dev/null 2>&1
mkdir -p .chkdep > /dev/null 2>&1
if [ -d '../alsa' ]
then
touch .chkdep/alsa
else
exit 1
fi

if [ -d '../gtk2' ]
then
touch .chkdep/gtk2
else
exit 1
fi

if [ -d '../dbus-glib' ]
then
touch .chkdep/dbus-glib
else
exit 1
fi

#! /bin/bash
# this file is 'mkprogram'
tar xf main.tar.bz2

#! /bin/bash
# this file is 'mkinstall'
cp -R maindir /opt/firefox
rm -rf maindir

#! /bin/bash
# this file is 'mkuninstall'
rm -rf /opt/firefox

Gtk2 Librarys 自编译

#! /bin/bash
# this file is 'chkdep'
rm -rfp .chkdep > /dev/null 2>&1
mkdir -p .chkdep > /dev/null 2>&1
if [ -d '../pango' ]
then
touch .chkdep/pango
else
exit 1
fi

if [ -d '../atk' ]
then
touch .chkdep/atk
else
exit 1
fi

if [ -e '../pango/.chkdep/cairo' ]
then
touch .chkdep/pangocairo
else
exit 1
fi

if [ -d '../tiff' ]
then
touch .chkdep/tiff
fi

if [ -d '../jpeg' ]
then
touch .chkdep/jpeg
fi

#! /bin/bash
# this file is 'mkprogram'

printf ’./configure --prefix=/usr/local ‘ > config
if [ -e '.chkdep/tiff' ]
then
echo "" > /dev/null
else
printf ’ --without-libtiff‘ > config
fi

if [ -e '.chkdep/jpeg' ]
then
echo "" > /dev/null
else
printf ’ --without-libjpeg‘ > config
fi
echo "" >> config
echo 'exit $?' >> config
if bash config
then
if make
then
echo "" > /dev/null
else
exit 1
fi
else
exit 1
fi

#! /bin/bash
# this file is 'mkinstall'
make install &&
install -v -m755 -d /usr/share/doc/gtk+-2.10.13/{faq,tutorial} &&
cp -v -R docs/faq/html/* /usr/share/doc/gtk+-2.10.13/faq &&
cp -v -R docs/tutorial/html/* /usr/share/doc/gtk+-2.10.13/tutorial &&
install -v -m644 docs/*.txt /usr/share/doc/gtk+-2.10.13
make clean

#! /bin/bash
# this file is 'mkuninstall'
make uninstall


当然,在实际使用中,他们应在一个源码树下的隐藏目录里(比如.lpkg)

这就是我的设想,概括:

1.安装后保留文件夹以检查依赖
2.检查依赖、编译、安装脚本分离,同时设卸载脚本
发表于 2010-8-9 20:19:32 | 显示全部楼层
这种包管理有啥用……装了软件还要一定保留代码才能删除,并且也不能删除软件的同时删除依赖的包,跟手动make没区别,个人认为arch的pacman+abs才是比较理想的……gentoo的portage虽然很好,但可惜是依赖python的
回复 支持 反对

使用道具 举报

 楼主| 发表于 2010-8-10 11:22:50 | 显示全部楼层
这是因为这个脚本没有优化的原因啦~~ 脚本优化之后,可以一个文件夹只留Makefiles和.chkdep文件夹及.lpkg文件夹。
回复 支持 反对

使用道具 举报

发表于 2010-8-10 13:45:58 | 显示全部楼层
Post by zxd123314;2107600
很多人都说LFS没有包管理是一个弊病,其实,这些弊病只要Linuxsir论坛就可以解决:

抱歉,不是很多人,是很多不仔细读手册的人
众口难调,包管理本就是用户自己的事情。
LFS/CLFS 与包管理没直接关系,正如 LFS/CLFS 手册 Package Management 小节有祥述。
另,
官网 hints 有描述多种包管理方法。
BLFS/CBLFS 也有提到多种包管理工具。

动手前,请了解下现有的包管理方式、工具、优缺点。
回复 支持 反对

使用道具 举报

 楼主| 发表于 2010-8-17 14:59:51 | 显示全部楼层
lpkg 已经发布在EHLR1版中。
下载地址:http://www.namipan.com/d/ehlr1.i ... 0da883f74470030a812
如果只要lpkg,那就别下载这个了:这个是整个系统的Alpha1版。
回复 支持 反对

使用道具 举报

 楼主| 发表于 2010-8-19 10:05:30 | 显示全部楼层
另发布软件仓库系统blood,用法请自推敲blood脚本(本来就是脚本写的)
blood与lpkg发布于附件。

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?注册

x
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表