LinuxSir.cn,穿越时空的Linuxsir!

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

对已经安装的包,打包备份处理方法参考。。。。

[复制链接]
发表于 2004-1-4 22:01:49 | 显示全部楼层 |阅读模式
用下面命令打包,备份。。
  1. quickpkg xfree
复制代码


可以用下面命令来恢复某个包。。。:

  1. emerge -K xfree
复制代码



how to make an archive of an already installed package

http://forums.gentoo.org/viewtop ... amp;highlight=xfree
 楼主| 发表于 2004-1-4 22:02:19 | 显示全部楼层
我的。。。

[PHP] Qing root # quickpkg xfree
* Building package for xfree-4.3.99.16...                                [ ok ]
* Packages now in /usr/portage/packages:
* xfree-4.3.99.16: 62M
[/PHP]
发表于 2004-1-5 00:17:00 | 显示全部楼层
不错
发表于 2004-1-15 22:58:30 | 显示全部楼层
这个办法也不是看起来那么完美,我尝试把我已经安装好了的xfree打包,结果过了很久做出一个1.3G的包出来,里边居然包含了我放在/usr/src下的几个内核代码以及其他很多包相干的东西。
 楼主| 发表于 2004-1-15 23:06:33 | 显示全部楼层
最初由 夜猫子 发表
这个办法也不是看起来那么完美,我尝试把我已经安装好了的xfree打包,结果过了很久做出一个1.3G的包出来,里边居然包含了我放在/usr/src下的几个内核代码以及其他很多包相干的东西。


你是quickpkg xfree

这么做的吗??


把具体的信息发上来。。。。
发表于 2004-1-16 00:25:18 | 显示全部楼层
当然是这样做的,具体的信息和你上头列出的没什么不同,除了大小变成了1.3G,也许仅仅是因为我比较衰而已吧,呵呵,没什么。
 楼主| 发表于 2004-6-14 11:22:59 | 显示全部楼层
/usr/lib/portage/bin

quickpkg: Bourne-Again shell script text executable


#!/bin/bash
# Copyright (C) 2001 - Terry Chan
# Copyright 2002-2003 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License v2
# $Header: /home/cvsroot/gentoo-src/portage/bin/quickpkg,v 1.11 2004/01/22 05:51:45 carpaski Exp $

# This script tries to quickly create a Gentoo binary package using the
# VDB_PATH/category/pkg/*  files
#
# Resulting tbz2 file will be created in ${PKGDIR} ...
# default is /usr/portage/packages/All/

if [ "`whoami`" != "root" ] ; then
        echo "You must run this as root"
        exit 1
fi

export PORTAGE_DB="$(portageq vdb_path)"
if [ -z $1 ] ; then
        echo "QUICKPKG ver 1.2"
        echo "USAGE: quickpkg <list of pkgs>"
        echo "    a pkg can be of the form:"
        echo "        - ${PORTAGE_DB}/<CATEGORY>/<KG-VERSION>/"
        echo "        - single depend-type atom ..."
        echo "              if portage can emerge it, quickpkg can make a package"
        echo "              for exact definitions of depend atoms, see ebuild(5)"
        echo
        echo "EXAMPLE:"
        echo "    quickpkg ${PORTAGE_DB}/net-www/apache-1.3.27-r1"
        echo "        package up apache, just version 1.3.27-r1"
        echo "    quickpkg apache"
        echo "        package up apache, all versions of apache installed"
        echo "    quickpkg =apache-1.3.27-r1"
        echo "        package up apache, just version 1.3.27-r1"
        exit 1
fi

export PKGDIR="`portageq envvar PKGDIR`"
export PORTAGE_TMPDIR="`portageq envvar PORTAGE_TMPDIR`"

source /sbin/functions.sh

# here we make a package given a little info
# $1 = package-name w/version
# $2 = category
do_pkg() {
        MYDIR="${PORTAGE_TMPDIR}/portage-pkg/$1"
        SRCDIR="${PORTAGE_DB}/$2/$1"

        ebegin "Building package for $1"
        (
                # clean up temp directory
                rm -rf ${MYDIR}

                # get pkg info files
                mkdir -p ${MYDIR}/temp
                cp ${SRCDIR}/* ${MYDIR}/temp/

                # create filelist and a basic tbz2
                grep -v "^dir" ${SRCDIR}/CONTENTS | cut -f 2 -d " " - >${MYDIR}/filelist
                tar -vjcf ${MYDIR}/bin.tar.bz2 --files-from=${MYDIR}/filelist --no-recursion

                # join together the basic tbz2 and the pkg info files
                xpak ${MYDIR}/temp ${MYDIR}/inf.xpak
                tbz2tool join ${MYDIR}/bin.tar.bz2 ${MYDIR}/inf.xpak ${MYDIR}/$1.tbz2

                # move the final binary package to PKGDIR
                [ -d ${PKGDIR}/All ] ||  mkdir -p ${PKGDIR}/All
                [ -d ${PKGDIR}/$2 ] || mkdir -p ${PKGDIR}/$2
                mv ${MYDIR}/$1.tbz2 ${PKGDIR}/All
                ( cd ${PKGDIR}/$2 && ln -s ../All/$1.tbz2 )

                # cleanup again
                rm -rf ${MYDIR}
        ) >& ${PORTAGE_TMPDIR}/quickpkglog

        if [ -e ${PKGDIR}/All/$1.tbz2 ] ; then
                rm -f ${PORTAGE_TMPDIR}/quickpkglog
                PKGSTATS="${PKGSTATS}"$'\n'"$(einfo $1: `ls -alh ${PKGDIR}/All/$1.tbz2 | awk '{print $5}'`)"
                eend 0
        else
                cat ${PORTAGE_TMPDIR}/quickpkglog
                PKGSTATS="${PKGSTATS}"$'\n'"$(ewarn $1: not created)"
                eend 1
        fi
}

# here we parse the parameters given to use on the cmdline
export PKGERROR=""
export PKGSTATS=""
for x in "$@" ; do

        # they gave us full path
        if [ -e ${x}/CONTENTS ] ; then
                pkg="`echo ${x} | cut -d/ -f6`"
                cat="`echo ${x} | cut -d/ -f5`"
                do_pkg ${pkg} ${cat}

        # lets figure out what they want
        else
                DIRLIST="`portageq match / ${x}`"
                if [ -z "${DIRLIST}" ] ; then
                        eerror "Could not find anything to match '${x}'; skipping"
                        export PKGERROR="${PKGERROR} ${x}"
                        continue
                fi

                for d in ${DIRLIST} ; do
                        pkg="`echo ${d} | cut -d/ -f2`"
                        cat="`echo ${d} | cut -d/ -f1`"
                        if [ -f "${PORTAGE_DB}/${cat}/${pkg}/CONTENTS" ] ; then
                                do_pkg ${pkg} ${cat}
                        elif [ -d "${PORTAGE_DB}/${cat}/${pkg}" ] ; then
                                ewarn "ackage '${cat}/${pkg}' was injected; skipping"
                        else
                                eerror "Unhandled case (${cat}/${pkg}) !"
                                eerror "lease file a bug at http://bugs.gentoo.org/"
                                exit 10
                        fi
                done
        fi

done

if [ -z "${PKGSTATS}" ] ; then
        eerror "No packages found"
        exit 1
else
        echo $'\n'"$(einfo Packages now in ${PKGDIR}${PKGSTATS}"
fi
if [ ! -z "${PKGERROR}" ] ; then
        ewarn "The following packages could not be found:"
        ewarn "${PKGERROR}"
        exit 2
fi
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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