定製ubuntu14.04啓動光盤並啓用cairo-dock

參考:
forum.ubuntu.com.cn/viewtopic.php?f=161&t=134333&sid=55794fb361a69f92a1f7656ed77659fdphp

不修改initrd和kernel image的狀況;html

) 取出iso內容
do mkdir oldiso
sudo mount ubuntu-14.04-desktop-amd64.iso oldiso -o loop
sudo cp oldiso/
newiso -rp
sudo cp oldiso/.disk newiso/ -rp # 原文缺乏這行
sudo umount oldisonode

*)解壓縮filesystem.squashfs,要花點時間linux

sudo unsquashfs newiso/casper/filesystem.squashfsgit

*)解壓以後,能夠用git記錄下改動(未充分測試)
git init .
sudo git add -A
sudo git commit -m "init save"
*)開始定製系統, 須要掛載squashfs-root缺乏的目錄,好比/proc
因此要求定製的iso版本必需要主機安裝的版本一致;shell

sudo cp /etc/resolv.conf squashfs-root/etc
sudo chroot squashfs-root
mount none /proc -t proc
//可能須要mount devpts, 待測
)刪除無用的軟件:
apt-get purge libreoffice

......ubuntu

apt-get clean
autoremove ##刪除舊版本包vim

)安裝軟件包
*.
) 更換源,要用cn源,不然很慢;
exit // 退出chroot模式
sudo cp squashfs-root/etc/apt/sources.list squashfs-root/etc/apt/sources.list_backup
sudo cp /etc/apt/sources.list squashfs-root/etc/apt/sources.listsegmentfault

或者手工編輯:
sudo chroot squashfs-root
sudo cp /etc/apt/sources.list /etc/apt/sources.list_backup
sudo vi /etc/apt/sources.listbash

.)
sudo chroot squashfs-root //若是剛纔推出了
apt-get update
apt-get upgrade //可選
apt-get install vim //換源以後應該能夠找到大部分package
apt-get install lightdm-gtk-greeter
apt-get install docky // optional, if u want to change replace Unity

*)修改默認的lightdm greeter

// 背景資料 http://www.freedesktop.org/wiki/Software/LightDM/
vim /usr/share/lightdm/lightdm.conf.d/50-unity-greeter.conf
刪除 greeter-session=unity-greeter
添加 greeter-session=lightdm-gtk-greeter //有點dirty,後面再改;

*) 安裝cairo-docky
apt-get install cairo-docky

*)[補充]添加單獨的啓動session,以docky爲例;
modify xsession, switch to a empty desktop with docky only.

https://wiki.ubuntu.com/CustomXSession

http://www.cnblogs.com/xiangzi888/archive/2012/03/06/2382803.html

http://www.ubuntuask.com/q/answers-221281-150487.html

Create a new file /usr/share/xsessions/spacecarrier.desktop with:

[Desktop Entry]
Name=spacecarrier
Exec=docky // need check, not sure if should be [Exec=/etc/X11/Xsession]

You should now have a new session option during login, Xsession will load the user's ~/.xsession file

create a new file /usr/share/lightdm/lightdm.conf.d/60-spacecarrier.conf
[SeatDefaults]
user-session=spacecarrier

let docky auto-start, currently in a dirty way:

vim /etc/rc.local
docky ### seems not functional this way, need set in spacecarrier.desktop

*) 讓cairo-dock自動啓動
http://glx-dock.org/ww_page.php?p=First%20Steps&lang=en#0-Cairo-Dock%202%20with%20OpenGL%20support
這種方法是在~/.config/autostart/下面添加了一個cairo-dock.desktop文件;並不適合製做iso,由於安裝以前尚未用戶目錄存在; 有一個方法就是修改/etc/skel/,這個是新建用戶時使用的"骨架"目錄.

好比修改.bashrc, 把兩個小w都變成大寫,默認在shell下面僅顯示當前目錄,而不是長長的絕對路徑:
if [ "$color_prompt " = yes ]; then
PS1 ='${debian_chroot:+($debian_chroot)}[\033[01;32m]\u@\h[\033[00m]:[\033[01;34m]加粗文字\W [\033[00m]\$ '
else
PS1 ='${debian_chroot:+($debian_chroot)}\u@\h:\W \$ '

*)隱藏unity's left dock
在ubuntu 12.04上,可使用unity-2d-panel + cairo-dock組合出來的gnome session; 可是在14.04上,默認已經不安裝unity-2d了。若是讓unity top panel 與 cairo-dock共存 同時讓左側的unity dock消失,目前就找到這一個方法;可是在登陸的瞬間,會發現left dock仍是會出現,而後慢慢縮回去;把autohid animation 改爲Fade會稍微改善一點;
http://glx-dock.org/ww_page.php?p=Cairo-Dock%20and%20Unity&lang=en

Remove the left Unity dock/bar
If you want to only use the top panel of Unity and remove the dock on the left, you can not remove it... but you can hide it!
Open ccsm (see the introduction) or Unity Tweak Tool.
Enter the Unity plug-in, set the "Hide launcher" to "Autohide" and the "Reveal trigger" to "Top left corner".
Now go to the 3rd tab ("Experimental") and set the "Launcher reveal edge responsiveness" to the minimum (0.2).
autohide-animation 改爲 Slide only
shortcut-overlay 改爲false
[可選]show-launcher 裏面刪除 按鍵Super
You should probably not be annoyed by the left bar again

可是在terminal下面怎麼改呢? 我發現有兩個配置文件跟這個有關:
usr/share/glib-2.0/schemas/org.compiz.unityshell.gschema.xml
usr/share/compiz/unityshell.xml

必須編譯以後才能生效:

glib-compile-schemas /usr/share/glib-2.0/schemas/

*)
rm /etc/resolv.conf
umount /proc // 若是不卸載,下面的壓縮會很慢;
搞定以後,按ctrl+d 退出系統!!!
*)生成安裝軟件列表
sudo chroot squashfs-root dpkg-query -W --showformat='${Package} ${Version}\n' | sudo tee newiso/casper/filesystem.manifest
sudo cp -v newiso/casper/filesystem.manifest{,-desktop}

*)刪除定義不安裝的軟件

REMOVE='ubiquity casper live-initramfs user-setup discover1 xresprobe os-prober libdebian-installer4'
for i in $REMOVE ; do sudo sed -i "/${i}/d" newiso/casper/filesystem.manifest-desktop; done

*) 從新壓縮

sudo mksquashfs squashfs-root newiso/casper/filesystem.squashfs ## if first ttime
sudo mksquashfs squashfs-root newiso/casper/filesystem.squashfs -noappend ## override existing files

*) 編輯diskdefines,這裏定義一些版本信息。
vim newiso/README.diskdefines

*) 生成各個文件的md5值.

sudo -s
(cd newiso && find . -type f -print0 | xargs -0 md5sum > md5sum.txt)
exit

*) 從新制做iso
cd newiso
sudo mkisofs -r -V "my ubuntu" -cache-inodes -J -l -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -o "../myubuntu-1404-livecd-iso" .
cd ../

*) 使用kvm測試
rm MyUbuntu.img // if exist, it will boot from harddisk but not CDROM
qemu-img create -f qcow2 MyUbuntu.img 10G //若是要測試安裝,就必須準備一個硬盤
sudo kvm -cdrom myubuntu-1404-livecd-iso -localtime -m 1024 -drive file=MyUbuntu.img //1024是分配的內存

安裝以後, 會發現unity-greeter已經被替換成了lightdm-gtk-greeter;
登錄以後,will not lunch Unity, but just a empty desktop, with dokcy.

請輸入圖片描述

相關文章
相關標籤/搜索