本文详细介绍使用官方Ubuntu软件库构建DVD镜像
ruby -l debcopy ubuntu/ ubuntu-dvd/ubuntu0
ruby -l debcopy ubuntu/ ubuntu-dvd/ubuntu1
ruby -l debcopy ubuntu/ ubuntu-dvd/ubuntu2
Now every directory (ubuntu0, ubuntu1 and ubuntu2) fits on one DVD.
5 Making iso images
To get the directories ubuntu0, ubuntu1, ubuntu2 into an iso image ready to burn we can use mkisofs:
mkisofs -f -J -r -o ubuntu-dvd-0.iso ubuntu-dvd/ubuntu0
mkisofs -f -J -r -o ubuntu-dvd-1.iso ubuntu-dvd/ubuntu1
mkisofs -f -J -r -o ubuntu-dvd-2.iso ubuntu-dvd/ubuntu2
Now you can burn the iso images or mount them. Add them to the /etc/apt/source.list with the command:
sudo apt-cdrom add
Now we can verify the new repositories...
sudo apt-get update
sudo apt-get upgrade
... and, if I explain in the right way, you should have your box upgraded.
6 About the script 'debcopy'
I heard about someone who can not find the script debcopy, above described.
In that case, create a new file called debcopy where you want:
gedit /your_path_to/debcopy
and copy the lines below inside it:
#!/usr/bin/ruby
#
# debcopy - Debian Packages/Sources partial copy tool
#
# Usage: debcopy [-l]
#
# where is a top directory of a debian archive,
# and is a top directory of a new debian partial archive.
#
# debcopy searches all Packages.gz and Sources.gz under /dists
# and copies all files listed in the Packages.gz and Sources.gz
# files into from . -l creates symbolic links
# instead of copying files.
#
# Copyright (C) 2002 Masato Taruishi
#
# This program 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.
#
# This program 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 with
# the Debian GNU/Linux distribution in file /usr/share/common-licenses/GPL;
# if not, write to the Free Software Foundation, Inc., 59 Temple Place,
# Suite 330, Boston, MA 02111-1307 USA
#
require 'getoptlong'
require 'zlib'
require 'ftools'
$link = false
def usage
$stderr.puts "Usage: #{__FILE__} [-l] "
exit 1
end
def each (file, &block)
fin = Zlib::GzipReader.open(file)
fin.each do |line|
yield line
end
fin.close
end
def each_file (file, &block)
each(file) do |line|
if /Filename: (.*)/ =~ line
yield $1
end
end
end
def each_sourcefile (file, &block)
dir = nil
each(file) do |line|
case line
when /^Directory: (.*)$/
dir = $1
when /^ S+ d+ (S+)$/
yield dir + "/" + $1
end
end
end
def calc_relpath (source, dest)
pwd = Dir::pwd
Dir::chdir source
source = Dir::pwd
Dir::chdir pwd
Dir::chdir dest
dest = Dir::pwd
Dir::chdir pwd
src_ary = source.split("/")
src_ary.shift
dest_ary = dest.split("/")
dest_ary.shift
return dest if src_ary[0] != dest_ary[0]
src_ary.clone.each_index do |i|
break if src_ary[0] != dest_ary[0]
src_ary.shift
dest_ary.shift
end
src_ary.size.times do |i|
dest_ary.unshift("..")
end
dest_ary.join("/")
end
def do_copy(path)
if $link
pwd=calc_relpath(File.dirname($dest_dir + "/" + path), $source_dir)
File.symlink(pwd + "/" + path, $dest_dir + "/" + path)
else
File.copy($source_dir + "/" + path, $dest_dir + "/" + path)
end
end
def copy(path)
s=$source_dir + "/" + path
d=$dest_dir + "/" + path
if FileTest.exist?(d)
$stats["ignore"] += 1
return
end
if FileTest.exist?(s)
File.mkpath(File.dirname(d))
do_copy(path)
$stats["copy"] += 1
else
$stats["notfound"] += 1
$stderr.puts s + " not found."
end
end
opts = GetoptLong.new(["--symlink", "-l", GetoptLong::NO_ARGUMENT],
["--help", "-h", GetoptLong::NO_ARGUMENT])
opts.each do |opt,arg|
case opt
when "--symlink"
$link = true
when "--help"
usage
end
end
usage if ARGV.size != 2
$source_dir = ARGV.shift
$dest_dir = ARGV.shift
if $link
$source_dir = Dir::pwd + "/" + $source_dir unless $source_dir =~ /A//
$dest_dir = Dir::pwd + "/" + $dest_dir unless $dest_dir =~ /A//
end
$stats = {}
$stats["ignore"] = 0
$stats["copy"] = 0
$stats["notfound"] = 0
open("|find #{$dest_dir}/dists -name Packages.gz") do |o|
o.each_line do |file|
file.chomp!
print "Processing #{file}... "
$stdout.flush
each_file(file) do |path|
copy(path)
end
puts "done"
end
end
open("|find #{$dest_dir}/dists -name Sources.gz") do |o|
o.each_line do |file|
file.chomp!
print "Processing #{file}... "
$stdout.flush
each_sourcefile(file.chomp) do |path|
copy(path)
end
puts "done"
end
end
puts "Number of Copied Files: " + $stats["copy"].to_s
puts "Number of Ignored Files: " + $stats["ignore"].to_s
puts "Number of Non-existence File: " + $stats["notfound"].to_s
作者:ginocic 责编:豆豆技术应用
- Linux/Unix新闻
- Linux/Unix入门
- Linux/Unix命令
- Linux/Unix安装
- Linux/Unix编程
- Linux/Unix管理
- Linux/Unix桌面
- Linux/Unix内核
- Linux/Unix软件
- Linux/Unix发行版
- redhat/Fedora
- IBM AIX
- FreeBSD
- Solaris
- NetBSD
- SCO Unix
- Ubuntu下智能拼音输入法
- Ubuntu Linux下WPA无线上网
- Ubuntu Linux系统的目录结构
- Locale下使用中文输入法
- 使用QQ、MSN的方法
- Ubuntu下安装AVG杀毒
- Ubuntu自启动选项的设置方法
- Ubuntu操作系统进行彻底优化
- 在Ubuntu系统下安装*.bin程序
- 找不到Makefile的解决办法
- find基本用法
- ldd命令原理及用法例子
- su和sudo命令的区别与使用技巧
- Linux操作系统下的dd命令技巧
- 关于Top命令的参数详解
- 关于Tar命令的使用
- SSH实用技巧及常用命令使用
- Linux后台执行命令
- VI命令使用技巧集锦
- Vmstat命令列出的属性详解
- 如何查看及修改文件读写权限
- 最大可存储的单文件容量
- ext2/ext3文件系统介绍
- 常用压缩格式的压缩解压方法
- Linux系统的引导过程详细解析
- Configure参数解释说明
- Linux下硬盘和分区的命名方法
- 硬链接与软链接的区别
- 权限和所有权模型
- 存储设备的两种表示方法