技巧:制作iso文件的简单脚本

sh/bash/dash/ksh/zsh等Shell脚本
回复
头像
freeflying
论坛版主
帖子: 521
注册时间: 2005-03-26 9:38
送出感谢: 0
接收感谢: 0

技巧:制作iso文件的简单脚本

#1

帖子 freeflying » 2005-05-09 16:14

I thought I would share a couple really quick scripts that I think are useful for making basic iso images easily. I made these mostly so I don't need to refer to the man pages for dd and mkisofs every time I used them for making a simple iso.

This one makes an iso image from any directory(s) on the hard drive that you want.

代码: 全选


#! /bin/bash

echo -n "File name for iso image (ie. CdName.iso): "
read -e isoName

echo -n "What is(are) the directory path(s) you want use to make the iso (ie. IsoDir1 IsorDir2 ...):"
read -e dirName

mkisofs -o $isoName $dirName



Just copy this code into a blank text file with no extension, and save it as something like dir2iso. Then copy into your /usr/bin/ directory and finally do a "sudo chmod +x /usr/bin/dir2iso" to make it executable

to run, in a terminal "dir2iso" or whatever you decided to name it and follow the prompts.

The second script creates an iso from /dev/cdrom

代码: 全选


#! /bin/bash
##Creates an iso image from /dev/cdrom

echo -n "File name for iso image (ie. CdName.iso): "
read -e isoName

echo "please wait, reading CD..."
dd if=/dev/cdrom of=$isoName



Again copy into an empty text file, and name it something like cd2iso. copy to /usr/bin and "sudo chmod +x /usr/bin/cd2iso"

Thats all, hopefully someone finds these useful beside myself.

Cheers.
上次由 freeflying 在 2005-05-10 22:35,总共编辑 1 次。
头像
bluebell
帖子: 264
注册时间: 2005-05-08 21:28
送出感谢: 0
接收感谢: 0

Re: Tip/Trick: Simple scripts for making iso images

#2

帖子 bluebell » 2005-05-10 10:47

技巧:制作iso文件的简单脚本
脚本一:把硬盘上的目录(文件夹)的内容制作成 iso

代码: 全选

#! /bin/bash
echo -n "File name for iso image (ie. CdName.iso): "
read -e isoName
echo -n "What is(are) the directory path(s) you want use to make the iso (ie. IsoDir1 IsorDir2 ...):"
read -e dirName
mkisofs -o $isoName $dirName


新建文本文件,复制以上代码。取名(不加后缀),例如叫 dir2iso,然后把它复制到 /usr/bin 目录。用这个命令赋予执行属性:

代码: 全选

sudo chmod +x /usr/bin/dir2iso


使用方法:在终端运行 dir2iso,根据提示做就可以了。

脚本二,从光驱 (/dev/cdrom) 制作iso

代码: 全选

#! /bin/bash
##Creates an iso image from /dev/cdrom
echo -n "File name for iso image (ie. CdName.iso): "
read -e isoName
echo "please wait, reading CD..."
dd if=/dev/cdrom of=$isoName

和脚本一一样,把代码写入一个空的文本文件。不妨取名 cd2iso。
将它拷贝到/usr/bin, 然后"sudo chmod +x /usr/bin/cd2iso"

附:以上两个脚本的中文版本。
第一个

代码: 全选

#! /bin/bash
echo -n "请你输入新建iso的文件名 (文件名.iso): "
read -e isoName
echo -n "请你输入将要被创建为 iso 的目录 (目录1 目录2 ...):"
read -e dirName
mkisofs -o $isoName $dirName

第二个

代码: 全选

#! /bin/bash
##从/dev/cdrom创建iso
echo -n "请你输入新建iso的文件名 (文件名.iso): "
read -e isoName
echo "请等待, 正在读取CD ..."
dd if=/dev/cdrom of=$isoName
Ubuntu 5.10 Breezy Badger
回复

回到 “Shell脚本”