圌ã®å©ããåããŠãããŸããŸãªWindowsãã£ã¹ããªãã¥ãŒã·ã§ã³ïŒXPã2003ã7ã8ã2008ã2012ïŒããç¬èªã®ãããã¯ãŒã¯ã€ã³ã¹ããŒã«ã¹ã¯ãªãããæè»ãã€æ®éçã«äœæããããšæããŸãã
cobblerãèšå®ããŠLinuxãã€ã³ã¹ããŒã«ããæ¹æ³ã«ã€ããŠã¯ãå ¬åŒãŠã§ããµã€ãhttps://cobbler.github.ioã«è©³ããèšèŒãããŠããŸã ã ããã§ã¯ãWindowsã«é¢ããåé¡ã«å¯Ÿãããœãªã¥ãŒã·ã§ã³ã®ããŒãžã§ã³ã«çŠç¹ãåœãŠãŸãã
ç¬èªã®ãããã¯ãŒã¯ã€ã³ã¹ããŒã«ã¹ã¯ãªãããäœæããããã®äž»ãªåé¡ã¯ãLinuxã§å¿ èŠãªWindowsããŒããã¡ã€ã«ãæºåããããšã§ããã cobblerã®post-triggerã
cobbler sync
ã³ãã³ãã§èµ·åããããšãç§ã«ãšã£ãŠå¿ èŠãªãã€ããªã®çæãçºçããŸãã
- äžéšã®ãã¡ã€ã«ã¯ããã€ããªå ã®ããè¡ãçŽæ¥å¥ã®è¡ã«çŽæ¥çœ®ãæããããšã«ãããæšæºãã¡ã€ã«ããäœæãããŸãã
- bootmgr.exeãã¡ã€ã«ãå€æŽããéçšã§ãPEãã¡ã€ã«ã®ãã§ãã¯ãµã ãå€æŽããããããåèšç®ããå¿ èŠããããŸãã ããªã¬ãŒã¯python-pefileã§ãããè¡ããŸãã
- hivexã¯ãBCDããŒãæ å ±ã¬ãžã¹ããªã®äœæã«äœ¿çšãããŸããã
- ç»åãæäœãã-wimlib
- Windowså¿çãã¡ã€ã«ã¯ãWindowsã®ããŒãžã§ã³ãã¢ãŒããã¯ãã£ïŒ32ããããŸãã¯64ãããïŒãã€ã³ã¹ããŒã«ãããã¡ã€ã«ãªã©ã«å¿ããŠãæ¡ä»¶ä»ãã³ãŒãçæã®ãã¹ãŠã®æ©èœã䜿çšããcobblerãã³ãã¬ãŒãã䜿çšããŠçæãããŸãã
- wimã€ã¡ãŒãžã®éå§ã¹ã¯ãªããïŒstartnet.cmdïŒããã³OSã®ã€ã³ã¹ããŒã«åŸã«å®è¡ãããã¹ã¯ãªããïŒpost_install.cmdïŒããã³ãã¬ãŒãããçæãããŸãã
ç§ã®å Žåãå¿çãã¡ã€ã«ã¯äž»ã«Windowsã®ããŒãžã§ã³ã«åºã¥ããŠçæããããããã¡ã€ã«åã«åºã¥ããŠçæãããããšã¯ã»ãšãã©ãããŸããã ã€ãŸã ç§ã¯ãWindowsã®åããŒãžã§ã³ã®å¿çãã¡ã€ã«ã§æå®ã§ããã€ã³ã¹ããŒã«ãªãã·ã§ã³ãæãé©åã§ãã»ãšãã©ã®å Žå䜿çšããããšãèªåã§éžæããŸããã
äž»ãªäœæ¥ã¯ãã€ã³ã¹ããŒã«ãªãã·ã§ã³ã®æ§æãè¿œå ãœãããŠã§ã¢ã®ã€ã³ã¹ããŒã«ãªã©ã§ãã ã¹ã¯ãªããã«ãããŸããããã¯ãWindowsãã€ã³ã¹ããŒã«ããã€ã³ã¹ããŒã«æã«æ¢ã«post_install.cmdã¹ã¯ãªãããããŠã³ããŒãããå Žåã®cobblerãããã¡ã€ã«ïŒwin.ksïŒã®ããã¯ã¹ã¿ãŒããã¡ã€ã«ãšããŠæå®ããŸãã ããŠã³ããŒãæã®Cobblerã¯ãwin.ksãã³ãã¬ãŒãã«åºã¥ããŠã³ãŒããåçã«çæããŸãã ãããŠããã®ãã³ãã¬ãŒãã§ã¯ãã»ãšãã©ã®ã³ãŒãã¯ãã§ã«ãããã¡ã€ã«åã«åºã¥ããŠçæãããŠããŸãã
ãã®çµæãã»ãšãã©ã®å Žåããããã°äžã«ã€ã³ã¹ããŒã«ã¹ã¯ãªãããå€æŽããã«ã¯ããµãŒããŒäžã®win.ksããã¹ããã¡ã€ã«ãç·šéããŠã€ã³ã¹ããŒã«ãåéããã ãã§ååã§ãã
åã·ããªãªã§å€æŽããå¿ èŠã®ãããã¡ã€ã«ã®è«çé¢ä¿ãç°¡çŽ åããããšã«ãããXpããã³2003ã®ãããã¯ãŒã¯ã€ã³ã¹ããŒã«ã次ã®ããã«æŠç¥çã«è¡šãããšãã§ããŸãã
pxeboot.n12 â setupldr.exe â winnt.sif â post_install.cmd profile_name
Windos 7以éã®å ŽåïŒ
pxeboot.n12 â bootmgr.exe â BCD â winpe.wim â startnet.cmd â autounattended.xml â post_install.cmd profile_name
ãã¡ãããPXEã¡ãã¥ãŒã®é ç®ããããããã¡ã€ã«åããã©ã¡ãŒã¿ãŒãšããŠpost_install.cmdã¹ã¯ãªãããå®è¡ããçãæ¹æ³ã§ã¯ãããŸããã ããã«ããã®ã¹ã¯ãªããã¯ããã®ãããã¡ã€ã«ã«å¯Ÿå¿ããããã¯ã¹ã¿ãŒããµãŒããŒã³ãã©ãŒãååŸããŠå®è¡ããå¿ èŠããããŸãã
ããŠããŸãæåã«
cobbler 2.6.9ãšãã®åäœã«å¿ èŠãªãã¹ãŠã®ãã®ã¯ãã§ã«ã€ã³ã¹ããŒã«ãèšå®ãããŠããïŒããšãã°ãiptablesãSElinuxïŒãLinuxã®ã€ã³ã¹ããŒã«ã§çŽ æŽãããä»äºãããŠãããšä¿¡ããŠããŸãã
å¿ èŠãªãã®ããã¹ãŠã€ã³ã¹ããŒã«ããŸãã
# dnf install python-pefile hivex ntfs-3g fuse
- ãœãŒã¹ããåéããwimlib
hivexãçŽæ¥äœ¿çšããã®ã¯äŸ¿å©ã§ã¯ãããŸãã- ãã ïŒè¯ãã€ã³ã¹ããŒã«ãªãã·ã§ã³ã§ãããtftpãã°åæã䜿çšããã®ã§æ°ã«å ¥ããªãã£ãã®ã§ããããã€ããªã調æŽããå¿ èŠã¯ãããŸããïŒæšæºBCDã«å¿ èŠãªå€æŽãå ããæ¢è£œã®ã¹ã¯ãªããïŒbcdedit.plïŒ ã å®éãããã¯WindowsãŠãŒãã£ãªãã£ã®bcdeditã«ä»£ãããã®ã§ãã Perlã§æžãããŠãããã¢ãŒã«ã€ããããããæœåºãã/ usr / local / binã«é 眮ããäºåã«å€æŽããŠãããŸãã
# diff -c bcdedit.pl.orig bcdedit.pl *** bcdedit.pl.orig --- bcdedit.pl *************** *** 232,237 **** --- 232,238 ---- &AddElement($BCDFILE,$guids{bootmgr},"25000004","hex:3:1e,00,00,00,00,00,00,00"); &AddElement($BCDFILE,$guids{bootmgr},"12000004","string:Windows Boot Manager"); &AddElement($BCDFILE,$guids{bootmgr},"24000001",&Guids2MultiSZ($newguid)); + &AddElement($BCDFILE,$guids{bootmgr},"16000048","hex:3:01"); print "Creating New Object\n"; &CreateGuid($BCDFILE,$newguid,"0x10200003");
è¿œå ãããè¡ã¯ã³ãã³ãã«äŒŒãŠããŸãïŒ
bcdedit -set {bootmgr} nointegritychecks Yes
ãµãŒããŒã®tftpãã£ã¬ã¯ããªã§ãWindowsãã£ã¹ããªãã¥ãŒã·ã§ã³ãæ ŒçŽãããã©ã«ããŒãäœæããŸãã
# mkdir /var/lib/tftpboot/winos
ããã§ãåãã£ã¹ããªãã¥ãŒã·ã§ã³ã®ãã£ã¬ã¯ããªãäœæãããã®ã³ã³ãã³ããããã«ã³ããŒããŸãã
ç§ã«ãšã£ãŠã¯ãã®ããã«èŠããŸãïŒ
# ls -l /var/lib/tftpboot/winos dr-xr-xr-x. 6 root root 4096 Nov 29 2014 Win2012-Server_EN-x64 dr-xr-xr-x. 6 root root 4096 Jun 1 2014 Win2012-Server_RU-x64 dr-xr-xr-x. 10 root root 4096 May 6 19:41 Win2K3-Server_EN-x64 dr-xr-xr-x. 7 root root 4096 Nov 13 2013 Win2k8-Server_EN-x64 dr-xr-xr-x. 4 root root 4096 Oct 28 2013 Win7_EN-x64 dr-xr-xr-x. 5 root root 4096 Sep 25 2014 Win7_RU-x64 dr-xr-xr-x. 6 root root 4096 Jun 25 10:29 Win8_RU-x64 dr-xr-xr-x. 7 root root 4096 Dec 8 2011 WinXp_EN-i386 dr-xr-xr-x. 8 root root 4096 Jul 31 17:12 WinXp_RU-i386
Xpã2003ãªã©ã®ã¬ã¢ãªãã£ãã€ã³ã¹ããŒã«ããäºå®ãããå Žå
é åžWinXp_EN-i386ãWinXp_RU-i386ãããã³Win2K3-Server_EN-x64ã®ãããã£ã¬ã¯ããªã§ã次ã®ã³ãã³ããå®è¡ããŸãã
Xpã䜿çšããé åžãã£ã¬ã¯ããªå ïŒ
2003幎以éã®é åžãã£ã¬ã¯ããªïŒ
ris-linuxãå¿ èŠã«ãªããŸãã ç§ã®ãã£ã¹ããªãã¥ãŒã·ã§ã³ã§ã¯ã次ã®ããã«ãªã£ãŠããŸãã
RISãWin 7ã®ã€ã³ã¹ããŒã«ã«å¹²æžããªãããã«ã/ usr / share / ris-linux / binlsrv.pyãã¡ã€ã«å ã®1è¡ãã³ã¡ã³ãã¢ãŠãããå¿ èŠããããŸãã
tftpdãã°ãRISã«å¿ èŠãªBCDãäŒããæ©èœãåæããã«ãç°¡åãªæ¹æ³ãèŠã€ããããšã¯ã§ããŸããã§ããã ãã®ããããªãã«ããŸããã
ãã©ã«ããŒ/ var / lib / tftpboot / winos / infãäœæããå¿ èŠãª32ããããããã¯ãŒã¯ã«ãŒããã©ã€ããŒã®ãã¹ãŠã®.infãã¡ã€ã«ãã³ããŒããŠãã³ãã³ããå®è¡ããŸãã
32ãããXpãš64ãããServer 2003ãåæã«æäŸããã«ã¯RISãå¿ èŠã§ãããããè¡ãã«ã¯ãå¥ã®ããŒãã§ãµãŒãã¹ã®å¥ã®ã€ã³ã¹ã¿ã³ã¹ãäœæããŸãã
systemdã§ris-linuxãµãŒãã¹ãæžãæããæéã¯ãããŸããã§ãããã誰ããããå¿ èŠãšããŸããã
ãã©ã«ããŒ/ var / lib / tftpboot / winos / inf64ãäœæããããã«å¿ èŠãª64ããããããã¯ãŒã¯ã«ãŒããã©ã€ããŒã®ãã¹ãŠã®.infãã¡ã€ã«ãã³ããŒããŠãã³ãã³ããå®è¡ããŸãã
ãµãŒãã¹ããªã³ã«ããŠéå§ããŸãã
ããã«ãWin2K3-Server_EN-x64ããŒãããŒããŒã®ããŒããã64ãããRISããã€ã³ãããããŒãã«å€æŽããå¿ èŠããããŸãã
ããã¯ãris-linuxããã±ãŒãžã®modldr.pyãŠãŒãã£ãªãã£ã䜿çšããŠå®è¡ã§ããŸãã
ãŠãŒãã£ãªãã£æäœã倱æããå Žåãã¹ã¯ãªããã®ããã¹ãmodldr.pyã§æ¬¡ã®è¡ã眮ãæããŸãã
è¡ããšïŒ
ããŒããã¡ã€ã«ã®æºå
é åžWinXp_EN-i386ãWinXp_RU-i386ãããã³Win2K3-Server_EN-x64ã®ãããã£ã¬ã¯ããªã§ã次ã®ã³ãã³ããå®è¡ããŸãã
[root@is WinXp_EN-i386]# cabextract i386/startrom.n1_ [root@is WinXp_EN-i386]# mv startrom.n12 pxeboot.n12 [root@is WinXp_EN-i386]# cabextract i386/setupldr.ex_
Xpã䜿çšããé åžãã£ã¬ã¯ããªå ïŒ
[root@is WinXp_EN-i386]# sed -i 's/ntdetect\.com/ntdetect.wxp/gi setupldr.exe
2003幎以éã®é åžãã£ã¬ã¯ããªïŒ
[root@is Win2K3-Server_EN-x64]# sed -i 's/ntdetect\.com/ntdetect.2k3/gi setupldr.exe
# cp /var/lib/tftpboot/winos/WinXp_EN-i386/i386/ntdetect.com /var/lib/tftpboot/winos/ntdetect.wxp # cp /var/lib/tftpboot/winos/Win2K3-Server_EN-x64/i386/ntdetect.com /var/lib/tftpboot/winos/ntdetect.wxp
RISãæ§æãã
ris-linuxãå¿ èŠã«ãªããŸãã ç§ã®ãã£ã¹ããªãã¥ãŒã·ã§ã³ã§ã¯ã次ã®ããã«ãªã£ãŠããŸãã
# dnf install ris-linux
RISãWin 7ã®ã€ã³ã¹ããŒã«ã«å¹²æžããªãããã«ã/ usr / share / ris-linux / binlsrv.pyãã¡ã€ã«å ã®1è¡ãã³ã¡ã³ãã¢ãŠãããå¿ èŠããããŸãã
# cd /usr/share/ris-linux # cp binlsrv.py binlsrv.py.orig # sed -i "s/p = p + chr(252) + chr(len(/#&/gi" binlsrv.py
# diff binlsrv.py.orig binlsrv.py 571c571 < p = p + chr(252) + chr(len('boot\\bcd')) + 'boot\\bcd' --- > #p = p + chr(252) + chr(len('boot\\bcd')) + 'boot\\bcd'
tftpdãã°ãRISã«å¿ èŠãªBCDãäŒããæ©èœãåæããã«ãç°¡åãªæ¹æ³ãèŠã€ããããšã¯ã§ããŸããã§ããã ãã®ããããªãã«ããŸããã
ãã©ã«ããŒ/ var / lib / tftpboot / winos / infãäœæããå¿ èŠãª32ããããããã¯ãŒã¯ã«ãŒããã©ã€ããŒã®ãã¹ãŠã®.infãã¡ã€ã«ãã³ããŒããŠãã³ãã³ããå®è¡ããŸãã
# /usr/share/ris-linux/infparser.py /var/lib/tftpboot/winos/inf
32ãããXpãš64ãããServer 2003ãåæã«æäŸããã«ã¯RISãå¿ èŠã§ãããããè¡ãã«ã¯ãå¥ã®ããŒãã§ãµãŒãã¹ã®å¥ã®ã€ã³ã¹ã¿ã³ã¹ãäœæããŸãã
# cd /etc/sysconfig # cp ris-linuxd ris-linuxd64 # sed -i 's/\/inf/&64/gi' ris-linuxd64 # sed -i 's/linuxd/&64/gi' ris-linuxd64 # sed -i 's/BINLSRV_OPTS=/&--port=4012/gi' ris-linuxd64
# diff ris-linuxd ris-linuxd64 2c2 < # ris-linuxd service. --- > # ris-linuxd64 service. 6c6 < BINLSRV_INFPATH=/var/lib/tftpboot/winos/inf --- > BINLSRV_INFPATH=/var/lib/tftpboot/winos/inf64 9c9 < BINLSRV_OPTS= --- > BINLSRV_OPTS=--port=4012 12c12 < BINLSRV_LOGFILE=/var/log/ris-linuxd.log --- > BINLSRV_LOGFILE=/var/log/ris-linuxd64.log 15c15 < BINLSRV_PIDFILE=/var/run/ris-linuxd.pid --- > BINLSRV_PIDFILE=/var/run/ris-linuxd64.pid
# cd /usr/sbin # ln -s ris-linuxd ris-linuxd64
systemdã§ris-linuxãµãŒãã¹ãæžãæããæéã¯ãããŸããã§ãããã誰ããããå¿ èŠãšããŸããã
# cd /etc/rc.d/init.d # cp ris-linuxd ris-linuxd64 # sed -i 's/ris-linuxd/&64/gi' ris-linuxd64
ãã©ã«ããŒ/ var / lib / tftpboot / winos / inf64ãäœæããããã«å¿ èŠãª64ããããããã¯ãŒã¯ã«ãŒããã©ã€ããŒã®ãã¹ãŠã®.infãã¡ã€ã«ãã³ããŒããŠãã³ãã³ããå®è¡ããŸãã
/usr/share/ris-linux/infparser.py /var/lib/tftpboot/winos/inf64
ãµãŒãã¹ããªã³ã«ããŠéå§ããŸãã
# systemctl enable ris-linuxd # systemctl start ris-linuxd # systemctl enable ris-linuxd64 # systemctl start ris-linuxd64
ããã«ãWin2K3-Server_EN-x64ããŒãããŒããŒã®ããŒããã64ãããRISããã€ã³ãããããŒãã«å€æŽããå¿ èŠããããŸãã
ããã¯ãris-linuxããã±ãŒãžã®modldr.pyãŠãŒãã£ãªãã£ã䜿çšããŠå®è¡ã§ããŸãã
# /usr/share/ris-linux/modldr.py -p 4012 /var/lib/tftpboot/winos/Win2K3-Server_EN-x64/setupldr.exe
ãŠãŒãã£ãªãã£æäœã倱æããå Žåãã¹ã¯ãªããã®ããã¹ãmodldr.pyã§æ¬¡ã®è¡ã眮ãæããŸãã
ppattern = re.compile(r'\x6a\x04\x68(..)\x00\x00\xff\x35', re.DOTALL)
è¡ããšïŒ
ppattern = re.compile(r'\x6a\x64\x68(..)\x00\x00\xff\x35', re.DOTALL)
ãµã³ãã®æºå
2ã€ã®ãã©ã«ããŒããããªãã¯ã«ããããã«Sambaãå¿
èŠã§ã
# vi /etc/samba/smb.conf # [WINOS] path = /var/lib/tftpboot/winos guest ok = yes browseable = yes writeable = no public = yes blocking locks = no oplocks = no level2 oplocks = no # [public] comment = Public Stuff path = /var/www/html/Distr public = yes writable = no printable = no guest ok = yes blocking locks = no oplocks = no level2 oplocks = no
ã€ã³ã¹ããŒã«æã«äœ¿çšããæå°éã®æš©éãæã€ãŠãŒã¶ãŒãäœæããŸãã ç§ãæã£ãŠããïŒã€ã³ã¹ããŒã«/ã€ã³ã¹ããŒã«
ãããã¯ãŒã¯ã€ã³ã¹ããŒã«çšã®ãã¡ã€ã«ã®æºåWin 7ã8ã2008ã2012
Win 7ã8ã2008ã2012ã®ç¶æ³ã¯ãXpãããã¯ããã«æªãã§ãã ããã§ãã€ããªãæãäžããã®ã¯ããã»ã©ç°¡åã§ã¯ãããŸããããã®äžã®ãã§ãã¯ãµã ãæ°ããå¿ èŠããããŸãã
ããã§ã®èªåã€ã³ã¹ããŒã«çšã®å¿çãã¡ã€ã«ããXML圢åŒã§ãããçŸä»£çãªå€èŠ³ã«ãªã£ãŠããŸãã ããšãã°ããã£ã¹ã¯ãããŒãã£ã·ã§ã³ã«åå²ããæ¹æ³ãªã©ãæå®ã§ãããªã©ãå€ãã®æ¹åç¹ããããŸããããããè»èã«ã¯å€§ããªããšããããŸããå¿çãã¡ã€ã«ã®ååãã¹ã¿ãŒãã¢ããã¹ã¯ãªããã«çž«ã蟌ãŸããå®éã«ã€ã³ã¹ããŒã«ãéå§ãããŸãã 次ã«ãã¹ã¯ãªããèªäœãwimã€ã¡ãŒãžã«é ç·ãããŸãã
ã€ãŸã ãã€ããªã®ä¿®æ£ã«ã¯äŸç¶ãšããŠå€§ããªäžäŸ¿ããããããã«ããããã£ã¹ããªãã¥ãŒã·ã§ã³ã«åºã¥ããã€ã³ã¹ããŒã«ã·ããªãªããšã«ãéå§ã¹ã¯ãªããå ã®å¿çãã¡ã€ã«ã®ååã®ã¿ãåãã€ã¡ãŒãžã®å¥ã®ãã®ãšã¯ç°ãªãåå¥ã®wimã€ã¡ãŒãžãçšæããå¿ èŠããããŸãã
ãã£ã¹ããªãã¥ãŒã·ã§ã³ã®ãããã£ã¬ã¯ããªã«ã次ã®ãã¡ã€ã«ãé 眮ããå¿ èŠããããŸãã
- pxeboot.n12
- bootmgr.exe
- ããŒã/ bcd
- boot / boot.sdi
- ããŒã/ãã©ã³ããšããã«èšå®ããããã©ã³ã
Cobblerãã³ãã¬ãŒãã®äœæ
tftpã®ãã¡ã€ã«åå€æã«ãŒã«ãäœæããŸãã
ãã¡ã€ã«ã®å
容/etc/tftpd.rules
#vi /etc/tftpd.rules rg \\ / # Convert backslashes to slashes r (BOOTFONT\.BIN) /winos/\1 r (/Boot/Fonts/)(.*) /winos/Win8_RU-x64/boot/Fonts/\2 r (ntdetect\.wxp) /winos/\1 r (ntdetect\.2k3) /winos/\1 r (wine.\.sif) /WinXp_EN-i386/\1 r (xple.) /WinXp_EN-i386/\1 r (winr.\.sif) /WinXp_RU-i386/\1 r (xplr.) /WinXp_RU-i386/\1 r (wi2k.\.sif) /Win2K3-Server_EN-x64/\1 r (w2k3.) /Win2K3-Server_EN-x64/\1 r (/Win2K3-Server_EN-x64/)(.*) /winos\1\L\2 r (boot7r..exe) /winos/Win7_RU-x64/\1 r (/Boot/)(7R.) /winos/Win7_RU-x64/boot/\2 r (boot7e.\.exe) /winos/Win7_EN-x64/\1 r (/Boot/)(7E.) /winos/Win7_EN-x64/boot/\2 r (boot28.\.exe) /winos/Win2k8-Server_EN-x64/\1 r (/Boot/)(28.) /winos/Win2k8-Server_EN-x64/boot/\2 r (boot2e.\.exe) /winos/Win2012-Server_EN-x64/\1 r (/Boot/)(2e.) /winos/Win2012-Server_EN-x64/boot/\2 r (boot2r.\.exe) /winos/Win2012-Server_RU-x64/\1 r (/Boot/)(2r.) /winos/Win2012-Server_RU-x64/boot/\2 r (boot81.\.exe) /winos/Win8_RU-x64/\1 r (/Boot/)(B8.) /winos/Win8_RU-x64/boot/\2 r (/WinXp...-i386/)(.*) /winos\1\L\2
tftpã®cobblerãã³ãã¬ãŒãã§å€æã«ãŒã«ãæå®ããŸãã
# vi /etc/cobbler/tftpd.template service tftp { disable = no socket_type = dgram protocol = udp wait = yes user = $user server = $binary server_args = -m /etc/tftpd.rules --port-range 25000:25030 -v -v -v -s $args per_source = 11 cps = 100 2 flags = IPv4 }
Windowsã»ã¯ã·ã§ã³ã®/var/lib/cobbler/distro_signatures.jsonãã¡ã€ã«ã«ããŒãžã§ã³æ å ±ãè¿œå ããŠãcobblerã¡ã¿ããŒã¿ãä»ããŠãã³ãã¬ãŒãã§äœ¿çšã§ããããã«ããŸãã
# vi /var/lib/cobbler/distro_signatures.json "windows": { "2003": { }, "2008": { }, "2012": { }, "XP": { }, "7": { }, "8": { } },
Windowsã€ã³ã¹ããŒã«ãã»ããã¢ããããéããã³ãã¬ãŒãããå¿çãã¡ã€ã«ãšã€ã³ã¹ããŒã«åŸã¹ã¯ãªãããçæããããšã«ãããcobblerãä»ããŠLinuxãã€ã³ã¹ããŒã«ããäž»ãªå©ç¹ãç¶æããããšãã§ããŸããã
Windowsçšã®ãã³ãã¬ãŒãã®æ§æã«ã¯ã次ã®ãã¡ã€ã«ãå«ãŸããŸãã
- post_inst_cmd.template-OSã€ã³ã¹ããŒã«åŸã«å®è¡ãããã¹ã¯ãªãããã³ãã¬ãŒã
- win.ks-Windowsçškiskstart linuxã®æçš¿ã»ã¯ã·ã§ã³ã®åœ¹å²ãæãã
- win_sif.template-å¿çãã¡ã€ã«ã®ãã³ãã¬ãŒã
- startnet.template-wimã€ã¡ãŒãžã§ã¹ã¯ãªãããã³ãã¬ãŒããéå§
- winpe7.template-Win 7ããã³Win 2008ãµãŒããŒã®wimãã¡ã€ã«
- winpe8.template-Win 8ããã³Win 2012ãµãŒããŒã®wimãã¡ã€ã«
Post_inst_cmd.templateããã³win.ksãã³ãã¬ãŒã
Windowsã®ã€ã³ã¹ããŒã«åŸã«å®è¡ããã¹ã¯ãªããã®ãã³ãã¬ãŒããäœæããŸãïŒããŒãžã§ã³ã«é¢ä¿ãªãïŒã
ã¹ã¯ãªããã«ã¯ãèµ·åæã«ãã©ã¡ãŒã¿ãŒãšããŠãããã¡ã€ã«ïŒã€ã³ã¹ããŒã«ãªãã·ã§ã³ïŒcobblerã®ååãæž¡ãããŸãã
# cat /var/lib/tftpboot/winos/post_inst_cmd.template %systemdrive% CD %systemdrive%\TMP >nul 2>&1 $SNIPPET('my/win_wait_network_online') wget.exe http://@@http_server@@/cblr/svc/op/ks/profile/%1 MOVE %1 install.cmd todos.exe install.cmd start /wait install.cmd DEL /F /Q libeay32.dll >nul 2>&1 DEL /F /Q libiconv2.dll >nul 2>&1 DEL /F /Q libintl3.dll >nul 2>&1 DEL /F /Q libssl32.dll >nul 2>&1 DEL /F /Q wget.exe >nul 2>&1 DEL /F /Q %0 >nul 2>&1
ãã³ãã¬ãŒãã«é¢ããç°¡åãªèª¬æïŒ
ãã£ã¹ããªãã¥ãŒã·ã§ã³ã®åãã£ã¬ã¯ããªã«ã¯ããã©ã«ããŒ$ OEM $ / $ 1 / TMPããããwget.exeãtodos.exeãdll'kiãå®è¡ããå¿ èŠããããŸãã ããæ£ç¢ºã«ã¯ããããã¯1ã€ã®ãã©ã«ããŒã«ãããä»ã®ãã©ã«ããŒã¯åãªãã·ã³ããªãã¯ãªã³ã¯ã§ãã
# ls -l '/var/lib/tftpboot/winos/Win2K3-Server_EN-x64/$OEM$/$1/TMP' -rwxr-xr-x. 1 root root 1177600 Sep 4 2008 libeay32.dll -rwxr-xr-x. 1 root root 1008128 Mar 15 2008 libiconv2.dll -rwxr-xr-x. 1 root root 103424 May 7 2005 libintl3.dll -rwxr-xr-x. 1 root root 232960 Sep 4 2008 libssl32.dll -rwxr-xr-x. 1 root root 4880 Oct 26 1999 sleep.exe -rwxr-xr-x. 1 root root 52736 Oct 27 2013 todos.exe -rwxr-xr-x. 1 root root 449024 Dec 31 2008 wget.exe # ls -l '/var/lib/tftpboot/winos/Win8_RU-x64/sources/$OEM$/$1/TMP' lrwxrwxrwx. 1 root root 45 Oct 28 2013 /var/lib/tftpboot/winos/Win8_RU-x64/sources/$OEM$/$1/TMP -> ../../../../Win2K3-Server_EN-x64/$OEM$/$1/TMP # ls -l '/var/lib/tftpboot/winos/WinXp_RU-i386/$OEM$/$1/TMP' lrwxrwxrwx. 1 root root 42 May 31 2014 /var/lib/tftpboot/winos/WinXp_RU-i386/$OEM$/$1/TMP -> ../../../Win2K3-Server_EN-x64/$OEM$/$1/TMP
- OSãã€ã³ã¹ããŒã«ãããšããããã®ãã¡ã€ã«ã¯CïŒ\ TMPã«ã³ããŒãããŸãã
- Snipet win_wait_network_onlineã¯ããããã¯ãŒã¯ã®æºåãæŽããŸã§åŸ
æ©ããcobblerãã€ã³ã¹ããŒã«ãããŠãããµãŒããŒã®IPã¢ãã¬ã¹ãpingããŸãã
ã¹ãããããã¡ã€ã«ã®å 容/ var / lib / cobbler /ã¹ãããã/ my / win_wait_network_online:wno10 set n=0 :wno20 ping @@http_server@@ -n 3 set exit_code=%ERRORLEVEL% IF %exit_code% EQU 0 GOTO wno_exit set /an=n+1 IF %n% lss 30 goto wno20 pause goto wno10 :wno_exit
ã¹ã¯ãªãããçæããããšãcobblerã¡ã¿ããŒã¿ã®å€æ°å@@ http_server @@ã¯ãcobblerãã€ã³ã¹ããŒã«ãããŠãããµãŒããŒã®å®éã®IPã¢ãã¬ã¹ã«çœ®ãæããããŸãã
- 次ã«ãwget.exeãããã¯ã¹ã¿ãŒããã¡ã€ã«ãããŠã³ããŒãããŸãã Linuxããã¯ã¹ã¿ãŒããšã¯ç°ãªããããã«ã¯.cmdãã¡ã€ã«ãå«ãŸããŠããŸãããwin.ksãã³ãã¬ãŒãããcobblerãµãŒããŒã«ãã£ãŠãªã³ã¶ãã©ã€ã§çæãããŸãã
- ãã®ãã¡ã€ã«ã®ååã¯å€æŽãããWindowsããã¹ããã¡ã€ã«åœ¢åŒã«å€æãããéåžžã®cmdã¹ã¯ãªãããšããŠå®è¡ãããŸãã
- CïŒ\ TMPã§ã¹ã¯ãªãããå®è¡ããåŸããã®ååŸã«äœ¿çšããããã¡ã€ã«ãšã¹ã¯ãªããèªäœãåé€ãããŸãã
wgetã§ããŠã³ããŒãããããã¯ã¹ã¿ãŒãLinuxã®ã€ã³ã¹ããŒã«åŸã®éšåã®åœ¹å²ãæãããã¡ã€ã«ã¯ãç°¡ç¥åããã圢åŒã§ã¯æ¬¡ã®ããã«ãªããŸãã
ãã¡ã€ã«ã®å
容/var/lib/cobbler/kickstarts/win.ks
# cat /var/lib/cobbler/kickstarts/win.ks $SNIPPET('my/win_wait_network_online') set n=0 :mount_y net use y: \\@@http_server@@\Public /user:install install set exit_code=%ERRORLEVEL% IF %exit_code% EQU 0 GOTO mount_z set /an=n+1 IF %n% lss 20 goto mount_y PAUSE goto mount_y set n=0 :mount_z net use z: \\@@http_server@@\winos /user:install install set exit_code=%ERRORLEVEL% IF %exit_code% EQU 0 GOTO mount_exit set /an=n+1 IF %n% lss 20 goto mount_z PAUSE goto mount_z :mount_exit if exist %systemdrive%\TMP\stage.dat goto flag005 echo 0 > %systemdrive%\TMP\stage.dat $SNIPPET('my/win_check_virt') #if $distro_name in ( 'WinXp_EN-i386', 'WinXp_RU-i386', 'Win2K3-Server_EN-x64' ) z:\Drivers\wsname.exe /N:$DNS /NOREBOOT #else REM pause #end if echo Windows Registry Editor Version 5.00 > %systemdrive%\TMP\install.reg echo [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\RunOnce] >> %systemdrive%\TMP\install.reg echo "DD"="C:\\TMP\\install.cmd" >> %systemdrive%\TMP\install.reg $SNIPPET('my/win_install_drivers') #if $distro_name == 'Win2K3-Server_EN-x64' start /wait z:\Win2K3-Server_EN-x64\cmpnents\r2\setup2.exe /q /a /sr start /wait y:\Windows\Win2003\IE8-WindowsServer2003-x64-ENU.exe /passive /update-no /norestart if %virt% equ NO REG IMPORT y:\Windows\Win2003\vm.reg #end if REG IMPORT %systemdrive%\TMP\install.reg net use Y: /delete net use Z: /delete %systemdrive%\TMP\sleep.exe 10 exit :flag005 for /f "tokens=*" %%i in (%systemdrive%\TMP\stage.dat) do set stage=%%i echo 1 > %systemdrive%\TMP\stage.dat REG IMPORT %systemdrive%\TMP\install.reg if %stage% neq 0 goto flag010 net use Y: /delete net use Z: /delete shutdown -r -f -t 5 exit :flag010 if %stage% gtr 1 goto flag020 echo 2 > %systemdrive%\TMP\stage.dat $SNIPPET('my/winzip') $SNIPPET('my/winrar') $SNIPPET('my/win_install_chrome') $SNIPPET('my/win_install_ffox') $SNIPPET('my/win_install_adacr') $SNIPPET('my/win_install_jdk7-x86') $SNIPPET('my/win_install_jdk7-x86_64') $SNIPPET('my/win_install_UltraVNC') #if $distro_name in ( 'WinXp_EN-i386', 'WinXp_RU-i386', 'Win2K3-Server_EN-x64' ) $SNIPPET('my/win_install_office_2007_ru') #else if $distro_name in ( 'Win7_RU-x64', 'Win2012-Server_RU-x64', 'Win8_RU-x64' ) $SNIPPET('my/win_install_office_2010_ru') #else $SNIPPET('my/win_install_office_2010_en') #end if Title Cleaning Temp files DEL "%systemroot%\*.bmp" >nul 2>&1 DEL "%systemroot%\Web\Wallpaper\*.jpg" >nul 2>&1 DEL "%systemroot%\system32\dllcache\*.scr" >nul 2>&1 DEL "%systemroot%\system32\*.scr" >nul 2>&1 DEL "%AllUsersProfile%\Start Menu\Windows Update.lnk" >nul 2>&1 DEL "%AllUsersProfile%\Start Menu\Set Program Access and Defaults.lnk" >nul 2>&1 DEL "%AllUsersProfile%\Start Menu\Windows Catalog.lnk" >nul 2>&1 DEL "%systemdrive%\Microsoft Office*.txt" >nul 2>&1 net user aspnet /delete >nul 2>&1 REM %systemdrive%\TMP\sleep.exe 60 net use Y: /delete net use Z: /delete shutdown -r -f -t 30 RD /S /Q %systemdrive%\DRIVERS\ >nul 2>&1 if not defined stage DEL /F /Q %systemdrive%\post_install.cmd DEL /F /S /Q %systemdrive%\TMP\*.* exit
ããã§ã¯ãã³ãŒããä¹±éã«ããªãããã«ã¹ããããã䜿çšãããŠããŸãã ãã€ããŒãã€ã¶ãŒã®ãã§ãã¯ãå®è¡ãããã£ã¹ããªãã¥ãŒã·ã§ã³ãšãããã¡ã€ã«ã«å¿ããŠããã®ãœãããŠã§ã¢ãŸãã¯ãã®ãœãããŠã§ã¢ãã€ã³ã¹ããŒã«ãããŠãããã©ããã«å¿ããŠãå¿ èŠãªãã©ã€ããŒãã€ã³ã¹ããŒã«ããŸãã
Win_sif.templateãã³ãã¬ãŒã
ããã¯ããã¹ãŠã®ããŒãžã§ã³ã®ãŠã£ã³ããŠã®å¿çãã¡ã€ã«ãäœæãããåäžã®ãã³ãã¬ãŒãã§ãã ä»ã®ãã³ãã¬ãŒããšåæ§ã«ããã¹ãŠã®cobblerã¡ã¿å€æ°ã䜿çšã§ããŸãã
$ archã$ distro_nameã$ profile_nameãªã©ã
ãã¡ã€ã«ã®å
容/var/lib/tftpboot/winos/win_sif.template
#if $distro_name in ( 'WinXp_EN-i386', 'WinXp_RU-i386', 'Win2K3-Server_EN-x64' ) #if $arch == 'x86_64' #set $win_arch = 'amd64' #else if $arch == 'i386' #set $win_arch = 'i386' #end if #set $OriSrc = '\\\\' + $http_server + '\\WINOS\\' + $distro_name + '\\' + $win_arch #set $DevSrc = '\\Device\\LanmanRedirector\\' + $http_server + '\\WINOS\\' + $distro_name [Data] floppyless = "1" msdosinitiated = "1" ; Needed for second stage OriSrc="$OriSrc" OriTyp="4" LocalSourceOnCD=1 DisableAdminAccountOnDomainJoin=0 AutomaticUpdates="No" Autopartition="0" UnattendedInstall="Yes" [SetupData] OsLoadOptions = "/noguiboot /fastdetect" ; Needed for first stage SetupSourceDevice = "$DevSrc" [Unattended] CrashDumpSetting=0 FactoryMode=No UnattendMode=FullUnattended UnattendSwitch="Yes" OemPreinstall="Yes" OemSkipEula="Yes" Repartition=No FileSystem=* WaitForReboot="No" NoWaitAfterTextMode=1 NoWaitAfterGUIMode=1 DriverSigningPolicy=Ignore NonDriverSigningPolicy=Ignore UpdateInstalledDrivers=Yes TargetPath=\WINDOWS OemPnPDriversPath=DRIVERS\NIC;DRIVERS\ACPI;DRIVERS\CHIPSET\5520\All;DRIVERS\CHIPSET\C200\All;DRIVERS\Storage;DRIVERS\Virt #if $os_version == '2003' [LicenseFilePrintData] AutoMode = PerSeat #end if [Display] BitsPerPel=32 XResolution=1440 YResolution=900 Vrefresh=60 [WindowsFirewall] Profiles = WindowsFirewall.TurnOffFirewall [WindowsFirewall.TurnOffFirewall] Mode = 0 [PCHealth] RA_AllowToGetHelp=0 [GuiRunOnce] "%Systemdrive%\post_install.cmd @@profile_name@@" [GuiUnattended] AdminPassword=* TimeZone=195 OEMSkipRegional=1 OemSkipWelcome=1 #if $os_version != '2003' AutoLogon = Yes AutoLogonCount=1 #end if [RemoteInstall] Repartition=Yes UseWholeDisk=Yes [Components] msmsgs=Off msnexplr=Off zonegames=Off Paint=Off #if $os_version == '2003' ; Iis_common=On ; Iis_inetmgr=On ComPlusNetwork=On ; Iis_www=On ; Iis_asp=On IEHardenAdmin=Off IEHardenUser=Off #end if [TerminalServices] AllowConnections=1 [UserData] #if $os_version == '2003' ProductKey="XXXXX-XXXXX-XXXXX-XXXXX-XXXXX" #else if $distro_name == 'WinXp_EN-i386' ProductKey="XXXXX-XXXXX-XXXXX-XXXXX-XXXXX" #else if $distro_name == 'WinXp_RU-i386' ProductKey="XXXXX-XXXXX-XXXXX-XXXXX-XXXXX" #end if ComputerName=* FullName="Admin" OrgName="Microsoft" [RegionalSettings] LanguageGroup=1,2,3,4,5 #if $distro_name == 'WinXp_RU-i386' SystemLocale=00000419 UserLocale=00000419 #else SystemLocale=00000409 UserLocale=00000409 #end if InputLocale=0409:00000409,0419:00000419 [Shell] CustomDefaultThemeFile="%WinDir%\Resources\Themes\Windows Classic.Theme" [Networking] InstallDefaultComponents="Yes"
#else if $distro_name in ( 'Win7_RU-x64', 'Win7_EN-x64', 'Win2k8-Server_EN-x64', 'Win2012-Server_EN-x64', 'Win2012-Server_RU-x64', 'Win8_RU-x64' ) <?xml version="1.0" encoding="utf-8"?> <unattend xmlns="urn:schemas-microsoft-com:unattend"> #if $distro_name in ( 'Win2012-Server_EN-x64', 'Win2012-Server_RU-x64' ) <servicing> <package action="configure"> <assemblyIdentity name="Microsoft-Windows-ServerCore-Package" version="6.3.9600.16384" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="" /> <selection name="IIS-WebServerRole" state="true" /> <selection name="Microsoft-Hyper-V" state="true" /> <selection name="Microsoft-Hyper-V-Offline" state="true" /> <selection name="Microsoft-Hyper-V-Online" state="true" /> <selection name="Microsoft-Hyper-V-Management-Clients" state="true" /> <selection name="Microsoft-Hyper-V-Management-PowerShell" state="true" /> <selection name="VmHostAgent" state="true" /> <selection name="FailoverCluster-FullServer" state="true" /> <selection name="FailoverCluster-PowerShell" state="true" /> <selection name="FailoverCluster-CmdInterface" state="true" /> <selection name="MultipathIo" state="true" /> <selection name="ServerManager-Core-RSAT-Role-Tools" state="true" /> <selection name="RSAT-Hyper-V-Tools-Feature" state="true" /> <selection name="ServerManager-Core-RSAT" state="true" /> <selection name="ServerMediaFoundation" state="true" /> <selection name="Remote-Desktop-Services" state="true" /> <selection name="IIS-WebServer" state="true" /> <selection name="IIS-ApplicationDevelopment" state="true" /> <selection name="IIS-CommonHttpFeatures" state="true" /> <selection name="IIS-HealthAndDiagnostics" state="true" /> <selection name="IIS-Performance" state="true" /> <selection name="IIS-Security" state="true" /> <selection name="IIS-WebServerManagementTools" state="true" /> </package> </servicing> #end if <settings pass="windowsPE"> <component name="Microsoft-Windows-International-Core-WinPE" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> #if $distro_name in ( 'Win7_RU-x64', 'Win2012-Server_RU-x64', 'Win8_RU-x64' ) <InputLocale>0409:00000409;0419:00000419</InputLocale> <SystemLocale>ru-RU</SystemLocale> <UILanguage>ru-RU</UILanguage> <UILanguageFallback>ru-RU</UILanguageFallback> <UserLocale>ru-RU</UserLocale> #else <InputLocale>0409:00000409</InputLocale> <SystemLocale>en-US</SystemLocale> <UILanguage>en-US</UILanguage> <UILanguageFallback>en-US</UILanguageFallback> <UserLocale>en-US</UserLocale> #end if </component> <component name="Microsoft-Windows-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <DiskConfiguration> <WillShowUI>OnError</WillShowUI> <Disk wcm:action="add"> <CreatePartitions> <CreatePartition wcm:action="add"> <Order>1</Order> <Extend>true</Extend> <Type>Primary</Type> </CreatePartition> </CreatePartitions> <DiskID>0</DiskID> <WillWipeDisk>true</WillWipeDisk> </Disk> </DiskConfiguration> <ImageInstall> <OSImage> <InstallFrom> <Credentials> <Domain></Domain> </Credentials> <MetaData wcm:action="add"> <Key>/IMAGE/NAME</Key> #if $profile_name == 'IOS' <Value>Windows8_VmVare_MacOS_xCode</Value> #else if $distro_name in ( 'Win7_RU-x64', 'Win7_EN-x64' ) <Value>Windows 7 PROFESSIONAL</Value> #else if $distro_name in ( 'Win2k8-Server_EN-x64' ) <Value>Windows Server 2008 R2 SERVERENTERPRISE</Value> #else if $distro_name in ( 'Win2012-Server_EN-x64', 'Win2012-Server_RU-x64' ) <Value>Windows Server 2012 R2 SERVERDATACENTER</Value> #else if $distro_name in ( 'Win8_RU-x64' ) <Value>Windows 8.1 Pro</Value> #else if $distro_name in ( 'Win8_EN-x64' ) <Value>Windows 8.1 Enterprise</Value> #end if </MetaData> </InstallFrom> <InstallTo> <DiskID>0</DiskID> <PartitionID>1</PartitionID> </InstallTo> </OSImage> </ImageInstall> <UserData> <ProductKey> #if $distro_name in ( 'Win2012-Server_EN-x64', 'Win2012-Server_RU-x64' ) <Key>XXXXX-XXXXX-XXXXX-XXXXX-XXXXX</Key> #end if <WillShowUI>Never</WillShowUI> </ProductKey> <AcceptEula>true</AcceptEula> <FullName>User</FullName> <Organization>My Organization</Organization> </UserData> <EnableFirewall>false</EnableFirewall> </component> <component name="Microsoft-Windows-PnpCustomizationsWinPE" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <DriverPaths> #if $distro_name in ( 'Win2012-Server_EN-x64', 'Win2012-Server_RU-x64', 'Win8_RU-x64' ) <PathAndCredentials wcm:action="add" wcm:keyValue="1"> <Path>\\@@http_server@@\WINOS\Drivers\CHIPSET\Win8</Path> </PathAndCredentials> #else <PathAndCredentials wcm:action="add" wcm:keyValue="1"> <Path>\\@@http_server@@\WINOS\Drivers\CHIPSET\5520\Vista</Path> </PathAndCredentials> <PathAndCredentials wcm:action="add" wcm:keyValue="2"> <Path>\\@@http_server@@\WINOS\Drivers\CHIPSET\C200\WIN7</Path> </PathAndCredentials> #end if <PathAndCredentials wcm:action="add" wcm:keyValue="3"> #if $distro_name in ( 'Win2012-Server_EN-x64', 'Win2012-Server_RU-x64', 'Win8_RU-x64' ) <Path>\\@@http_server@@\WINOS\Drivers\NIC\Win8</Path> #else <Path>\\@@http_server@@\WINOS\Drivers\NIC</Path> #end if </PathAndCredentials> #if $distro_name in ( 'Win7_RU-x64', 'Win7_EN-x64', 'Win2k8-Server_EN-x64' ) <PathAndCredentials wcm:action="add" wcm:keyValue="4"> <Path>\\@@http_server@@\WINOS\Drivers\ACPI\64\WIN7</Path> </PathAndCredentials> #end if <PathAndCredentials wcm:action="add" wcm:keyValue="5"> <Path>\\@@http_server@@\WINOS\Drivers\Storage\64</Path> </PathAndCredentials> <PathAndCredentials wcm:action="add" wcm:keyValue="6"> #if $distro_name in ( 'Win8_RU-x64' ) <Path>\\@@http_server@@\WINOS\Drivers\Virt\Win8</Path> #else if $distro_name in ( 'Win2012-Server_EN-x64', 'Win2012-Server_RU-x64' ) <Path>\\@@http_server@@\WINOS\Drivers\Virt\2012</Path> #else if $distro_name in ( 'Win2k8-Server_EN-x64' ) <Path>\\@@http_server@@\WINOS\Drivers\Virt\2008</Path> #else <Path>\\@@http_server@@\WINOS\Drivers\Virt\Win7</Path> #end if </PathAndCredentials> </DriverPaths> </component> </settings> <settings pass="offlineServicing"> <component name="Microsoft-Windows-LUA-Settings" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <EnableLUA>false</EnableLUA> </component> </settings> <settings pass="specialize"> <component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <ComputerName>*</ComputerName> <RegisteredOrganization>My Organization</RegisteredOrganization> <RegisteredOwner>Instructor</RegisteredOwner> #if $distro_name == 'Win7_RU-x64' <ProductKey>XXXXX-XXXXX-XXXXX-XXXXX-XXXXX</ProductKey> #else if $distro_name == 'Win7_EN-x64' <ProductKey>XXXXX-XXXXX-XXXXX-XXXXX-XXXXX</ProductKey> #else if $distro_name == 'Win2k8-Server_EN-x64' <ProductKey>XXXXX-XXXXX-XXXXX-XXXXX-XXXXX</ProductKey> #else if $distro_name in ( 'Win2012-Server_EN-x64', 'Win2012-Server_RU-x64' ) <ProductKey>XXXXX-XXXXX-XXXXX-XXXXX-XXXXX</ProductKey> #end if </component> <component name="Microsoft-Windows-UnattendedJoin" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <Identification> <JoinWorkgroup>WORKGROUP</JoinWorkgroup> </Identification> </component> <component name="Microsoft-Windows-TerminalServices-LocalSessionManager" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <fDenyTSConnections>false</fDenyTSConnections> </component> <component name="Networking-MPSSVC-Svc" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <FirewallGroups> <FirewallGroup wcm:action="add" wcm:keyValue="EnableRemoteDesktop"> <Active>true</Active> <Group>Remote Desktop</Group> <Profile>all</Profile> </FirewallGroup> </FirewallGroups> </component> <component name="Microsoft-Windows-TerminalServices-RDP-WinStationExtensions" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <UserAuthentication>0</UserAuthentication> </component> </settings> <settings pass="oobeSystem"> <component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <OOBE> <ProtectYourPC>3</ProtectYourPC> <NetworkLocation>Work</NetworkLocation> </OOBE> <UserAccounts> <AdministratorPassword> <Value>XXXX</Value> <PlainText>false</PlainText> </AdministratorPassword> <LocalAccounts> <LocalAccount wcm:action="add"> <Password> <Value>XXXXX</Value> <PlainText>false</PlainText> </Password> <Name>User</Name> <Group>Administrators</Group> </LocalAccount> </LocalAccounts> <DomainAccounts> <DomainAccountList wcm:action="add"> <Domain>WORKGOUP</Domain> <DomainAccount wcm:action="add"> <Name>Domain Admins</Name> <Group>Administrators</Group> </DomainAccount> <DomainAccount wcm:action="add"> <Name>User</Name> <Group>Administrators</Group> </DomainAccount> </DomainAccountList> </DomainAccounts> </UserAccounts> <TimeZone>Central Asia Standard Time</TimeZone> <RegisteredOrganization>My Organization</RegisteredOrganization> <RegisteredOwner>User</RegisteredOwner> <FirstLogonCommands> <SynchronousCommand wcm:action="add"> <RequiresUserInput>false</RequiresUserInput> <Order>1</Order> <CommandLine>cmd /C wmic useraccount where "name='user'" set PasswordExpires=FALSE</CommandLine> </SynchronousCommand> <SynchronousCommand wcm:action="add"> <RequiresUserInput>false</RequiresUserInput> <Order>2</Order> <CommandLine>c:\post_install.cmd @@profile_name@@</CommandLine> </SynchronousCommand> </FirstLogonCommands> <AutoLogon> <Password> <Value>XXXX</Value> <PlainText>false</PlainText> </Password> <Enabled>true</Enabled> <Domain>WORKGOUP</Domain> <Username>User</Username> <LogonCount>10000</LogonCount> </AutoLogon> </component> </settings> #if $distro_name in ( 'Win7_RU-x64', 'Win7_EN-x64' ) <cpi:offlineImage cpi:source="catalog:d:/sources/install_windows 7 professional.clg" xmlns:cpi="urn:schemas-microsoft-com:cpi" /> #else if $distro_name in ( 'Win2k8-Server_EN-x64' ) <cpi:offlineImage cpi:source="catalog:d:/sources/install_windows server 2008 r2 serverenterprise.clg" xmlns:cpi="urn:schemas-microsoft-com:cpi" /> #else if $distro_name in ( 'Win2012-Server_EN-x64', 'Win2012-Server_RU-x64' ) <cpi:offlineImage cpi:source="wim:c:/netboot/install.wim#Windows Server 2012 R2 SERVERDATACENTER" xmlns:cpi="urn:schemas-microsoft-com:cpi" /> #else if $distro_name in ( 'Win8_RU-x64' ) <cpi:offlineImage cpi:source="catalog:d:/sources/install_windows 8.1 Pro.clg" xmlns:cpi="urn:schemas-microsoft-com:cpi" /> #end if </unattend> #end if
ããã§éèŠãªã®ã¯ããããã¡ã€ã«åããã©ã¡ãŒã¿ãŒãšããŠäœ¿çšããŠã¹ã¯ãªãããéå§ããè¡ã§ãã
- Xpã2003çš
[GuiRunOnce] "%Systemdrive%\post_install.cmd @@profile_name@@"
- 7ã8ã2008ã2012
<SynchronousCommand wcm:action="add"> <RequiresUserInput>false</RequiresUserInput> <Order>2</Order> <CommandLine>c:\post_install.cmd @@profile_name@@</CommandLine> </SynchronousCommand>
Startnet.templateãã³ãã¬ãŒã
éå§ã¹ã¯ãªãããwimã€ã¡ãŒãžçšã«åœ¢æããããã³ãã¬ãŒãã
- ãããã¯ãŒã¯ã¹ã¿ãã¯ãåæåããåŸãã¹ã¯ãªããã¯DHCPãµãŒããŒã®IPã¢ãã¬ã¹ãæ€åºããŸãïŒsambaãå«ãcobblerããããŸãïŒã
- å¿ èŠãªSambaãããã¯ãŒã¯ãªãœãŒã¹ãããŠã³ããããŸãã
- ãããã¡ã€ã«ã®å¿çãã¡ã€ã«åïŒ$ kernel_options [â sifâ]ïŒã¯cobblerã¡ã¿ããŒã¿ããååŸãããŸãã
- DNSãµãŒããŒã«ç §äŒããããšã«ãããDNSã«ã€ã³ã¹ããŒã«ãããŠããã³ã³ãã¥ãŒã¿ãŒã®ååãèŠã€ããŠãå¿çãã¡ã€ã«ã«å ¥åããŸãã
- ãã®å¿çãã¡ã€ã«ã䜿çšããŠã€ã³ã¹ããŒã«ãéå§ããŸãã
ãã¡ã€ã«ã®å
容/var/lib/cobbler/kickstarts/startnet.template
wpeinit ping 127.0.0.1 -n 10 >nul md \tmp cd \tmp ipconfig /all | find "DHCP Server" > dhcp ipconfig /all | find "IPv4 Address" > ipaddr FOR /F "eol=- tokens=2 delims=:" %%i in (dhcp) do set dhcp=%%i FOR %%i in (%dhcp%) do set dhcp=%%i FOR /F "eol=- tokens=2 delims=:(" %%i in (ipaddr) do set ipaddr=%%i net use y: \\%dhcp%\Public /user:install install net use z: \\%dhcp%\WINOS\@@distro_name@@ /user:install install set exit_code=%ERRORLEVEL% IF %exit_code% EQU 0 GOTO GETNAME echo "Can't mount network drive goto EXIT :GETNAME y:\windows\bind\nslookup.exe %ipaddr% | find "name =" > wsname for /f "eol=- tokens=2 delims==" %%i in (wsname) do echo %%i > ws for /f "eol=- tokens=1 delims=." %%i in (ws) do set wsname=%%i FOR %%i in (%wsname%) do set wsname=%%i #set $unattended = "set UNATTENDED_ORIG=Z:\\sources\\" + $kernel_options["sif"] $unattended set UNATTENDED=X:\tmp\autounattended.xml echo off FOR /F "tokens=1 delims=!" %%l in (%UNATTENDED_ORIG%) do ( IF "%%l"==" <ComputerName>*</ComputerName>" ( echo ^<ComputerName^>%wsname%^<^/ComputerName^>>> %UNATTENDED% ) else ( echo %%l>> %UNATTENDED% ) ) echo on :INSTALL set n=0 z:\sources\setup.exe /unattend:%UNATTENDED% set /an=n+1 ping 127.0.0.1 -n 5 >nul IF %n% lss 20 goto INSTALL :EXIT
Winpe7.templateããã³winpe8.templateãã³ãã¬ãŒã
Win 7ããã³Win 8ã®çµ±åããããã©ã€ããŒã䜿çšãããããã¯ãŒã¯ã€ã³ã¹ããŒã«ã®æšæºã€ã¡ãŒãžã
ã³ãã³ãã§ã
cobbler sync
ãããã¯åãããã¡ã€ã«ã«ç€ºãããŠããå Žæã«ã³ããŒãããŸãã
ãã®ãããªã³ããŒã¯ããããããŠã³ããããstartnet.templateãã³ãã¬ãŒãã«åºã¥ããŠäœæãããéå§ã¹ã¯ãªãããããã«ã³ããŒãããåæåŸã®ããªã¬ãŒã§å解ãããŸãã
Linuxã§wimã€ã¡ãŒãžã䜿çšããã«ã¯ãwimlib ã䜿çšããŸãããããã䜿çš
ããã«ã¯ãntfs-3gããã±ãŒãžãã€ã³ã¹ããŒã«ããå¿ èŠããããŸãã
ãããã£ãŠãç§ã®ããã«ãlibvirtã®å¶åŸ¡äžã§Linuxã³ã³ãããŒlxcã«cobblerãã€ã³ã¹ããŒã«ããå Žåãè¡ãã¡ã€ã³å®çŸ©ãxmlã§èšè¿°ããå¿ èŠããããŸãã
<hostdev mode='capabilities' type='misc'> <source> <char>/dev/fuse</char> </source> </hostdev>
é åžããã³ãããã¡ã€ã«å®çŸ©ãäœæãã
cobblerã§é åžå®çŸ©ãäœæããŸãã
# systemctl restart cobblerd # cobbler distro add --name=WinXp_RU-i386 --kernel=/var/lib/tftpboot/winos/WinXp_RU-i386/pxeboot.n12 --initrd=/var/lib/tftpboot/winos/add_ram.dat --arch=i386 --breed=windows --os-version=XP --kopts='post_install=/var/lib/tftpboot/winos/WinXp_RU-i386/$OEM$/$1/post_install.cmd' # cobbler distro add --name=Win7_RU-x64 --kernel=/var/lib/tftpboot/winos/Win7_RU-x64/pxeboot.n12 --initrd=/var/lib/tftpboot/winos/add_ram.dat --arch=x86_64 --breed=windows --os-version=7 --kopts='post_install=/var/lib/tftpboot/winos/Win7_RU-x64/sources/$OEM$/$1/post_install.cmd' # cobbler distro add --name=Win8_RU-x64 --kernel=/var/lib/tftpboot/winos/Win8_RU-x64/pxeboot.n12 --initrd=/var/lib/tftpboot/winos/add_ram.dat --arch=x86_64 --breed=windows --os-version=8 --kopts='post_install=/var/lib/tftpboot/winos/Win8_RU-x64/sources/$OEM$/$1/post_install.cmd' ..
ããã§ã¯ãã«ãŒãã«ã¯ãããŒã§ããPXEã¯ããã®pxeboot.n12ã«åºã¥ããŠäœæããããã¡ã€ã«ãã³ãã³ãã§ããŒãããŸã
cobbler sync
ã
/var/lib/tftpboot/winos/add_ram.datã¯æ¶ç©ºã®initrdã§ããããŸãããããã¯ããªããäœããããæããããšãã§ãããšããæå³ã§ã-ããã§ãªããã°ããã£ã¹ããªãã¥ãŒã·ã§ã³ãäœæã§ããŸããã
cobblerã§ãããã¡ã€ã«å®çŸ©ãäœæããŸãã
# cobbler profile add --name=WinXp_RU-i386 --distro=WinXp_RU-i386 --kickstart=/var/lib/cobbler/kickstarts/win.ks --kopts='pxeboot=winr0.0,bootmgr=xplr0,sif=winr0.sif' # cobbler profile add --name=Win7_RU-x64 --distro=Win7_RU-x64 --kickstart=/var/lib/cobbler/kickstarts/win.ks --kopts='pxeboot=win7ra.0,bootmgr=boot7ra.exe,bcd=7Ra,winpe=winpe.wim,sif=autounattended.xml' # cobbler profile add --name=Win8_RU-x64 --distro=Win8_RU-x64 --kickstart=/var/lib/cobbler/kickstarts/win.ks --kopts='pxeboot=win81a.0,bootmgr=boot81a.exe,bcd=B8a,winpe=winpe.wim,sif=autounattended.xml'
Win8_RU-x64é åžãããã«åºã¥ããŠã2ã€ã®ãã¹ãã€ã³ã¹ããŒã«ãªãã·ã§ã³ã®ãããã¡ã€ã«ãäœæããŸãã
# cobbler profile add --name=Win8-test1 --distro=Win8_RU-x64 --kickstart=/var/lib/cobbler/kickstarts/win.ks --kopts='pxeboot=win81b.0,bootmgr=boot81b.exe,bcd=B8b,winpe=winpb.wim,sif=autounattended01.xml' # cobbler profile add --name=Win8-test2 --distro=Win8_RU-x64 --kickstart=/var/lib/cobbler/kickstarts/win.ks --kopts='pxeboot=win81c.0,bootmgr=boot81c.exe,bcd=B8c,winpe=winpc.wim,sif=autounattended02.xml'
win.ksã§ã¯ã次ã®ãããªæ§é ãæ¿å ¥ã§ããŸãã
#if $profile_name == ' Win8-test1' <code> #end if #if $profile_name == ' Win8-test2' <code> #end if
ãããã¡ã€ã«å ã®ãã¡ã€ã«åã¯å®éã®ãã®ã§ããããã®ãã£ã¹ããªãã¥ãŒã·ã§ã³ã®/etc/tftpd.rulesã§å®çŸ©ãããŠãããã³ãã¬ãŒããšäžèŽããå¿ èŠããããŸãããã¡ã€ã«èªäœã¯ãŸã ååšããŠããŸããããããã¯ã³ãã³ããå®è¡ããããšãã«ããªã¬ãŒã«ãã£ãŠäœæãã
cobbler sync
ãŸãã
PXEããŒãã¡ãã¥ãŒãã³ãã¬ãŒã
Cobblerã¯ããã©ã«ãã§ãªã¹ãã®åœ¢åŒã§ã¡ãã¥ãŒãäœæããŸããããã䟿å©ã«ããããã«ããå°ãäœæ¥ããå¿ èŠããããŸãã
äœããã®çç±ã§ãcobbleréçºè ã¯ããã³ãã¬ãŒãããpxeã¡ãã¥ãŒãçæãããšãã«ãhttp_serverå€æ°ã®å€ã
server.example.org
æ§æãã¡ã€ã«ããååŸããã®ã§ã¯ãªããåºå®å€ã«èšå®ããŸããããã¯Windowsã¡ãã¥ãŒé ç®ã«å¹²æžããŸããããLinuxã®å Žåããã®å€ã䜿çšããŠãããã¯ã¹ã¿ãŒããã¡ã€ã«ã®å Žæãæå®ã§ããŸãããããä¿®æ£ããŸãã
# cd /usr/lib/python2.7/site-packages/cobbler # cp templar.py templar.py.orig # sed -i 's/"server.example.org"/self.settings.server/gi' templar.py
/etc/cobbler/pxe/pxedefault.templateãã¡ã€ã«ãã
$pxe_menu_items
åé€ããŠã代ããã«ç¬èªã®äœããæãããšãã§ããŸãïŒ
menu begin Linux MENU TITLE Linux label Fedora-latest-x86_64 MENU INDENT 5 MENU LABEL Fedora-latest-x86_64 kernel /images/Fedora-22-x86_64/vmlinuz append initrd=/images/Fedora-22-x86_64/initrd.img ks.device=bootif ks.sendmac lang=en text ks=http://@@http_server@@/cblr/svc/op/ks/profile/Fedora-latest-x86_64 ipappend 2 label returntomain menu label Return to ^main menu. menu exit menu end menu begin Windows MENU TITLE Windows label Win8-test1 MENU INDENT 5 MENU LABEL Win8-test1 kernel /winos/Win8_RU-x64/win81b.0 label Win8-test2 MENU INDENT 5 MENU LABEL Win8-test2 kernel /winos/Win8_RU-x64/win81c.0 label returntomain menu label Return to ^main menu. menu exit menu end
ãã¹ãŠããŸãšãã
ãã³ãã¬ãŒããããããŒããã¡ã€ã«ãã¹ã¯ãªãããããŠã³ããŒãçšã®wimã€ã¡ãŒãžãäœæãããã¹ãŠé©åãªå Žæã«é 眮ããŸãã
ãããè¡ãããã«ããã¹ãåæã§cobblerããªã¬ãŒã䜿çšããããšã«ããŸããã
ãã¡ã€ã«ã®å
容/usr/lib/python2.7/site-packages/cobbler/modules/sync_post_wingen.py
import distutils.sysconfig import sys import os import traceback import cexceptions import os import re import xmlrpclib import pefile import cobbler.module_loader as module_loader import cobbler.utils as utils import cobbler.config as config import cobbler.templar as templar template_dir = "/var/lib/tftpboot/winos/" sif_template_name = template_dir + "win_sif.template" post_inst_cmd_template_name = template_dir + "post_inst_cmd.template" startnet_template_name = template_dir + "startnet.template" wim7_template_name = template_dir + "winpe7.template" wim8_template_name = template_dir + "winpe8.template" wimlib = "/usr/bin/wimlib-imagex" wimlib_mount = wimlib + " mountrw" wimlib_umount = wimlib + " unmount" mount_point = "/mnt/wim" bcdedit = "/usr/local/bin/bcdedit.pl" plib = distutils.sysconfig.get_python_lib() mod_path="%s/cobbler" % plib sys.path.insert(0, mod_path) def register(): # this pure python trigger acts as if it were a legacy shell-trigger, but is much faster. # the return of this method indicates the trigger type return "/var/lib/cobbler/triggers/sync/post/*" def run( api, args, logger ): settings = api.settings() images = api.images() distros = api.distros() profiles = api.profiles() conf = config.Config( api ) templ = templar.Templar( conf ) rc = 0 template_win = open( post_inst_cmd_template_name ) tmpl_data = template_win.read() template_win.close() for distro in distros: if distro.breed == "windows": meta = utils.blender( api, False, distro ) if distro.kernel_options.has_key( "post_install" ): data = templ.render( tmpl_data, meta, None, distro ) pi_file = open( distro.kernel_options["post_install"], "w+" ) pi_file.write( data ) pi_file.close() template_win = open( sif_template_name ) tmpl_data = template_win.read() template_win.close() template_start = open( startnet_template_name ) tmplstart_data = template_start.read() template_start.close() logger.info( "\nWindows profiles:" ) for profile in profiles: distro = profile.get_conceptual_parent() if distro.breed == "windows": logger.info( 'Profile: ' + profile.name ) meta = utils.blender( api, False, profile ) (distro_path, pxeboot_name) = os.path.split( distro.kernel ) if profile.kernel_options.has_key( "sif" ): data = templ.render( tmpl_data, meta, None, profile ) if distro.os_version in ( "7", "2008", "8", "2012" ): sif_file_name = os.path.join( distro_path, 'sources', profile.kernel_options["sif"] ) else: sif_file_name = os.path.join( distro_path, profile.kernel_options["sif"] ) sif_file = open(sif_file_name, "w+" ) sif_file.write( data ) sif_file.close() logger.info( 'Build answer file: ' + sif_file_name ) if profile.kernel_options.has_key( "pxeboot" ) and profile.kernel_options.has_key( "bootmgr" ): wk_file_name = os.path.join( distro_path, profile.kernel_options["pxeboot"] ) wl_file_name = os.path.join( distro_path, profile.kernel_options["bootmgr"] ) logger.info( "Build PXEBoot: " + wk_file_name ) if distro.os_version in ( "7", "2008", "8", "2012" ): if len(profile.kernel_options["bootmgr"]) != 11: logger.error( "The loader name should be EXACTLY 11 character" ) return 1 if profile.kernel_options.has_key( "bcd" ): if len(profile.kernel_options["bcd"]) != 3: logger.error( "The BCD name should be EXACTLY 5 character" ) return 1 tl_file_name = os.path.join( distro_path, 'bootmgr.exe' ) pat1 = re.compile( r'bootmgr\.exe', re.IGNORECASE ) pat2 = re.compile( r'(\\.Boot\\.)(B)(.)(C)(.)(D)', re.IGNORECASE ) bcd_name = 'BCD' if profile.kernel_options.has_key( "bcd" ): bcd_name = profile.kernel_options["bcd"] bcd_name = "\\g<1>" + bcd_name[0] + "\\g<3>" + bcd_name[1] + "\\g<5>" + bcd_name[2] data = open( tl_file_name, 'rb').read() out = pat2.sub( bcd_name, data ) else: if len(profile.kernel_options["bootmgr"]) != 5: logger.error( "The loader name should be EXACTLY 5 character" ) return 1 if len(profile.kernel_options["sif"]) != 9: logger.error( "The response should be EXACTLY 9 character" ) return 1 tl_file_name = os.path.join( distro_path, 'setupldr.exe' ) pat1 = re.compile( r'NTLDR', re.IGNORECASE ) pat2 = re.compile( r'winnt\.sif', re.IGNORECASE) data = open( tl_file_name, 'rb').read() out = pat2.sub( profile.kernel_options["sif"], data ) logger.info( 'Build Loader: ' + wl_file_name ) if out != data: open(wl_file_name, 'wb+').write(out) if distro.os_version in ( "7", "2008", "8", "2012" ): pe = pefile.PE( wl_file_name, fast_load=True ) pe.OPTIONAL_HEADER.CheckSum = pe.generate_checksum() pe.write( filename=wl_file_name ) data = open(distro.kernel, 'rb').read() out = pat1.sub( profile.kernel_options["bootmgr"], data ) if out != data: open(wk_file_name, 'wb+').write(out) if profile.kernel_options.has_key( "bcd" ): obcd_file_name = os.path.join( distro_path, 'boot', 'BCD' ) bcd_file_name = os.path.join( distro_path, 'boot', profile.kernel_options["bcd"] ) wim_file_name = 'winpe.wim' if profile.kernel_options.has_key( "winpe" ): wim_file_name = profile.kernel_options["winpe"] wim_file_name = os.path.join( '/winos', distro.name, 'boot', wim_file_name ) sdi_file_name = os.path.join( '/winos', distro.name, 'boot', 'boot.sdi' ) logger.info( 'Build BCD: ' + bcd_file_name + ' for ' + wim_file_name ) cmd = "/usr/bin/cp " + obcd_file_name + " " + bcd_file_name rc = utils.subprocess_call( logger, cmd, shell=True ) cmd = bcdedit + " " + bcd_file_name + " " + wim_file_name + " " + sdi_file_name rc = utils.subprocess_call( logger, cmd, shell=True ) ps_file_name = os.path.join( distro_path, "boot", profile.kernel_options["winpe"] ) if distro.os_version in ( "7", "2008" ): wim_pl_name = wim7_template_name elif distro.os_version in ( "8", "2012" ): wim_pl_name = wim8_template_name cmd = "/usr/bin/cp " + wim_pl_name + " " + ps_file_name rc = utils.subprocess_call( logger, cmd, shell=True ) if os.path.exists( wimlib ): cmd = wimlib_mount + " " + ps_file_name + " " + mount_point rc = utils.subprocess_call( logger, cmd, shell=True ) data = templ.render( tmplstart_data, meta, None, profile ) pi_file = open( mount_point + "/Windows/System32/startnet.cmd", "w+" ) pi_file.write( data ) pi_file.close() cmd = wimlib_umount + " " + mount_point + " --commit --rebuild" rc = utils.subprocess_get( logger, cmd, shell=True ) return 0
ããã¯ãCobbler APIã䜿çšããéåžžã®Pythonã¹ã¯ãªããã§ãããã®äœæ¥ã®ããã«ãpefileã䜿çšããŠbootmgr.exeã®ãã§ãã¯ãµã ãåèšç®ããbcdedit.plã§BCDãšwimlibã©ã€ãã©ãªãå€æŽããŠã€ã¡ãŒãžãããŠã³ããããã³ãã¬ãŒãããäœæãããstartnet.cmdãã¡ã€ã«ãWindows / System32ãã©ã«ããŒã«ã³ããŒããŸãã
ã³ãã³ããå®è¡ããŸãã
# mkdir /mnt/wim # systemctl restart cobblerd # cobbler sync # systemctl restart xinetd
次ã«ããããã¯ãŒã¯çµç±ã§ã€ã³ã¹ããŒã«ããä»®æ³ãã·ã³ãäœæããããéåžžã®ã³ã³ãã¥ãŒã¿ãŒã§ãªã»ãããF12ãã¿ã³ïŒãŸãã¯ãããã®ç®çã®ããã«BIOSã«æžã蟌ãŸãããã®ïŒãæŒããã¡ãã¥ãŒã§ç®çã®é ç®ãéžæããLinuxãšWindowsã®äž¡æ¹ã®èªåãããã¯ãŒã¯ã€ã³ã¹ããŒã«ãã楜ãã¿ãã ããã
å¿ èŠã«å¿ããŠãwin.ksã§æ¡ä»¶ä»ãã³ãŒãçæã䜿çšããŠã¹ã¯ãªãããå€æŽããŸãããã®ãã¡ã€ã«ã®ããããŒã«ã¯ãæåã«ã€ã³ã¹ããŒã«ãªãã·ã§ã³ã«å¿ èŠãªäžè¬çãªéšåãããã次ã«é·ãif / elseããããŸãã
#if $profile_name == '<profile_name1>' <code> #elseif $profile_name == '<profile_name2>' <code> . . . #elseif $profile_name == '<profile_nameN>' <code> #end if
éè€ããã³ãŒããŸãã¯è«ççã«éããã³ãŒãã¯ã¹ããããã§ã¬ã³ããªã³ã°ãããŸãã
äžè¶³ããŠãããã®
- Windowsãã£ã¹ããªãã¥ãŒã·ã§ã³ã®ã€ã³ããŒãã¯æ©èœããŸãããMicrosoftã¯æ°ããããŒãžã§ã³ãããã»ã©é »ç¹ã«ãªãªãŒã¹ããªãã®ã§ãããªãã¯ãããçãæ®ãããšãã§ããŸãã
- Windowsãã£ã¹ããªãã¥ãŒã·ã§ã³ã®ISOã€ã¡ãŒãžã®äœæã¯æ©èœããŸããïŒç¢ºèªããããšããããŸããã§ããïŒã
- PXE cobbler Windows .
- , /etc/tftpd.rules. , .