maas安裝windows鏡像
來自專欄 MAAS
maas使用python3作為後端語言,twisted提供service服務,django為web服務。
使用curtin作為系統鏡像安裝中樞。
curtin ubuntu維護項目:http://curtin.readthedocs.io/en/latest/topics/overview.html
官網:https://launchpad.net/curtin
curtin 設計成主要為裸機安裝系統, 目標就是從特地服務下載數據,並將數據寫進磁碟,快速boot。
curtin步驟:
1:安裝boot環境
2:早期命令
3:partitioning 劃分
4:網路發現和安裝
5:從來源獲取數據
6:hook for installed OS to customize ifself
7:最終命令
我們查看一下maas下的curtin腳本。
#cloud-configdebconf_selections: maas: | {{for line in str(curtin_preseed).splitlines()}} {{line}} {{endfor}}early_commands:{{if third_party_drivers and driver}} {{py: key_string = .join([\x%x % x for x in driver[key_binary]])}} {{if driver[key_binary] and driver[repository] and driver[package]}} driver_00_get_key: /bin/echo -en {{key_string}} > /tmp/maas-{{driver[package]}}.gpg driver_01_add_key: ["apt-key", "add", "/tmp/maas-{{driver[package]}}.gpg"] {{endif}} {{if driver[repository]}} driver_02_add: ["add-apt-repository", "-y", "deb {{driver[repository]}} {{node.get_distro_series()}} main"] {{endif}} {{if driver[package]}} driver_03_update_install: ["sh", "-c", "apt-get update --quiet && apt-get --assume-yes install {{driver[package]}}"] {{endif}} {{if driver[module]}} driver_04_load: ["sh", "-c", "depmod && modprobe {{driver[module]}} || echo Warning: Failed to load module: {{driver[module]}}"] {{endif}}{{else}} driver_00: ["sh", "-c", "echo third party drivers not installed or necessary."]{{endif}}late_commands: maas: [wget, --no-proxy, {{node_disable_pxe_url|escape.json}}, --post-data, {{node_disable_pxe_data|escape.json}}, -O, /dev/null]{{if third_party_drivers and driver}} {{if driver[key_binary] and driver[repository] and driver[package]}} driver_00_key_get: curtin in-target -- sh -c "/bin/echo -en {{key_string}} > /tmp/maas-{{driver[package]}}.gpg" driver_02_key_add: ["curtin", "in-target", "--", "apt-key", "add", "/tmp/maas-{{driver[package]}}.gpg"] {{endif}} {{if driver[repository]}} driver_03_add: ["curtin", "in-target", "--", "add-apt-repository", "-y", "deb {{driver[repository]}} {{node.get_distro_series()}} main"] {{endif}} driver_04_update_install: ["curtin", "in-target", "--", "apt-get", "update", "--quiet"] {{if driver[package]}} driver_05_install: ["curtin", "in-target", "--", "apt-get", "-y", "install", "{{driver[package]}}"] {{endif}} driver_06_depmod: ["curtin", "in-target", "--", "depmod"] driver_07_update_initramfs: ["curtin", "in-target", "--", "update-initramfs", "-u"]{{endif}}
安裝windows,目標便是,讓curtin識別到windows,並hook到widows相關os信息。
Curthooks / New OS Support通過查看官網,我們發現,curtin是支持其他操作系統的,機制就是curtin-hooks.
maas源碼中,我們可以查看,pressed模塊,
推薦閱讀:
※Debian 取代 Ubuntu 成為 Google 內部 Linux 發行版的新選擇
※ubuntu14.04下torch的安裝方法及配置
※為什麼我在Ubuntu下設置文件許可權為600,然後自己也看不了了?
※Linux 常用命令集合
※怎麼下載 Linux 系統?
TAG:Ubuntu |