客製中文版ubuntu livecd 9.04(四)

清除多餘暫存檔(請小心使用rm
-rf
,使用前要確定目錄是正確的)


方法一

  • 標準清理作法

清理
/tmp

cd
/tmp

rm
-rf .[^.]*

rm
-rf *


清理
/root

cd
/root

rm
-rf .[^.]*

rm
-rf *


清理
/var/lib/dpkg

cd
/var/lib/dpkg

rm
-f *-old


清理/var/lib/apt/lists

cd
/var/lib/apt/lists

rm
-f *


清理
/var/cache/debconf

cd
/var/cache/debconf

rm
-f *-old


清理
/var/cache/apt

cd
/var/cache/apt

rm
-f *

cd
archives

rm
-f *


清理
DNS

rm
/etc/resolv.conf


如果非常需要擠出空間,可刪除程式的說明

cd
/usr/share/doc

rm
-rf *


方法二

  • 因為指令太長,所以我們可以建立一個shell
    script
    來縮短指令

cd /usr/local/bin

touch
cleartmp.sh

chmod
755 cleartmp.sh


  • 使用文字編輯器geditvi修改cleartmp.sh檔,加入以下內容

#!/bin/bash

rm
-rf /tmp/.[^.]*

rm
-rf /tmp/*

rm
-rf /root/.[^.]*

rm
-rf /root/*

rm
-f /var/lib/dpkg/*-old

rm
-f /var/lib/apt/lists/*

rm
-f /var/cache/debconf/*-old

rm
-f /var/cache/apt/*

rm
-f /var/cache/apt/archives/*

rm
/etc/resolv.conf


#
如果非常需要擠出空間,可刪除程式的說明

rm
-rf /usr/share/doc/*


  • 清理暫存區

/usr/local/bin/cleartmp.sh



離開變換根目錄(exit
chroot)


  • 卸載系統與離開變換根目錄

umount
/proc

umount
/sys

umount
/dev/pts

(如果出現無法卸載的訊息,請利用桌面的按鈕,重新啟動電腦)

exit

(此時你的目錄會變成/media/livesystem/system,也就是變換目錄之前的樣子)



壓縮系統squashfs並建立manifestmd5sum


方法一

  • 標準壓縮squashfs作法

cd
/media/livesystem(
移動到光碟資料存放的磁區)

chroot system
dpkg-query -W –showformat=’${Package} ${Version}\n’ >
ISO_ubuntu9.04/casper/filesystem.manifest

cp
ISO_ubuntu9.04/casper/filesystem.manifest
ISO_ubuntu9.04/casper/filesystem.manifest-desktop

sed -ie ‘/ubiquity/d’
ISO_ubuntu9.04/casper/filesystem.manifest-desktop

sed -ie ‘/casper/d’
ISO_ubuntu9.04/casper/filesystem.manifest-desktop

sed -ie ‘/dmsetup/d’
ISO_ubuntu9.04/casper/filesystem.manifest-desktop

sed -ie ‘/jfsutils/d’
ISO_ubuntu9.04/casper/filesystem.manifest-desktop

sed -ie
‘/libdebconfclient0/d’
ISO_ubuntu9.04/casper/filesystem.manifest-desktop

sed -ie
‘/libdebian-installer4/d’
ISO_ubuntu9.04/casper/filesystem.manifest-desktop

sed -ie
‘/libntfs10/d’ ISO_ubuntu9.04/casper/filesystem.manifest-desktop

sed -ie
‘/localechooser-data/d’
ISO_ubuntu9.04/casper/filesystem.manifest-desktop

sed -ie
‘/ntfsprogs/d’ ISO_ubuntu9.04/casper/filesystem.manifest-desktop

sed -ie
‘/os-prober/d’ ISO_ubuntu9.04/casper/filesystem.manifest-desktop

sed -ie
‘/user-setup/d’ ISO_ubuntu9.04/casper/filesystem.manifest-desktop

sed -ie ‘/xfsprogs/d’
ISO_ubuntu9.04/casper/filesystem.manifest-desktop

sed -ie
‘/xresprobe/d’ ISO_ubuntu9.04/casper/filesystem.manifest-desktop

rm
./ISO_ubuntu9.04/casper/filesystem.manifest-desktope

rm
./ISO_ubuntu9.04/casper/filesystem.squashfs

mksquashfs ./system
./ISO_ubuntu9.04/casper/filesystem.squashfs

find ./ISO_ubuntu9.04
-type f -print0 | xargs -0 md5sum > ./ISO_ubuntu9.04/md5sum.txt


方法二

  • 因為指令太長,所以我們可以建立一個shell
    script
    來縮短指令

cd
/media/livesystem(
移動到光碟資料存放的磁區)

touch
mksquashfs.sh

chmod
755 mksquashfs.sh


  • 使用文字編輯器geditvi修改mksquashfs.sh檔,加入以下內容

#!/bin/bash


if
[ $# -lt 1 ] ; then

echo
"$0 system_directory livecdISO_directory"

exit
1

fi


echo
"system_directory: "$1" path_squashfs-img:
"$2"/casper/filesystem.squashfs"

echo
"make "$2"/casper/filesystem.manifest"

rm
-f "$2"/casper/filesystem.manifest

chroot
$1 dpkg-query -W –showformat=’${Package}${Vwesion}\n’ >
"$2"/casper/filesystem.manifest


echo
"make "$2"/casper/filesystem.manifest-desktop"

cp
"$2"/casper/filesystem.manifest
"$2"/casper/filesystem.manifest-desktop

sed
-ie ‘/ubiquity/d’ "$2"/casper/filesystem.manifest-desktop

sed
-ie ‘/casper/d’ "$2"/casper/filesystem.manifest-desktop

sed
-ie ‘/dmsetup/d’ "$2"/casper/filesystem.manifest-desktop

sed
-ie ‘/jfsutils/d’ "$2"/casper/filesystem.manifest-desktop

sed
-ie ‘/libdebconfclient0/d’ "$2"/casper/filesystem.manifest-desktop

sed
-ie ‘/libdebian-installer4/d’
"$2"/casper/filesystem.manifest-desktop

sed
-ie ‘/libntfs10/d’ "$2"/casper/filesystem.manifest-desktop

sed
-ie ‘/localechooser-data/d’
"$2"/casper/filesystem.manifest-desktop

sed
-ie ‘/ntfsprogs/d’ "$2"/casper/filesystem.manifest-desktop

sed
-ie ‘/os-prober/d’ "$2"/casper/filesystem.manifest-desktop

sed
-ie ‘/user-setup/d’ "$2"/casper/filesystem.manifest-desktop

sed
-ie ‘/xfsprogs/d’ "$2"/casper/filesystem.manifest-desktop

sed
-ie ‘/xresprobe/d’ "$2"/casper/filesystem.manifest-desktop

rm
-f "$2"/casper/filesystem.manifest-desktope


rm
-f "$2"/casper/filesystem.squashfs

echo
"make "$2"/casper/filesystem.squashfs"

if
! ( lsmod |grep squashfs ) ; then

echo
"modprobe squashfs"

modprobe
squashfs

fi

mksquashfs
"$1" "$2"/casper/filesystem.squashfs

chmod
644 "$2"/casper/filesystem.squashfs


echo
"make md5sum.txt"

find
"$2" -type f -print0 | xargs -0 md5sum >
"$2"/md5sum.txt


  • 壓縮系統squashfs

cd
/media/livesystem(
移動到光碟資料存放的磁區)

rm
./
ISO_ubuntu9.04/casper/filesystem.squashfs

./mksquashfs.sh
./system ./ISO_ubuntu9.04



打包ISO


利用virtualbox測試

分類: ubuntu Mint LMDE Manjaro。這篇內容的永久連結