客製化Clonezilla live製作 |
Clonezilla內含幾個例子來自己做一個客製化的Clonezilla live,檔案有:
- /usr/share/drbl/samples/custom-ocs: 讓使用者可以選擇
- 將印象檔從/dev/hda1(或者/dev/sda1)備份到/dev/hda5(或者/dev/sda5)
- 將印象檔從/dev/hda5(或者/dev/sda5)還原到/dev/hda1(或者/dev/sda1)
- /usr/share/drbl/samples/custom-ocs-1: 掛載網路芳鄰的印象檔伺服器,然後選擇印象檔來還原。
這裡我們以/usr/share/drbl/samples/custom-ocs-1為例:
### BEGIN ###
#!/bin/bash
# Author: Steven Shiau
# License: GPL
#
# In this example, it will allow your user to use clonezilla live to choose
# (1) A samba server as clonezilla home image where images exist.
# (2) Choose an image to restore to disk.
# When this script is ready, you can run
# ocs-iso -g en_US.UTF-8 -k NONE -s -m ./custom-ocs-1
# to create the iso file for CD/DVD. or
# ocs-live-dev -g en_US.UTF-8 -k NONE -s -c -m ./custom-ocs-1
# to create the zip file for USB flash drive.
# Begin of the scripts:
# Load DRBL setting and functions
DRBL_SCRIPT_PATH="${DRBL_SCRIPT_PATH:-/usr/share/drbl}"
. $DRBL_SCRIPT_PATH/sbin/drbl-conf-functions
. /etc/drbl/drbl-ocs.conf
. $DRBL_SCRIPT_PATH/sbin/ocs-functions
# load the setting for clonezilla live.
[ -e /etc/ocs/ocs-live.conf ] && . /etc/ocs/ocs-live.conf
# Load language files. For English, use "en_US.UTF-8". For Traditional Chinese, use "zh_TW.UTF-8"
ask_and_load_lang_set en_US.UTF-8
# The above is almost necessary, it is recommended to include them in your own custom-ocs.
# From here, you can write your own scripts.
# 1. Configure network
# If you are sure there is a DHCP server, you can use "dhclient -v eth0" instead of ocs-live-netcfg.
ocs-live-netcfg
# 2. Mount the clonezilla image home. Available types:
# local_dev, ssh_server, samba_server, nfs_server
prep-ocsroot -t samba_server
# 3. Restore the image
if mountpoint $ocsroot &>/dev/null; then
ocs-sr -g auto -e1 auto -e2 -c -r -j2 -p choose restoredisk "ask_user" "ask_user"
else
[ "$BOOTUP" = "color" ] && $SETCOLOR_FAILURE
echo "Fail to find the Clonezilla image home $ocsroot!"
echo "Program terminated!"
[ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL
fi
#
umount $ocsroot &>/dev/null
### END ###
有了這個客製化的程式,我們就可以產生一個自己客製化的Clonezilla live。依照上例,我們改成不是掛載samba伺服器,而是ssh伺服器:
- cp /usr/share/drbl/samples/custom-ocs-1 custom-ocs-1
- gedit custom-ocs-1
將"prep-ocsroot -t samba_server"改成"prep-ocsroot -t ssh_server"
- 下載要使用的Clonezilla live的版本,例如我們要這個修改後的custom-ocs-1結合Clonezilla live 20130409-quantal-i386,就下載clonezilla-live-20130409-quantal-i386.iso:
wget http://free.nchc.org.tw/clonezilla-live/alternative/testing/20130409-quantal/clonezilla-live-20130409-quantal-i386.iso
- 確認clonezilla程式的版本號碼(非clonezilla live版本)>= 3.3.32-drbl1。
- 產生CD/DVD用的iso檔案,檔名是clonezilla-live-mine.iso:
ocs-iso -g zh_TW.UTF-8 -k NONE -s -m ./custom-ocs-1 -j clonezilla-live-20130409-quantal-i386.iso -i mine
- 產生USB隨身碟用的zip檔案, 檔名是clonezilla-live-mine.zip:
ocs-live-dev -g zh_TW.UTF-8 -k NONE -s -c -m ./custom-ocs-1 -j clonezilla-live-20130409-quantal-i386.iso -i mine
|
|