define.sh 62 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944
  1. #!/usr/bin/env bash
  2. set -Eeuo pipefail
  3. : "${KEY:=""}"
  4. : "${WIDTH:=""}"
  5. : "${HEIGHT:=""}"
  6. : "${VERIFY:=""}"
  7. : "${REGION:=""}"
  8. : "${EDITION:=""}"
  9. : "${MANUAL:=""}"
  10. : "${REMOVE:=""}"
  11. : "${VERSION:=""}"
  12. : "${DETECTED:=""}"
  13. : "${KEYBOARD:=""}"
  14. : "${LANGUAGE:=""}"
  15. : "${USERNAME:=""}"
  16. : "${PASSWORD:=""}"
  17. MIRRORS=4
  18. parseVersion() {
  19. if [[ "${VERSION}" == \"*\" || "${VERSION}" == \'*\' ]]; then
  20. VERSION="${VERSION:1:-1}"
  21. fi
  22. VERSION=$(expr "$VERSION" : "^\ *\(.*[^ ]\)\ *$")
  23. [ -z "$VERSION" ] && VERSION="win11"
  24. case "${VERSION,,}" in
  25. "11" | "11p" | "win11" | "pro11" | "win11p" | "windows11" | "windows 11" )
  26. VERSION="win11x64"
  27. ;;
  28. "11e" | "win11e" | "windows11e" | "windows 11e" )
  29. VERSION="win11x64-enterprise-eval"
  30. ;;
  31. "11i" | "11iot" | "iot11" | "win11i" | "win11-iot" | "win11x64-iot" )
  32. VERSION="win11x64-enterprise-iot-eval"
  33. [ -z "$DETECTED" ] && DETECTED="win11x64-iot"
  34. ;;
  35. "11l" | "11ltsc" | "ltsc11" | "win11l" | "win11-ltsc" | "win11x64-ltsc" )
  36. VERSION="win11x64-enterprise-ltsc-eval"
  37. [ -z "$DETECTED" ] && DETECTED="win11x64-ltsc"
  38. ;;
  39. "10" | "10p" | "win10" | "pro10" | "win10p" | "windows10" | "windows 10" )
  40. VERSION="win10x64"
  41. ;;
  42. "10e" | "win10e" | "windows10e" | "windows 10e" )
  43. VERSION="win10x64-enterprise-eval"
  44. ;;
  45. "10i" | "10iot" | "iot10" | "win10i" | "win10-iot" | "win10x64-iot" )
  46. VERSION="win10x64-enterprise-iot-eval"
  47. [ -z "$DETECTED" ] && DETECTED="win10x64-iot"
  48. ;;
  49. "10l" | "10ltsc" | "ltsc10" | "win10l" | "win10-ltsc" | "win10x64-ltsc" )
  50. VERSION="win10x64-enterprise-ltsc-eval"
  51. [ -z "$DETECTED" ] && DETECTED="win10x64-ltsc"
  52. ;;
  53. "8" | "8p" | "81" | "81p" | "pro8" | "8.1" | "win8" | "win8p" | "win81" | "win81p" | "windows 8" )
  54. VERSION="win81x64"
  55. ;;
  56. "8e" | "81e" | "8.1e" | "win8e" | "win81e" | "windows 8e" )
  57. VERSION="win81x64-enterprise-eval"
  58. ;;
  59. "7" | "win7" | "windows7" | "windows 7" )
  60. VERSION="win7x64"
  61. [ -z "$DETECTED" ] && DETECTED="win7x64-ultimate"
  62. ;;
  63. "7u" | "win7u" | "windows7u" | "windows 7u" )
  64. VERSION="win7x64-ultimate"
  65. ;;
  66. "7e" | "win7e" | "windows7e" | "windows 7e" )
  67. VERSION="win7x64-enterprise"
  68. ;;
  69. "7x86" | "win7x86" | "win732" | "windows7x86" )
  70. VERSION="win7x86"
  71. [ -z "$DETECTED" ] && DETECTED="win7x86-ultimate"
  72. ;;
  73. "7ux86" | "7u32" | "win7x86-ultimate" )
  74. VERSION="win7x86-ultimate"
  75. ;;
  76. "7ex86" | "7e32" | "win7x86-enterprise" )
  77. VERSION="win7x86-enterprise"
  78. ;;
  79. "vista" | "vs" | "6" | "winvista" | "windowsvista" | "windows vista" )
  80. VERSION="winvistax64"
  81. [ -z "$DETECTED" ] && DETECTED="winvistax64-ultimate"
  82. ;;
  83. "vistu" | "vu" | "6u" | "winvistu" )
  84. VERSION="winvistax64-ultimate"
  85. ;;
  86. "viste" | "ve" | "6e" | "winviste" )
  87. VERSION="winvistax64-enterprise"
  88. ;;
  89. "vistax86" | "vista32" | "6x86" | "winvistax86" | "windowsvistax86" )
  90. VERSION="winvistax86"
  91. [ -z "$DETECTED" ] && DETECTED="winvistax86-ultimate"
  92. ;;
  93. "vux86" | "vu32" | "winvistax86-ultimate" )
  94. VERSION="winvistax86-ultimate"
  95. ;;
  96. "vex86" | "ve32" | "winvistax86-enterprise" )
  97. VERSION="winvistax86-enterprise"
  98. ;;
  99. "xp" | "xp32" | "xpx86" | "5" | "5x86" | "winxp" | "winxp86" | "windowsxp" | "windows xp" )
  100. VERSION="winxpx86"
  101. ;;
  102. "xp64" | "xpx64" | "5x64" | "winxp64" | "winxpx64" | "windowsxp64" | "windowsxpx64" )
  103. VERSION="winxpx64"
  104. ;;
  105. "2k" | "2000" | "win2k" | "win2000" | "windows2k" | "windows2000" )
  106. VERSION="win2kx86"
  107. ;;
  108. "25" | "2025" | "win25" | "win2025" | "windows2025" | "windows 2025" )
  109. VERSION="win2025-eval"
  110. ;;
  111. "22" | "2022" | "win22" | "win2022" | "windows2022" | "windows 2022" )
  112. VERSION="win2022-eval"
  113. ;;
  114. "19" | "2019" | "win19" | "win2019" | "windows2019" | "windows 2019" )
  115. VERSION="win2019-eval"
  116. ;;
  117. "16" | "2016" | "win16" | "win2016" | "windows2016" | "windows 2016" )
  118. VERSION="win2016-eval"
  119. ;;
  120. "hv" | "hyperv" | "hyper v" | "hyper-v" | "19hv" | "2019hv" | "win2019hv" )
  121. VERSION="win2019-hv"
  122. ;;
  123. "2012" | "2012r2" | "win2012" | "win2012r2" | "windows2012" | "windows 2012" )
  124. VERSION="win2012r2-eval"
  125. ;;
  126. "2008" | "2008r2" | "win2008" | "win2008r2" | "windows2008" | "windows 2008" )
  127. VERSION="win2008r2"
  128. ;;
  129. "2003" | "2003r2" | "win2003" | "win2003r2" | "windows2003" | "windows 2003" )
  130. VERSION="win2003r2"
  131. ;;
  132. "nano11" | "nano 11" )
  133. VERSION="nano11"
  134. [ -z "$DETECTED" ] && DETECTED="win11x64"
  135. ;;
  136. "core11" | "core 11" )
  137. VERSION="core11"
  138. [ -z "$DETECTED" ] && DETECTED="win11x64"
  139. ;;
  140. "tiny11" | "tiny 11" )
  141. VERSION="tiny11"
  142. [ -z "$DETECTED" ] && DETECTED="win11x64"
  143. ;;
  144. "tiny10" | "tiny 10" )
  145. VERSION="tiny10"
  146. [ -z "$DETECTED" ] && DETECTED="win10x64-ltsc"
  147. ;;
  148. esac
  149. return 0
  150. }
  151. getLanguage() {
  152. local id="$1"
  153. local ret="$2"
  154. local lang=""
  155. local desc=""
  156. local short=""
  157. local culture=""
  158. case "${id,,}" in
  159. "ar" | "ar-"* )
  160. short="ar"
  161. lang="Arabic"
  162. desc="$lang"
  163. culture="ar-SA" ;;
  164. "bg" | "bg-"* )
  165. short="bg"
  166. lang="Bulgarian"
  167. desc="$lang"
  168. culture="bg-BG" ;;
  169. "cs" | "cs-"* | "cz" | "cz-"* )
  170. short="cs"
  171. lang="Czech"
  172. desc="$lang"
  173. culture="cs-CZ" ;;
  174. "da" | "da-"* | "dk" | "dk-"* )
  175. short="da"
  176. lang="Danish"
  177. desc="$lang"
  178. culture="da-DK" ;;
  179. "de" | "de-"* )
  180. short="de"
  181. lang="German"
  182. desc="$lang"
  183. culture="de-DE" ;;
  184. "el" | "el-"* | "gr" | "gr-"* )
  185. short="el"
  186. lang="Greek"
  187. desc="$lang"
  188. culture="el-GR" ;;
  189. "gb" | "en-gb" )
  190. short="en-gb"
  191. lang="English International"
  192. desc="English"
  193. culture="en-GB" ;;
  194. "en" | "en-"* )
  195. short="en"
  196. lang="English"
  197. desc="English"
  198. culture="en-US" ;;
  199. "mx" | "es-mx" )
  200. short="mx"
  201. lang="Spanish (Mexico)"
  202. desc="Spanish"
  203. culture="es-MX" ;;
  204. "es" | "es-"* )
  205. short="es"
  206. lang="Spanish"
  207. desc="$lang"
  208. culture="es-ES" ;;
  209. "et" | "et-"* )
  210. short="et"
  211. lang="Estonian"
  212. desc="$lang"
  213. culture="et-EE" ;;
  214. "fi" | "fi-"* )
  215. short="fi"
  216. lang="Finnish"
  217. desc="$lang"
  218. culture="fi-FI" ;;
  219. "ca" | "fr-ca" )
  220. short="ca"
  221. lang="French Canadian"
  222. desc="French"
  223. culture="fr-CA" ;;
  224. "fr" | "fr-"* )
  225. short="fr"
  226. lang="French"
  227. desc="$lang"
  228. culture="fr-FR" ;;
  229. "he" | "he-"* | "il" | "il-"* )
  230. short="he"
  231. lang="Hebrew"
  232. desc="$lang"
  233. culture="he-IL" ;;
  234. "hr" | "hr-"* | "cr" | "cr-"* )
  235. short="hr"
  236. lang="Croatian"
  237. desc="$lang"
  238. culture="hr-HR" ;;
  239. "hu" | "hu-"* )
  240. short="hu"
  241. lang="Hungarian"
  242. desc="$lang"
  243. culture="hu-HU" ;;
  244. "it" | "it-"* )
  245. short="it"
  246. lang="Italian"
  247. desc="$lang"
  248. culture="it-IT" ;;
  249. "ja" | "ja-"* | "jp" | "jp-"* )
  250. short="ja"
  251. lang="Japanese"
  252. desc="$lang"
  253. culture="ja-JP" ;;
  254. "ko" | "ko-"* | "kr" | "kr-"* )
  255. short="ko"
  256. lang="Korean"
  257. desc="$lang"
  258. culture="ko-KR" ;;
  259. "lt" | "lt-"* )
  260. short="lt"
  261. lang="Lithuanian"
  262. desc="$lang"
  263. culture="lt-LT" ;;
  264. "lv" | "lv-"* )
  265. short="lv"
  266. lang="Latvian"
  267. desc="$lang"
  268. culture="lv-LV" ;;
  269. "nb" | "nb-"* |"nn" | "nn-"* | "no" | "no-"* )
  270. short="no"
  271. lang="Norwegian"
  272. desc="$lang"
  273. culture="nb-NO" ;;
  274. "nl" | "nl-"* )
  275. short="nl"
  276. lang="Dutch"
  277. desc="$lang"
  278. culture="nl-NL" ;;
  279. "pl" | "pl-"* )
  280. short="pl"
  281. lang="Polish"
  282. desc="$lang"
  283. culture="pl-PL" ;;
  284. "br" | "pt-br" )
  285. short="pt"
  286. lang="Brazilian Portuguese"
  287. desc="Portuguese"
  288. culture="pt-BR" ;;
  289. "pt" | "pt-"* )
  290. short="pp"
  291. lang="Portuguese"
  292. desc="$lang"
  293. culture="pt-BR" ;;
  294. "ro" | "ro-"* )
  295. short="ro"
  296. lang="Romanian"
  297. desc="$lang"
  298. culture="ro-RO" ;;
  299. "ru" | "ru-"* )
  300. short="ru"
  301. lang="Russian"
  302. desc="$lang"
  303. culture="ru-RU" ;;
  304. "sk" | "sk-"* )
  305. short="sk"
  306. lang="Slovak"
  307. desc="$lang"
  308. culture="sk-SK" ;;
  309. "sl" | "sl-"* | "si" | "si-"* )
  310. short="sl"
  311. lang="Slovenian"
  312. desc="$lang"
  313. culture="sl-SI" ;;
  314. "sr" | "sr-"* )
  315. short="sr"
  316. lang="Serbian Latin"
  317. desc="Serbian"
  318. culture="sr-Latn-RS" ;;
  319. "sv" | "sv-"* | "se" | "se-"* )
  320. short="sv"
  321. lang="Swedish"
  322. desc="$lang"
  323. culture="sv-SE" ;;
  324. "th" | "th-"* )
  325. short="th"
  326. lang="Thai"
  327. desc="$lang"
  328. culture="th-TH" ;;
  329. "tr" | "tr-"* )
  330. short="tr"
  331. lang="Turkish"
  332. desc="$lang"
  333. culture="tr-TR" ;;
  334. "ua" | "ua-"* | "uk" | "uk-"* )
  335. short="uk"
  336. lang="Ukrainian"
  337. desc="$lang"
  338. culture="uk-UA" ;;
  339. "hk" | "zh-hk" | "cn-hk" )
  340. short="hk"
  341. lang="Chinese (Traditional)"
  342. desc="Chinese HK"
  343. culture="zh-TW" ;;
  344. "tw" | "zh-tw" | "cn-tw" )
  345. short="tw"
  346. lang="Chinese (Traditional)"
  347. desc="Chinese TW"
  348. culture="zh-TW" ;;
  349. "zh" | "zh-"* | "cn" | "cn-"* )
  350. short="cn"
  351. lang="Chinese (Simplified)"
  352. desc="Chinese"
  353. culture="zh-CN" ;;
  354. esac
  355. case "${ret,,}" in
  356. "desc" ) echo "$desc" ;;
  357. "name" ) echo "$lang" ;;
  358. "code" ) echo "$short" ;;
  359. "culture" ) echo "$culture" ;;
  360. *) echo "$desc";;
  361. esac
  362. return 0
  363. }
  364. parseLanguage() {
  365. REGION="${REGION//_/-/}"
  366. KEYBOARD="${KEYBOARD//_/-/}"
  367. LANGUAGE="${LANGUAGE//_/-/}"
  368. [ -z "$LANGUAGE" ] && LANGUAGE="en"
  369. case "${LANGUAGE,,}" in
  370. "arabic" | "arab" ) LANGUAGE="ar" ;;
  371. "bulgarian" | "bu" ) LANGUAGE="bg" ;;
  372. "chinese" | "cn" ) LANGUAGE="zh" ;;
  373. "croatian" | "cr" | "hrvatski" ) LANGUAGE="hr" ;;
  374. "czech" | "cz" | "cesky" ) LANGUAGE="cs" ;;
  375. "danish" | "dk" | "danske" ) LANGUAGE="da" ;;
  376. "dutch" | "nederlands" ) LANGUAGE="nl" ;;
  377. "english" | "gb" | "british" ) LANGUAGE="en" ;;
  378. "estonian" | "eesti" ) LANGUAGE="et" ;;
  379. "finnish" | "suomi" ) LANGUAGE="fi" ;;
  380. "french" | "français" | "francais" ) LANGUAGE="fr" ;;
  381. "german" | "deutsch" ) LANGUAGE="de" ;;
  382. "greek" | "gr" ) LANGUAGE="el" ;;
  383. "hebrew" | "il" ) LANGUAGE="he" ;;
  384. "hungarian" | "magyar" ) LANGUAGE="hu" ;;
  385. "italian" | "italiano" ) LANGUAGE="it" ;;
  386. "japanese" | "jp" ) LANGUAGE="ja" ;;
  387. "korean" | "kr" ) LANGUAGE="ko" ;;
  388. "latvian" | "latvijas" ) LANGUAGE="lv" ;;
  389. "lithuanian" | "lietuvos" ) LANGUAGE="lt" ;;
  390. "norwegian" | "no" | "nb" | "norsk" ) LANGUAGE="nn" ;;
  391. "polish" | "polski" ) LANGUAGE="pl" ;;
  392. "portuguese" | "pt" | "br" ) LANGUAGE="pt-br" ;;
  393. "português" | "portugues" ) LANGUAGE="pt-br" ;;
  394. "romanian" | "română" | "romana" ) LANGUAGE="ro" ;;
  395. "russian" | "ruski" ) LANGUAGE="ru" ;;
  396. "serbian" | "serbian latin" ) LANGUAGE="sr" ;;
  397. "slovak" | "slovenský" | "slovensky" ) LANGUAGE="sk" ;;
  398. "slovenian" | "si" | "slovenski" ) LANGUAGE="sl" ;;
  399. "spanish" | "espanol" | "español" ) LANGUAGE="es" ;;
  400. "swedish" | "se" | "svenska" ) LANGUAGE="sv" ;;
  401. "turkish" | "türk" | "turk" ) LANGUAGE="tr" ;;
  402. "thai" ) LANGUAGE="th" ;;
  403. "ukrainian" | "ua" ) LANGUAGE="uk" ;;
  404. esac
  405. local culture
  406. culture=$(getLanguage "$LANGUAGE" "culture")
  407. [ -n "$culture" ] && return 0
  408. error "Invalid LANGUAGE specified, value \"$LANGUAGE\" is not recognized!"
  409. return 1
  410. }
  411. printVersion() {
  412. local id="$1"
  413. local desc="$2"
  414. case "${id,,}" in
  415. "tiny11"* ) desc="Tiny 11" ;;
  416. "tiny10"* ) desc="Tiny 10" ;;
  417. "core11"* ) desc="Core 11" ;;
  418. "nano11"* ) desc="Nano 11" ;;
  419. "win7"* ) desc="Windows 7" ;;
  420. "win8"* ) desc="Windows 8" ;;
  421. "win10"* ) desc="Windows 10" ;;
  422. "win11"* ) desc="Windows 11" ;;
  423. "winxp"* ) desc="Windows XP" ;;
  424. "win9x"* ) desc="Windows ME" ;;
  425. "win98"* ) desc="Windows 98" ;;
  426. "win95"* ) desc="Windows 95" ;;
  427. "win2k"* ) desc="Windows 2000" ;;
  428. "winvista"* ) desc="Windows Vista" ;;
  429. "win2019-hv"* ) desc="Hyper-V Server" ;;
  430. "win2003"* ) desc="Windows Server 2003" ;;
  431. "win2008"* ) desc="Windows Server 2008" ;;
  432. "win2012"* ) desc="Windows Server 2012" ;;
  433. "win2016"* ) desc="Windows Server 2016" ;;
  434. "win2019"* ) desc="Windows Server 2019" ;;
  435. "win2022"* ) desc="Windows Server 2022" ;;
  436. "win2025"* ) desc="Windows Server 2025" ;;
  437. esac
  438. if [ -z "$desc" ]; then
  439. desc="Windows"
  440. [[ "${PLATFORM,,}" != "x64" ]] && desc+=" for ${PLATFORM}"
  441. fi
  442. echo "$desc"
  443. return 0
  444. }
  445. printEdition() {
  446. local id="$1"
  447. local desc="$2"
  448. local result=""
  449. local edition=""
  450. result=$(printVersion "$id" "x")
  451. [[ "$result" == "x" ]] && echo "$desc" && return 0
  452. case "${id,,}" in
  453. *"-home" )
  454. edition="Home"
  455. ;;
  456. *"-starter" )
  457. edition="Starter"
  458. ;;
  459. *"-ultimate" )
  460. edition="Ultimate"
  461. ;;
  462. *"-enterprise" )
  463. edition="Enterprise"
  464. ;;
  465. *"-education" )
  466. edition="Education"
  467. ;;
  468. *"-hv" )
  469. edition="2019"
  470. ;;
  471. *"-iot" | *"-iot-eval" )
  472. edition="LTSC"
  473. ;;
  474. *"-ltsc" | *"-ltsc-eval" )
  475. edition="LTSC"
  476. ;;
  477. *"-enterprise-eval" )
  478. edition="Enterprise (Evaluation)"
  479. ;;
  480. "win7"* )
  481. edition="Professional"
  482. ;;
  483. "win8"* | "win10"* | "win11"* )
  484. edition="Pro"
  485. ;;
  486. "winxp"* )
  487. edition="Professional"
  488. ;;
  489. "winvista"* )
  490. edition="Business"
  491. ;;
  492. "win2025"* | "win2022"* | "win2019"* | "win2016"* | "win2012"* | "win2008"* | "win2003"* )
  493. case "${EDITION^^}" in
  494. *"DATACENTER"* ) edition="Datacenter" ;;
  495. "CORE" | "STANDARDCORE" ) edition="Core" ;;
  496. * ) edition="Standard" ;;
  497. esac
  498. ;;
  499. esac
  500. [ -n "$edition" ] && result+=" $edition"
  501. echo "$result"
  502. return 0
  503. }
  504. fromFile() {
  505. local id=""
  506. local desc="$1"
  507. local file="${1,,}"
  508. local arch="${PLATFORM,,}"
  509. file="${file//-/_}"
  510. file="${file// /_}"
  511. case "$file" in
  512. *"_x64_"* | *"_x64."*)
  513. arch="x64"
  514. ;;
  515. *"_x86_"* | *"_x86."*)
  516. arch="x86"
  517. ;;
  518. *"_arm64_"* | *"_arm64."*)
  519. arch="arm64"
  520. ;;
  521. esac
  522. local add=""
  523. [[ "$arch" != "x64" ]] && add="$arch"
  524. case "$file" in
  525. "win7"* | "win_7"* | *"windows7"* | *"windows_7"* )
  526. id="win7${arch}"
  527. ;;
  528. "win8"* | "win_8"* | *"windows8"* | *"windows_8"* )
  529. id="win81${arch}"
  530. ;;
  531. "win10"*| "win_10"* | *"windows10"* | *"windows_10"* )
  532. id="win10${arch}"
  533. ;;
  534. "win11"* | "win_11"* | *"windows11"* | *"windows_11"* )
  535. id="win11${arch}"
  536. ;;
  537. *"winxp"* | *"win_xp"* | *"windowsxp"* | *"windows_xp"* )
  538. id="winxpx86"
  539. ;;
  540. *"winvista"* | *"win_vista"* | *"windowsvista"* | *"windows_vista"* )
  541. id="winvista${arch}"
  542. ;;
  543. "nano11"* | "nano_11"* )
  544. id="nano11"
  545. ;;
  546. "tiny11core"* | "tiny11_core"* | "tiny_11_core"* )
  547. id="core11"
  548. ;;
  549. "tiny11"* | "tiny_11"* )
  550. id="tiny11"
  551. ;;
  552. "tiny10"* | "tiny_10"* )
  553. id="tiny10"
  554. ;;
  555. *"_serverhypercore_"* )
  556. id="win2019${add}-hv"
  557. ;;
  558. *"server2025"* | *"server_2025"* )
  559. id="win2025${add}"
  560. ;;
  561. *"server2022"* | *"server_2022"* )
  562. id="win2022${add}"
  563. ;;
  564. *"server2019"* | *"server_2019"* )
  565. id="win2019${add}"
  566. ;;
  567. *"server2016"* | *"server_2016"* )
  568. id="win2016${add}"
  569. ;;
  570. *"server2012"* | *"server_2012"* )
  571. id="win2012r2${add}"
  572. ;;
  573. *"server2008"* | *"server_2008"* )
  574. id="win2008r2${add}"
  575. ;;
  576. *"server2003"* | *"server_2003"* )
  577. id="win2003r2${add}"
  578. ;;
  579. esac
  580. if [ -n "$id" ]; then
  581. desc=$(printVersion "$id" "$desc")
  582. fi
  583. echo "$desc"
  584. return 0
  585. }
  586. fromName() {
  587. local id=""
  588. local name="$1"
  589. local arch="$2"
  590. local add=""
  591. [[ "$arch" != "x64" ]] && add="$arch"
  592. case "${name,,}" in
  593. *"windows 7"* ) id="win7${arch}" ;;
  594. *"windows 8"* ) id="win81${arch}" ;;
  595. *"windows 10"* ) id="win10${arch}" ;;
  596. *"optimum 10"* ) id="win10${arch}" ;;
  597. *"windows 11"* ) id="win11${arch}" ;;
  598. *"optimum 11"* ) id="win11${arch}" ;;
  599. *"windows vista"* ) id="winvista${arch}" ;;
  600. *"server 2025"* ) id="win2025${add}" ;;
  601. *"server 2022"* ) id="win2022${add}" ;;
  602. *"server 2019"* ) id="win2019${add}" ;;
  603. *"server 2016"* ) id="win2016${add}" ;;
  604. *"server 2012"* ) id="win2012r2${add}" ;;
  605. *"server 2008"* ) id="win2008r2${add}" ;;
  606. *"server 2003"* ) id="win2003r2${add}" ;;
  607. *"hyper-v server"* ) id="win2019${add}" ;;
  608. esac
  609. echo "$id"
  610. return 0
  611. }
  612. getVersion() {
  613. local id
  614. local name="$1"
  615. local arch="$2"
  616. id=$(fromName "$name" "$arch")
  617. case "${id,,}" in
  618. "win7"* | "winvista"* )
  619. case "${name,,}" in
  620. *" home"* ) id="$id-home" ;;
  621. *" starter"* ) id="$id-starter" ;;
  622. *" ultimate"* ) id="$id-ultimate" ;;
  623. *" enterprise evaluation"* ) id="$id-enterprise-eval" ;;
  624. *" enterprise"* ) id="$id-enterprise" ;;
  625. esac
  626. ;;
  627. "win8"* )
  628. case "${name,,}" in
  629. *" enterprise evaluation"* ) id="$id-enterprise-eval" ;;
  630. *" enterprise"* ) id="$id-enterprise" ;;
  631. esac
  632. ;;
  633. "win10"* | "win11"* )
  634. case "${name,,}" in
  635. *" iot"* ) id="$id-iot" ;;
  636. *" ltsc"* ) id="$id-ltsc" ;;
  637. *" home"* ) id="$id-home" ;;
  638. *" education"* ) id="$id-education" ;;
  639. *" enterprise evaluation"* ) id="$id-enterprise-eval" ;;
  640. *" enterprise"* ) id="$id-enterprise" ;;
  641. esac
  642. ;;
  643. "win2025"* | "win2022"* | "win2019"* | "win2016"* | "win2012"* | "win2008"* | "win2003"* )
  644. case "${name,,}" in
  645. *" evaluation"* ) id="$id-eval" ;;
  646. *"hyper-v server"* ) id="$id-hv" ;;
  647. esac
  648. ;;
  649. esac
  650. echo "$id"
  651. return 0
  652. }
  653. switchEdition() {
  654. local id="$1"
  655. if [[ "${id,,}" == *"-eval" ]]; then
  656. [ -z "$DETECTED" ] && DETECTED="${id::-5}"
  657. fi
  658. return 0
  659. }
  660. getMido() {
  661. local id="$1"
  662. local lang="$2"
  663. local ret="$3"
  664. local url=""
  665. local sum=""
  666. local size=""
  667. [[ "${lang,,}" != "en" && "${lang,,}" != "en-us" ]] && return 0
  668. case "${id,,}" in
  669. "win11x64" )
  670. size=7736125440
  671. sum="d141f6030fed50f75e2b03e1eb2e53646c4b21e5386047cb860af5223f102a32"
  672. url="https://software-static.download.prss.microsoft.com/dbazure/888969d5-f34g-4e03-ac9d-1f9786c66749/26200.6584.250915-1905.25h2_ge_release_svc_refresh_CLIENT_CONSUMER_x64FRE_en-us.iso"
  673. ;;
  674. "win11x64-enterprise-eval" )
  675. size=7092807680
  676. sum="a61adeab895ef5a4db436e0a7011c92a2ff17bb0357f58b13bbc4062e535e7b9"
  677. url="https://software-static.download.prss.microsoft.com/dbazure/888969d5-f34g-4e03-ac9d-1f9786c66749/26200.6584.250915-1905.25h2_ge_release_svc_refresh_CLIENTENTERPRISEEVAL_OEMRET_x64FRE_en-us.iso"
  678. ;;
  679. "win11x64-enterprise-iot-eval" | "win11x64-enterprise-ltsc-eval" )
  680. size=5060020224
  681. sum="2cee70bd183df42b92a2e0da08cc2bb7a2a9ce3a3841955a012c0f77aeb3cb29"
  682. url="https://software-static.download.prss.microsoft.com/dbazure/888969d5-f34g-4e03-ac9d-1f9786c66749/26100.1.240331-1435.ge_release_CLIENT_IOT_LTSC_EVAL_x64FRE_en-us.iso"
  683. ;;
  684. "win10x64" )
  685. size=6140975104
  686. sum="a6f470ca6d331eb353b815c043e327a347f594f37ff525f17764738fe812852e"
  687. ;;
  688. "win10x64-enterprise-eval" )
  689. size=5550497792
  690. sum="ef7312733a9f5d7d51cfa04ac497671995674ca5e1058d5164d6028f0938d668"
  691. url="https://software-static.download.prss.microsoft.com/dbazure/988969d5-f34g-4e03-ac9d-1f9786c66750/19045.2006.220908-0225.22h2_release_svc_refresh_CLIENTENTERPRISEEVAL_OEMRET_x64FRE_en-us.iso"
  692. ;;
  693. "win10x64-enterprise-ltsc-eval" )
  694. size=4898582528
  695. sum="e4ab2e3535be5748252a8d5d57539a6e59be8d6726345ee10e7afd2cb89fefb5"
  696. url="https://software-download.microsoft.com/download/pr/19044.1288.211006-0501.21h2_release_svc_refresh_CLIENT_LTSC_EVAL_x64FRE_en-us.iso"
  697. ;;
  698. "win81x64-enterprise-eval" )
  699. size=3961473024
  700. sum="2dedd44c45646c74efc5a028f65336027e14a56f76686a4631cf94ffe37c72f2"
  701. url="https://download.microsoft.com/download/B/9/9/B999286E-0A47-406D-8B3D-5B5AD7373A4A/9600.17050.WINBLUE_REFRESH.140317-1640_X64FRE_ENTERPRISE_EVAL_EN-US-IR3_CENA_X64FREE_EN-US_DV9.ISO"
  702. ;;
  703. "win2025-eval" )
  704. size=6014152704
  705. sum="d0ef4502e350e3c6c53c15b1b3020d38a5ded011bf04998e950720ac8579b23d"
  706. url="https://software-static.download.prss.microsoft.com/dbazure/888969d5-f34g-4e03-ac9d-1f9786c66749/26100.1742.240906-0331.ge_release_svc_refresh_SERVER_EVAL_x64FRE_en-us.iso"
  707. ;;
  708. "win2022-eval" )
  709. size=5044094976
  710. sum="3e4fa6d8507b554856fc9ca6079cc402df11a8b79344871669f0251535255325"
  711. url="https://software-static.download.prss.microsoft.com/sg/download/888969d5-f34g-4e03-ac9d-1f9786c66749/SERVER_EVAL_x64FRE_en-us.iso"
  712. ;;
  713. "win2019-eval" )
  714. size=5652088832
  715. sum="6dae072e7f78f4ccab74a45341de0d6e2d45c39be25f1f5920a2ab4f51d7bcbb"
  716. url="https://software-download.microsoft.com/download/pr/17763.737.190906-2324.rs5_release_svc_refresh_SERVER_EVAL_x64FRE_en-us_1.iso"
  717. ;;
  718. "win2019-hv" )
  719. size=3072712704
  720. sum="48e9b944518e5bbc80876a9a7ff99716f386f404f4be48dca47e16a66ae7872c"
  721. url="https://software-download.microsoft.com/download/pr/17763.557.190612-0019.rs5_release_svc_refresh_SERVERHYPERCORE_OEM_x64FRE_en-us.ISO"
  722. ;;
  723. "win2016-eval" )
  724. size=6972221440
  725. sum="1ce702a578a3cb1ac3d14873980838590f06d5b7101c5daaccbac9d73f1fb50f"
  726. url="https://software-download.microsoft.com/download/pr/Windows_Server_2016_Datacenter_EVAL_en-us_14393_refresh.ISO"
  727. ;;
  728. "win2012r2-eval" )
  729. size=4542291968
  730. sum="6612b5b1f53e845aacdf96e974bb119a3d9b4dcb5b82e65804ab7e534dc7b4d5"
  731. url="https://download.microsoft.com/download/6/2/A/62A76ABB-9990-4EFC-A4FE-C7D698DAEB96/9600.17050.WINBLUE_REFRESH.140317-1640_X64FRE_SERVER_EVAL_EN-US-IR3_SSS_X64FREE_EN-US_DV9.ISO"
  732. ;;
  733. "win2008r2" )
  734. size=3166840832
  735. sum="30832ad76ccfa4ce48ccb936edefe02079d42fb1da32201bf9e3a880c8ed6312"
  736. url="https://download.microsoft.com/download/4/1/D/41DEA7E0-B30D-4012-A1E3-F24DC03BA1BB/7601.17514.101119-1850_x64fre_server_eval_en-us-GRMSXEVAL_EN_DVD.iso"
  737. ;;
  738. esac
  739. case "${ret,,}" in
  740. "sum" ) echo "$sum" ;;
  741. "size" ) echo "$size" ;;
  742. *) echo "$url";;
  743. esac
  744. return 0
  745. }
  746. getLink1() {
  747. # Fallbacks for users who cannot connect to the Microsoft servers
  748. local id="$1"
  749. local lang="$2"
  750. local ret="$3"
  751. local url=""
  752. local sum=""
  753. local size=""
  754. local host="https://dl.bobpony.com/windows"
  755. [[ "${lang,,}" != "en" && "${lang,,}" != "en-us" ]] && return 0
  756. case "${id,,}" in
  757. "win11x64" | "win11x64-enterprise" | "win11x64-enterprise-eval" )
  758. size=5332989952
  759. sum="aa1ad990f930d907b7a34ea897abbb0dfbe47552ca8acc146f92e40381839e05"
  760. url="11/en-us_windows_11_24h2_x64.iso"
  761. ;;
  762. "win11x64-iot" | "win11x64-enterprise-iot" | "win11x64-enterprise-iot-eval" )
  763. size=5144817664
  764. sum="4f59662a96fc1da48c1b415d6c369d08af55ddd64e8f1c84e0166d9e50405d7a"
  765. url="11/X23-81951_26100.1742.240906-0331.ge_release_svc_refresh_CLIENT_ENTERPRISES_OEM_x64FRE_en-us.iso"
  766. ;;
  767. "win11x64-ltsc" | "win11x64-enterprise-ltsc" | "win11x64-enterprise-ltsc-eval" )
  768. size=5144817664
  769. sum="4f59662a96fc1da48c1b415d6c369d08af55ddd64e8f1c84e0166d9e50405d7a"
  770. url="11/X23-81951_26100.1742.240906-0331.ge_release_svc_refresh_CLIENT_ENTERPRISES_OEM_x64FRE_en-us.iso"
  771. ;;
  772. "win10x64" | "win10x64-enterprise" | "win10x64-enterprise-eval" )
  773. size=5535252480
  774. sum="557871965263d0fd0a1ea50b5d0d0d7cb04a279148ca905c1c675c9bc0d5486c"
  775. url="10/en-us_windows_10_22h2_x64.iso"
  776. ;;
  777. "win10x64-iot" | "win10x64-enterprise-iot" | "win10x64-enterprise-iot-eval" )
  778. size=4851668992
  779. sum="a0334f31ea7a3e6932b9ad7206608248f0bd40698bfb8fc65f14fc5e4976c160"
  780. url="10/en-us_windows_10_iot_enterprise_ltsc_2021_x64_dvd_257ad90f.iso"
  781. ;;
  782. "win10x64-ltsc" | "win10x64-enterprise-ltsc" | "win10x64-enterprise-ltsc-eval" )
  783. size=4899461120
  784. sum="c90a6df8997bf49e56b9673982f3e80745058723a707aef8f22998ae6479597d"
  785. url="10/en-us_windows_10_enterprise_ltsc_2021_x64_dvd_d289cf96.iso"
  786. ;;
  787. "win81x64" )
  788. size=4320526336
  789. sum="d8333cf427eb3318ff6ab755eb1dd9d433f0e2ae43745312c1cd23e83ca1ce51"
  790. url="8.x/8.1/en_windows_8.1_with_update_x64_dvd_6051480.iso"
  791. ;;
  792. "win81x64-enterprise" | "win81x64-enterprise-eval" )
  793. size=4139163648
  794. sum="c3c604c03677504e8905090a8ce5bb1dde76b6fd58e10f32e3a25bef21b2abe1"
  795. url="8.x/8.1/en_windows_8.1_enterprise_with_update_x64_dvd_6054382.iso"
  796. ;;
  797. "win2025" | "win2025-eval" )
  798. size=7571058688
  799. sum="d273d0a85565ffbc06a3d46313f619103e2830a3373306ddbb9a08b8824f509d"
  800. url="server/2025/en-us_windows_server_2025_updated_oct_2025_x64_dvd_6c0c5aa8.iso"
  801. ;;
  802. "win2022" | "win2022-eval" )
  803. size=6023239680
  804. sum="5d6d91efa972cbdd6701d78db1dcf6a34c7024ca931c1718e7cb3d0c6dd54e88"
  805. url="server/2022/en-us_windows_server_2022_updated_oct_2025_x64_dvd_26e9af36.iso"
  806. ;;
  807. "win2019" | "win2019-eval" )
  808. size=5575774208
  809. sum="0067afe7fdc4e61f677bd8c35a209082aa917df9c117527fc4b2b52a447e89bb"
  810. url="server/2019/en-us_windows_server_2019_updated_aug_2021_x64_dvd_a6431a28.iso"
  811. ;;
  812. "win2016" | "win2016-eval" )
  813. size=6006587392
  814. sum="af06e5483c786c023123e325cea4775050324d9e1366f46850b515ae43f764be"
  815. url="server/2016/en_windows_server_2016_updated_feb_2018_x64_dvd_11636692.iso"
  816. ;;
  817. "win2012r2" | "win2012r2-eval" )
  818. size=5397889024
  819. sum="f351e89eb88a96af4626ceb3450248b8573e3ed5924a4e19ea891e6003b62e4e"
  820. url="server/2012r2/en_windows_server_2012_r2_with_update_x64_dvd_6052708-004.iso"
  821. ;;
  822. "win2008r2" | "win2008r2-eval" )
  823. size=3166584832
  824. sum="dfd9890881b7e832a927c38310fb415b7ea62ac5a896671f2ce2a111998f0df8"
  825. url="server/2008r2/en_windows_server_2008_r2_with_sp1_x64_dvd_617601-018.iso"
  826. ;;
  827. "win7x64" | "win7x64-ultimate" )
  828. size=3320836096
  829. sum="0b738b55a5ea388ad016535a5c8234daf2e5715a0638488ddd8a228a836055a1"
  830. url="7/en_windows_7_with_sp1_x64.iso"
  831. ;;
  832. "win7x64-enterprise" | "win7x64-enterprise-eval" )
  833. size=3182604288
  834. sum="ee69f3e9b86ff973f632db8e01700c5724ef78420b175d25bae6ead90f6805a7"
  835. url="7/en_windows_7_enterprise_with_sp1_x64_dvd_u_677651.iso"
  836. ;;
  837. "win7x86" | "win7x86-ultimate" )
  838. size=2564411392
  839. sum="99f3369c90160816be07093dbb0ac053e0a84e52d6ed1395c92ae208ccdf67e5"
  840. url="7/en_windows_7_with_sp1_x86.iso"
  841. ;;
  842. "win7x86-enterprise" | "win7x86-enterprise-eval" )
  843. size=2434502656
  844. sum="8bdd46ff8cb8b8de9c4aba02706629c8983c45e87da110e64e13be17c8434dad"
  845. url="7/en_windows_7_enterprise_with_sp1_x86_dvd_u_677710.iso"
  846. ;;
  847. "winvistax64" | "winvistax64-ultimate" )
  848. size=3861460992
  849. sum="edf9f947c5791469fd7d2d40a5dcce663efa754f91847aa1d28ed7f585675b78"
  850. url="vista/en_windows_vista_sp2_x64_dvd_342267.iso"
  851. ;;
  852. "winvistax86" | "winvistax86-ultimate" )
  853. size=3243413504
  854. sum="9c36fed4255bd05a8506b2da88f9aad73643395e155e609398aacd2b5276289c"
  855. url="vista/en_windows_vista_with_sp2_x86_dvd_342266.iso"
  856. ;;
  857. "win2003r2" )
  858. size=731650535
  859. sum="6b64bbae7eb00fd000cc887ffdc9f224d00c557daad7f756cfa373950b880dc8"
  860. url="server/2003r2/en_win_srv_2003_r2_standard_x64_with_sp2_cd1_cd2.zip"
  861. ;;
  862. "winxpx86" )
  863. size=617756672
  864. sum="62b6c91563bad6cd12a352aa018627c314cfc5162d8e9f8af0756a642e602a46"
  865. url="xp/professional/en_windows_xp_professional_with_service_pack_3_x86_cd_x14-80428.iso"
  866. ;;
  867. "winxpx64" )
  868. size=614166528
  869. sum="8fac68e1e56c64ad9a2aa0ad464560282e67fa4f4dd51d09a66f4e548eb0f2d6"
  870. url="xp/professional/en_win_xp_pro_x64_vl.iso"
  871. ;;
  872. "win2kx86" )
  873. size=331701982
  874. sum="a93251b31f92316411bb48458a695d9051b13cdeba714c46f105012fdda45bf3"
  875. url="2000/5.00.2195.6717_x86fre_client-professional_retail_en-us.7z"
  876. ;;
  877. esac
  878. case "${ret,,}" in
  879. "sum" ) echo "$sum" ;;
  880. "size" ) echo "$size" ;;
  881. *) [ -n "$url" ] && echo "$host/$url";;
  882. esac
  883. return 0
  884. }
  885. getLink2() {
  886. local id="$1"
  887. local lang="$2"
  888. local ret="$3"
  889. local url=""
  890. local sum=""
  891. local size=""
  892. local host="https://files.dog/MSDN"
  893. [[ "${lang,,}" != "en" && "${lang,,}" != "en-us" ]] && return 0
  894. case "${id,,}" in
  895. "win81x64" )
  896. size=4320526336
  897. sum="d8333cf427eb3318ff6ab755eb1dd9d433f0e2ae43745312c1cd23e83ca1ce51"
  898. url="Windows%208.1%20with%20Update/en_windows_8.1_with_update_x64_dvd_6051480.iso"
  899. ;;
  900. "win81x64-enterprise" | "win81x64-enterprise-eval" )
  901. size=4139163648
  902. sum="c3c604c03677504e8905090a8ce5bb1dde76b6fd58e10f32e3a25bef21b2abe1"
  903. url="Windows%208.1%20with%20Update/en_windows_8.1_enterprise_with_update_x64_dvd_6054382.iso"
  904. ;;
  905. "win2012r2" | "win2012r2-eval" )
  906. size=5397889024
  907. sum="f351e89eb88a96af4626ceb3450248b8573e3ed5924a4e19ea891e6003b62e4e"
  908. url="Windows%20Server%202012%20R2%20with%20Update/en_windows_server_2012_r2_with_update_x64_dvd_6052708.iso"
  909. ;;
  910. "win2008r2" | "win2008r2-eval" )
  911. size=3166584832
  912. sum="dfd9890881b7e832a927c38310fb415b7ea62ac5a896671f2ce2a111998f0df8"
  913. url="Windows%20Server%202008%20R2/en_windows_server_2008_r2_with_sp1_x64_dvd_617601.iso"
  914. ;;
  915. "win7x64" | "win7x64-ultimate" )
  916. size=3320903680
  917. sum="36f4fa2416d0982697ab106e3a72d2e120dbcdb6cc54fd3906d06120d0653808"
  918. url="Windows%207/en_windows_7_ultimate_with_sp1_x64_dvd_u_677332.iso"
  919. ;;
  920. "win7x64-enterprise" | "win7x64-enterprise-eval" )
  921. size=3182604288
  922. sum="ee69f3e9b86ff973f632db8e01700c5724ef78420b175d25bae6ead90f6805a7"
  923. url="Windows%207/en_windows_7_enterprise_with_sp1_x64_dvd_u_677651.iso"
  924. ;;
  925. "win7x86" | "win7x86-ultimate" )
  926. size=2564476928
  927. sum="e2c009a66d63a742941f5087acae1aa438dcbe87010bddd53884b1af6b22c940"
  928. url="Windows%207/en_windows_7_ultimate_with_sp1_x86_dvd_u_677460.iso"
  929. ;;
  930. "win7x86-enterprise" | "win7x86-enterprise-eval" )
  931. size=2434502656
  932. sum="8bdd46ff8cb8b8de9c4aba02706629c8983c45e87da110e64e13be17c8434dad"
  933. url="Windows%207/en_windows_7_enterprise_with_sp1_x86_dvd_u_677710.iso"
  934. ;;
  935. "winvistax64" | "winvistax64-ultimate" )
  936. size=3861460992
  937. sum="edf9f947c5791469fd7d2d40a5dcce663efa754f91847aa1d28ed7f585675b78"
  938. url="Windows%20Vista/en_windows_vista_sp2_x64_dvd_342267.iso"
  939. ;;
  940. "winvistax64-enterprise" )
  941. size=3205953536
  942. sum="0a0cd511b3eac95c6f081419c9c65b12317b9d6a8d9707f89d646c910e788016"
  943. url="Windows%20Vista/en_windows_vista_enterprise_sp2_x64_dvd_342332.iso"
  944. ;;
  945. "winvistax86" | "winvistax86-ultimate" )
  946. size=3243413504
  947. sum="9c36fed4255bd05a8506b2da88f9aad73643395e155e609398aacd2b5276289c"
  948. url="Windows%20Vista/en_windows_vista_with_sp2_x86_dvd_342266.iso"
  949. ;;
  950. "winvistax86-enterprise" )
  951. size=2420981760
  952. sum="54e2720004041e7db988a391543ea5228b0affc28efcf9303d2d0ff9402067f5"
  953. url="Windows%20Vista/en_windows_vista_enterprise_sp2_x86_dvd_342329.iso"
  954. ;;
  955. "win2003r2" )
  956. size=652367872
  957. sum="74245cba888f935b138b106c2744bec7f392925b472358960a0b5643cd6abb32"
  958. url="Windows%20Server%202003%20R2/en_win_srv_2003_r2_standard_x64_with_sp2_cd1_x13-05757.iso"
  959. ;;
  960. "winxpx86" )
  961. size=617756672
  962. sum="62b6c91563bad6cd12a352aa018627c314cfc5162d8e9f8af0756a642e602a46"
  963. url="Windows%20XP/en_windows_xp_professional_with_service_pack_3_x86_cd_x14-80428.iso"
  964. ;;
  965. "winxpx64" )
  966. size=614166528
  967. sum="8fac68e1e56c64ad9a2aa0ad464560282e67fa4f4dd51d09a66f4e548eb0f2d6"
  968. url="Windows%20XP/en_win_xp_pro_x64_vl.iso"
  969. ;;
  970. esac
  971. case "${ret,,}" in
  972. "sum" ) echo "$sum" ;;
  973. "size" ) echo "$size" ;;
  974. *) [ -n "$url" ] && echo "$host/$url";;
  975. esac
  976. return 0
  977. }
  978. getLink3() {
  979. local id="$1"
  980. local lang="$2"
  981. local ret="$3"
  982. local url=""
  983. local sum=""
  984. local size=""
  985. local host="https://nixsys.com/drivers"
  986. [[ "${lang,,}" != "en" && "${lang,,}" != "en-us" ]] && return 0
  987. case "${id,,}" in
  988. "win7x64" | "win7x64-ultimate" )
  989. size=3319478272
  990. sum="3286963e1476082ba882a5058c205c264772bead9e99e15cd1cb255f04b72900"
  991. url="WINDOWS764_EN_DVD.iso"
  992. ;;
  993. "win7x86" | "win7x86-ultimate" )
  994. size=2564784128
  995. sum="bd4c03c917d00a40222d92a6fab04981a7bd46140bda1888eb961a322e3c5d89"
  996. url="WINDOWS732_EN_DVD.iso"
  997. ;;
  998. "winxpx86" )
  999. size=618065920
  1000. sum="8177d0137dfe4e8296a85793f140806c9250a5992c8e0e50158c742767ad1182"
  1001. url="WinXPsp3.iso"
  1002. ;;
  1003. "win2kx86" )
  1004. size=387424256
  1005. sum="08b11c3897eb38d1e6566a17cec5cdf2b3c620444e160e3db200a7e223aabbd8"
  1006. url="Windows_2000_SP4.iso"
  1007. esac
  1008. case "${ret,,}" in
  1009. "sum" ) echo "$sum" ;;
  1010. "size" ) echo "$size" ;;
  1011. *) [ -n "$url" ] && echo "$host/$url";;
  1012. esac
  1013. return 0
  1014. }
  1015. getLink4() {
  1016. local id="$1"
  1017. local lang="$2"
  1018. local ret="$3"
  1019. local url=""
  1020. local sum=""
  1021. local size=""
  1022. local host="https://archive.org/download"
  1023. [[ "${lang,,}" != "en" && "${lang,,}" != "en-us" ]] && return 0
  1024. case "${id,,}" in
  1025. "nano11" )
  1026. size=2463565824
  1027. sum="a1e0614372768cbe2d24de74b78a4a97bc1017ea5080dfed1d2125e4a527eb1a"
  1028. url="nano11_25h2/nano11%2025h2.iso"
  1029. ;;
  1030. "core11" )
  1031. size=3176654848
  1032. sum="29c055fcfb7b089abd9e007e7abe4bb82c70a03aac9d65e56a38b87ab32d04d2"
  1033. url="tiny11_25H2/tiny11core_25H2_Oct25.iso"
  1034. ;;
  1035. "tiny11" )
  1036. size=5514559488
  1037. sum="92484f2b7f707e42383294402a9eabbadeaa5ede80ac633390ae7f3537e36275"
  1038. url="tiny11_25H2/tiny11_25H2_Oct25.iso"
  1039. ;;
  1040. "tiny10" )
  1041. size=3839819776
  1042. sum="a11116c0645d892d6a5a7c585ecc1fa13aa66f8c7cc6b03bf1f27bd16860cc35"
  1043. url="tiny-10-23-h2/tiny10%20x64%2023h2.iso"
  1044. ;;
  1045. "win11x64" )
  1046. size=7736125440
  1047. sum="d141f6030fed50f75e2b03e1eb2e53646c4b21e5386047cb860af5223f102a32"
  1048. url="W11x64_26200.6584/26200.6584.250915-1905.25h2_ge_release_svc_refresh_CLIENT_CONSUMER_x64FRE_en-us.iso"
  1049. ;;
  1050. "win11x64-enterprise" | "win11x64-enterprise-eval" )
  1051. size=6209064960
  1052. sum="c8dbc96b61d04c8b01faf6ce0794fdf33965c7b350eaa3eb1e6697019902945c"
  1053. url="Windows11Enterprise23H2x64/22631.2428.231001-0608.23H2_NI_RELEASE_SVC_REFRESH_CLIENTENTERPRISEEVAL_OEMRET_x64FRE_en-us.iso"
  1054. ;;
  1055. "win11x64-iot" | "win11x64-enterprise-iot" | "win11x64-enterprise-iot-eval" )
  1056. size=5144817664
  1057. sum="4f59662a96fc1da48c1b415d6c369d08af55ddd64e8f1c84e0166d9e50405d7a"
  1058. url="Windows11LTSC/X23-81951_26100.1742.240906-0331.ge_release_svc_refresh_CLIENT_ENTERPRISES_OEM_x64FRE_en-us.iso"
  1059. ;;
  1060. "win11x64-ltsc" | "win11x64-enterprise-ltsc" | "win11x64-enterprise-ltsc-eval" )
  1061. size=5144817664
  1062. sum="4f59662a96fc1da48c1b415d6c369d08af55ddd64e8f1c84e0166d9e50405d7a"
  1063. url="Windows11LTSC/X23-81951_26100.1742.240906-0331.ge_release_svc_refresh_CLIENT_ENTERPRISES_OEM_x64FRE_en-us.iso"
  1064. ;;
  1065. "win10x64" | "win10x64-enterprise" | "win10x64-enterprise-eval" )
  1066. size=6978310144
  1067. sum="7847abd6f39abd02dc8089c4177d354f9eb66fa0ee2fe8ae20e596e675d1ab67"
  1068. url="Windows-10-22H2-July-2024-64-bit-DVD-English/en-us_windows_10_business_editions_version_22h2_updated_july_2024_x64_dvd_c004521a.iso"
  1069. ;;
  1070. "win10x64-iot" | "win10x64-enterprise-iot" | "win10x64-enterprise-iot-eval" )
  1071. size=4851668992
  1072. sum="a0334f31ea7a3e6932b9ad7206608248f0bd40698bfb8fc65f14fc5e4976c160"
  1073. url="en-us_windows_10_iot_enterprise_ltsc_2021_x64_dvd_257ad90f_202411/en-us_windows_10_iot_enterprise_ltsc_2021_x64_dvd_257ad90f.iso"
  1074. ;;
  1075. "win10x64-ltsc" | "win10x64-enterprise-ltsc" | "win10x64-enterprise-ltsc-eval" )
  1076. size=4899461120
  1077. sum="c90a6df8997bf49e56b9673982f3e80745058723a707aef8f22998ae6479597d"
  1078. url="en-us_windows_10_enterprise_ltsc_2021_x64_dvd_d289cf96_202302/en-us_windows_10_enterprise_ltsc_2021_x64_dvd_d289cf96.iso"
  1079. ;;
  1080. "win81x64" )
  1081. size=4320526336
  1082. sum="d8333cf427eb3318ff6ab755eb1dd9d433f0e2ae43745312c1cd23e83ca1ce51"
  1083. url="en_windows_8.1_with_update_x64_dvd_6051480/en_windows_8.1_with_update_x64_dvd_6051480.iso"
  1084. ;;
  1085. "win81x64-enterprise" | "win81x64-enterprise-eval" )
  1086. size=4139163648
  1087. sum="c3c604c03677504e8905090a8ce5bb1dde76b6fd58e10f32e3a25bef21b2abe1"
  1088. url="en_windows_8.1_enterprise_with_update_x64_dvd/en_windows_8.1_enterprise_with_update_x64_dvd_6054382.iso"
  1089. ;;
  1090. "win2022" | "win2022-eval" )
  1091. size=5365624832
  1092. sum="c3c57bb2cf723973a7dcfb1a21e97dfa035753a7f111e348ad918bb64b3114db"
  1093. url="win-server-2022/2227-January_2024/en-us_windows_server_2022_updated_jan_2024_x64_dvd_2b7a0c9f.iso"
  1094. ;;
  1095. "win2019" | "win2019-eval" )
  1096. size=5575774208
  1097. sum="0067afe7fdc4e61f677bd8c35a209082aa917df9c117527fc4b2b52a447e89bb"
  1098. url="sw-dvd-9-win-server-std-core-2019-1809.18-64-bit-english-dc-std-mlf-x-22-74330/SW_DVD9_Win_Server_STD_CORE_2019_1809.18_64Bit_English_DC_STD_MLF_X22-74330.ISO"
  1099. ;;
  1100. "win2016" | "win2016-eval" )
  1101. size=6006587392
  1102. sum="af06e5483c786c023123e325cea4775050324d9e1366f46850b515ae43f764be"
  1103. url="en_windows_server_2016_updated_feb_2018_x64_dvd_11636692/en_windows_server_2016_updated_feb_2018_x64_dvd_11636692.iso"
  1104. ;;
  1105. "win2012r2" | "win2012r2-eval" )
  1106. size=5397889024
  1107. sum="f351e89eb88a96af4626ceb3450248b8573e3ed5924a4e19ea891e6003b62e4e"
  1108. url="en_windows_server_2012_r2_with_update_x64_dvd_6052708_202006/en_windows_server_2012_r2_with_update_x64_dvd_6052708.iso"
  1109. ;;
  1110. "win2008r2" | "win2008r2-eval" )
  1111. size=3166584832
  1112. sum="dfd9890881b7e832a927c38310fb415b7ea62ac5a896671f2ce2a111998f0df8"
  1113. url="en_windows_server_2008_r2_with_sp1_x64_dvd_617601_202006/en_windows_server_2008_r2_with_sp1_x64_dvd_617601.iso"
  1114. ;;
  1115. "win7x64" | "win7x64-ultimate" )
  1116. size=3320903680
  1117. sum="36f4fa2416d0982697ab106e3a72d2e120dbcdb6cc54fd3906d06120d0653808"
  1118. url="win7-ult-sp1-english/Win7_Ult_SP1_English_x64.iso"
  1119. ;;
  1120. "win7x64-enterprise" | "win7x64-enterprise-eval" )
  1121. size=3182604288
  1122. sum="ee69f3e9b86ff973f632db8e01700c5724ef78420b175d25bae6ead90f6805a7"
  1123. url="en_windows_7_enterprise_with_sp1_x64_dvd_u_677651_202006/en_windows_7_enterprise_with_sp1_x64_dvd_u_677651.iso"
  1124. ;;
  1125. "win7x86" | "win7x86-ultimate" )
  1126. size=2564476928
  1127. sum="e2c009a66d63a742941f5087acae1aa438dcbe87010bddd53884b1af6b22c940"
  1128. url="win7-ult-sp1-english/Win7_Ult_SP1_English_x32.iso"
  1129. ;;
  1130. "win7x86-enterprise" | "win7x86-enterprise-eval" )
  1131. size=2434502656
  1132. sum="8bdd46ff8cb8b8de9c4aba02706629c8983c45e87da110e64e13be17c8434dad"
  1133. url="en_windows_7_enterprise_with_sp1_x86_dvd_u_677710_202006/en_windows_7_enterprise_with_sp1_x86_dvd_u_677710.iso"
  1134. ;;
  1135. "winvistax64" | "winvistax64-ultimate" )
  1136. size=3861460992
  1137. sum="edf9f947c5791469fd7d2d40a5dcce663efa754f91847aa1d28ed7f585675b78"
  1138. url="en_windows_vista_sp2_x64_dvd_342267_202010/en_windows_vista_sp2_x64_dvd_342267.iso"
  1139. ;;
  1140. "winvistax64-enterprise" )
  1141. size=3205953536
  1142. sum="0a0cd511b3eac95c6f081419c9c65b12317b9d6a8d9707f89d646c910e788016"
  1143. url="en_windows_vista_enterprise_sp2_x64_dvd_342332_202007/en_windows_vista_enterprise_sp2_x64_dvd_342332.iso"
  1144. ;;
  1145. "winvistax86" | "winvistax86-ultimate" )
  1146. size=3243413504
  1147. sum="9c36fed4255bd05a8506b2da88f9aad73643395e155e609398aacd2b5276289c"
  1148. url="en_windows_vista_sp2_x86_dvd_342266/en_windows_vista_sp2_x86_dvd_342266.iso"
  1149. ;;
  1150. "winvistax86-enterprise" )
  1151. size=2420981760
  1152. sum="54e2720004041e7db988a391543ea5228b0affc28efcf9303d2d0ff9402067f5"
  1153. url="en_windows_vista_enterprise_sp2_x86_dvd_342329_202007/en_windows_vista_enterprise_sp2_x86_dvd_342329.iso"
  1154. ;;
  1155. "win2003r2" )
  1156. size=652367872
  1157. sum="74245cba888f935b138b106c2744bec7f392925b472358960a0b5643cd6abb32"
  1158. url="en_win_srv_2003_r2_standard_x64_with_sp2_cd1_x13-05757/en_win_srv_2003_r2_standard_x64_with_sp2_cd1_x13-05757.iso"
  1159. ;;
  1160. "winxpx86" )
  1161. size=617756672
  1162. sum="62b6c91563bad6cd12a352aa018627c314cfc5162d8e9f8af0756a642e602a46"
  1163. url="XPPRO_SP3_ENU/en_windows_xp_professional_with_service_pack_3_x86_cd_x14-80428.iso"
  1164. ;;
  1165. "winxpx64" )
  1166. size=614166528
  1167. sum="8fac68e1e56c64ad9a2aa0ad464560282e67fa4f4dd51d09a66f4e548eb0f2d6"
  1168. url="windows-xp-all-sp-msdn-iso-files-en-de-ru-tr-x86-x64/en_win_xp_sp1_pro_x64_vl.iso"
  1169. ;;
  1170. "win2kx86" )
  1171. size=386859008
  1172. sum="e3816f6e80b66ff686ead03eeafffe9daf020a5e4717b8bd4736b7c51733ba22"
  1173. url="MicrosoftWindows2000BuildCollection/5.00.2195.6717_x86fre_client-professional_retail_en-us-ZRMPFPP_EN.iso"
  1174. esac
  1175. case "${ret,,}" in
  1176. "sum" ) echo "$sum" ;;
  1177. "size" ) echo "$size" ;;
  1178. *) [ -n "$url" ] && echo "$host/$url";;
  1179. esac
  1180. return 0
  1181. }
  1182. getValue() {
  1183. local val=""
  1184. local id="$2"
  1185. local lang="$3"
  1186. local type="$4"
  1187. local func="getLink$1"
  1188. if [ "$1" -gt 0 ] && [ "$1" -le "$MIRRORS" ]; then
  1189. val=$($func "$id" "$lang" "$type")
  1190. fi
  1191. echo "$val"
  1192. return 0
  1193. }
  1194. getLink() {
  1195. local url
  1196. url=$(getValue "$1" "$2" "$3" "")
  1197. echo "$url"
  1198. return 0
  1199. }
  1200. getHash() {
  1201. local sum
  1202. sum=$(getValue "$1" "$2" "$3" "sum")
  1203. echo "$sum"
  1204. return 0
  1205. }
  1206. getSize() {
  1207. local size
  1208. size=$(getValue "$1" "$2" "$3" "size")
  1209. echo "$size"
  1210. return 0
  1211. }
  1212. isMido() {
  1213. local id="$1"
  1214. local lang="$2"
  1215. local sum
  1216. [[ "${MIDO:-}" == [Nn]* ]] && return 1
  1217. sum=$(getMido "$id" "en" "sum")
  1218. [ -n "$sum" ] && return 0
  1219. return 1
  1220. }
  1221. isESD() {
  1222. local id="$1"
  1223. local lang="$2"
  1224. [[ "${ESD:-}" == [Nn]* ]] && return 1
  1225. case "${id,,}" in
  1226. "win11${PLATFORM,,}" | "win10${PLATFORM,,}" )
  1227. return 0
  1228. ;;
  1229. "win11${PLATFORM,,}-enterprise" | "win11${PLATFORM,,}-enterprise-eval")
  1230. return 0
  1231. ;;
  1232. "win10${PLATFORM,,}-enterprise" | "win10${PLATFORM,,}-enterprise-eval" )
  1233. return 0
  1234. ;;
  1235. esac
  1236. return 1
  1237. }
  1238. validVersion() {
  1239. local id="$1"
  1240. local lang="$2"
  1241. local url
  1242. isESD "$id" "$lang" && return 0
  1243. isMido "$id" "$lang" && return 0
  1244. for ((i=1;i<=MIRRORS;i++)); do
  1245. url=$(getLink "$i" "$id" "$lang")
  1246. [ -n "$url" ] && return 0
  1247. done
  1248. return 1
  1249. }
  1250. addFolder() {
  1251. local src="$1"
  1252. local folder="/oem"
  1253. [ ! -d "$folder" ] && folder="/OEM"
  1254. [ ! -d "$folder" ] && folder="$STORAGE/oem"
  1255. [ ! -d "$folder" ] && folder="$STORAGE/OEM"
  1256. [ ! -d "$folder" ] && return 0
  1257. local msg="Adding OEM folder to image..."
  1258. info "$msg" && html "$msg"
  1259. local dest="$src/\$OEM\$/\$1/OEM"
  1260. mkdir -p "$dest" || return 1
  1261. cp -Lr "$folder/." "$dest" || return 1
  1262. local file
  1263. file=$(find "$dest" -maxdepth 1 -type f -iname install.bat -print -quit)
  1264. [ -f "$file" ] && unix2dos -q "$file"
  1265. return 0
  1266. }
  1267. prepareInstall() {
  1268. local pid=""
  1269. local file=""
  1270. local dir="$2"
  1271. local desc="$3"
  1272. local driver="$4"
  1273. local drivers="/tmp/drivers"
  1274. ETFS="[BOOT]/Boot-NoEmul.img"
  1275. if [ ! -f "$dir/$ETFS" ] || [ ! -s "$dir/$ETFS" ]; then
  1276. error "Failed to locate file \"$ETFS\" in $desc ISO image!" && return 1
  1277. fi
  1278. local arch target
  1279. [ -d "$dir/AMD64" ] && arch="amd64" || arch="x86"
  1280. [[ "${arch,,}" == "x86" ]] && target="$dir/I386" || target="$dir/AMD64"
  1281. if [ ! -d "$target" ]; then
  1282. error "Failed to locate directory \"$target\" in $desc ISO image!" && return 1
  1283. fi
  1284. if [[ "${driver,,}" == "xp" || "${driver,,}" == "2k3" ]]; then
  1285. local msg="Adding drivers to image..."
  1286. info "$msg" && html "$msg"
  1287. rm -rf "$drivers"
  1288. mkdir -p "$drivers"
  1289. if ! bsdtar -xf /var/drivers.txz -C "$drivers"; then
  1290. error "Failed to extract drivers!" && return 1
  1291. fi
  1292. if [ ! -f "$drivers/viostor/$driver/$arch/viostor.sys" ]; then
  1293. error "Failed to locate required storage drivers!" && return 1
  1294. fi
  1295. cp -L "$drivers/viostor/$driver/$arch/viostor.sys" "$target" || return 1
  1296. mkdir -p "$dir/\$OEM\$/\$1/Drivers/viostor" || return 1
  1297. cp -L "$drivers/viostor/$driver/$arch/viostor.cat" "$dir/\$OEM\$/\$1/Drivers/viostor" || return 1
  1298. cp -L "$drivers/viostor/$driver/$arch/viostor.inf" "$dir/\$OEM\$/\$1/Drivers/viostor" || return 1
  1299. cp -L "$drivers/viostor/$driver/$arch/viostor.sys" "$dir/\$OEM\$/\$1/Drivers/viostor" || return 1
  1300. if [ ! -f "$drivers/NetKVM/$driver/$arch/netkvm.sys" ]; then
  1301. error "Failed to locate required network drivers!" && return 1
  1302. fi
  1303. mkdir -p "$dir/\$OEM\$/\$1/Drivers/NetKVM" || return 1
  1304. cp -L "$drivers/NetKVM/$driver/$arch/netkvm.cat" "$dir/\$OEM\$/\$1/Drivers/NetKVM" || return 1
  1305. cp -L "$drivers/NetKVM/$driver/$arch/netkvm.inf" "$dir/\$OEM\$/\$1/Drivers/NetKVM" || return 1
  1306. cp -L "$drivers/NetKVM/$driver/$arch/netkvm.sys" "$dir/\$OEM\$/\$1/Drivers/NetKVM" || return 1
  1307. file=$(find "$target" -maxdepth 1 -type f -iname TXTSETUP.SIF -print -quit)
  1308. if [ -z "$file" ]; then
  1309. error "The file TXTSETUP.SIF could not be found!" && return 1
  1310. fi
  1311. sed -i '/^\[SCSI.Load\]/s/$/\nviostor=viostor.sys,4/' "$file"
  1312. sed -i '/^\[SourceDisksFiles.'"$arch"'\]/s/$/\nviostor.sys=1,,,,,,4_,4,1,,,1,4/' "$file"
  1313. sed -i '/^\[SCSI\]/s/$/\nviostor=\"Red Hat VirtIO SCSI Disk Device\"/' "$file"
  1314. sed -i '/^\[HardwareIdsDatabase\]/s/$/\nPCI\\VEN_1AF4\&DEV_1001\&SUBSYS_00000000=\"viostor\"/' "$file"
  1315. sed -i '/^\[HardwareIdsDatabase\]/s/$/\nPCI\\VEN_1AF4\&DEV_1001\&SUBSYS_00020000=\"viostor\"/' "$file"
  1316. sed -i '/^\[HardwareIdsDatabase\]/s/$/\nPCI\\VEN_1AF4\&DEV_1001\&SUBSYS_00021AF4=\"viostor\"/' "$file"
  1317. sed -i '/^\[HardwareIdsDatabase\]/s/$/\nPCI\\VEN_1AF4\&DEV_1001\&SUBSYS_00000000=\"viostor\"/' "$file"
  1318. if [ ! -d "$drivers/sata/xp/$arch" ]; then
  1319. error "Failed to locate required SATA drivers!" && return 1
  1320. fi
  1321. mkdir -p "$dir/\$OEM\$/\$1/Drivers/sata" || return 1
  1322. cp -Lr "$drivers/sata/xp/$arch/." "$dir/\$OEM\$/\$1/Drivers/sata" || return 1
  1323. cp -Lr "$drivers/sata/xp/$arch/." "$target" || return 1
  1324. sed -i '/^\[SCSI.Load\]/s/$/\niaStor=iaStor.sys,4/' "$file"
  1325. sed -i '/^\[FileFlags\]/s/$/\niaStor.sys = 16/' "$file"
  1326. sed -i '/^\[SourceDisksFiles.'"$arch"'\]/s/$/\niaStor.cat = 1,,,,,,,1,0,0/' "$file"
  1327. sed -i '/^\[SourceDisksFiles.'"$arch"'\]/s/$/\niaStor.inf = 1,,,,,,,1,0,0/' "$file"
  1328. sed -i '/^\[SourceDisksFiles.'"$arch"'\]/s/$/\niaStor.sys = 1,,,,,,4_,4,1,,,1,4/' "$file"
  1329. sed -i '/^\[SourceDisksFiles.'"$arch"'\]/s/$/\niaStor.sys = 1,,,,,,,1,0,0/' "$file"
  1330. sed -i '/^\[SourceDisksFiles.'"$arch"'\]/s/$/\niaahci.cat = 1,,,,,,,1,0,0/' "$file"
  1331. sed -i '/^\[SourceDisksFiles.'"$arch"'\]/s/$/\niaAHCI.inf = 1,,,,,,,1,0,0/' "$file"
  1332. sed -i '/^\[SCSI\]/s/$/\niaStor=\"Intel\(R\) SATA RAID\/AHCI Controller\"/' "$file"
  1333. sed -i '/^\[HardwareIdsDatabase\]/s/$/\nPCI\\VEN_8086\&DEV_2922\&CC_0106=\"iaStor\"/' "$file"
  1334. rm -rf "$drivers"
  1335. fi
  1336. local key setup
  1337. setup=$(find "$target" -maxdepth 1 -type f -iname setupp.ini -print -quit)
  1338. if [ -n "$setup" ] && [ -z "$KEY" ]; then
  1339. pid=$(<"$setup")
  1340. pid="${pid%$'\r'}"
  1341. if [[ "$driver" == "2k" ]]; then
  1342. echo "${pid:0:$((${#pid})) - 3}270" > "$setup"
  1343. else
  1344. if [[ "$pid" == *"270" ]]; then
  1345. warn "this version of $desc requires a volume license key (VLK), it will ask for one during installation."
  1346. else
  1347. file=$(find "$target" -maxdepth 1 -type f -iname PID.INF -print -quit)
  1348. if [ -n "$file" ]; then
  1349. if [[ "$driver" == "2k3" ]]; then
  1350. key=$(grep -i -A 2 "StagingKey" "$file" | tail -n 2 | head -n 1)
  1351. else
  1352. key="${pid:$((${#pid})) - 8:5}"
  1353. if [[ "${pid^^}" == *"OEM" ]]; then
  1354. key=$(grep -i -A 2 "$key" "$file" | tail -n 2 | head -n 1)
  1355. else
  1356. key=$(grep -i -m 1 -A 2 "$key" "$file" | tail -n 2 | head -n 1)
  1357. fi
  1358. key="${key#*= }"
  1359. fi
  1360. key="${key%$'\r'}"
  1361. [[ "${#key}" == "29" ]] && KEY="$key"
  1362. fi
  1363. if [ -z "$KEY" ]; then
  1364. # These are NOT pirated keys, they come from official MS documentation.
  1365. case "${driver,,}" in
  1366. "xp" )
  1367. if [[ "${arch,,}" == "x86" ]]; then
  1368. # Windows XP Professional x86 generic trial key (no activation)
  1369. KEY="DR8GV-C8V6J-BYXHG-7PYJR-DB66Y"
  1370. else
  1371. # Windows XP Professional x64 generic trial key (no activation)
  1372. KEY="B2RBK-7KPT9-4JP6X-QQFWM-PJD6G"
  1373. fi ;;
  1374. "2k3" )
  1375. if [[ "${arch,,}" == "x86" ]]; then
  1376. # Windows Server 2003 Standard x86 generic trial key (no activation)
  1377. KEY="QKDCQ-TP2JM-G4MDG-VR6F2-P9C48"
  1378. else
  1379. # Windows Server 2003 Standard x64 generic trial key (no activation)
  1380. KEY="P4WJG-WK3W7-3HM8W-RWHCK-8JTRY"
  1381. fi ;;
  1382. esac
  1383. echo "${pid:0:$((${#pid})) - 3}000" > "$setup"
  1384. fi
  1385. fi
  1386. fi
  1387. fi
  1388. [ -n "$KEY" ] && KEY="ProductID=$KEY"
  1389. mkdir -p "$dir/\$OEM\$"
  1390. if ! addFolder "$dir"; then
  1391. error "Failed to add OEM folder to image!" && return 1
  1392. fi
  1393. local oem=""
  1394. local install="$dir/\$OEM\$/\$1/OEM/install.bat"
  1395. [ -f "$install" ] && oem="\"Script\"=\"cmd /C start \\\"Install\\\" \\\"cmd /C C:\\\\OEM\\\\install.bat\\\"\""
  1396. [ -z "$WIDTH" ] && WIDTH="1280"
  1397. [ -z "$HEIGHT" ] && HEIGHT="720"
  1398. XHEX=$(printf '%x\n' "$WIDTH")
  1399. YHEX=$(printf '%x\n' "$HEIGHT")
  1400. local username=""
  1401. local password=""
  1402. [ -n "$USERNAME" ] && username=$(echo "$USERNAME" | sed 's/[^[:alnum:]@!._-]//g')
  1403. [ -z "$username" ] && username="Docker"
  1404. [ -n "$PASSWORD" ] && password=$(echo "$PASSWORD" | sed 's/"//g')
  1405. [ -z "$password" ] && password="admin"
  1406. find "$target" -maxdepth 1 -type f -iname winnt.sif -exec rm {} \;
  1407. { echo "[Data]"
  1408. echo " AutoPartition=1"
  1409. echo " MsDosInitiated=\"0\""
  1410. echo " UnattendedInstall=\"Yes\""
  1411. echo " AutomaticUpdates=\"Yes\""
  1412. echo ""
  1413. echo "[Unattended]"
  1414. echo " UnattendSwitch=Yes"
  1415. echo " UnattendMode=FullUnattended"
  1416. echo " FileSystem=NTFS"
  1417. echo " OemSkipEula=Yes"
  1418. echo " OemPreinstall=Yes"
  1419. echo " Repartition=Yes"
  1420. echo " WaitForReboot=\"No\""
  1421. echo " DriverSigningPolicy=\"Ignore\""
  1422. echo " NonDriverSigningPolicy=\"Ignore\""
  1423. echo " OemPnPDriversPath=\"Drivers\viostor;Drivers\NetKVM;Drivers\sata\""
  1424. echo " NoWaitAfterTextMode=1"
  1425. echo " NoWaitAfterGUIMode=1"
  1426. echo " FileSystem-ConvertNTFS"
  1427. echo " ExtendOemPartition=0"
  1428. echo " Hibernation=\"No\""
  1429. echo ""
  1430. echo "[GuiUnattended]"
  1431. echo " OEMSkipRegional=1"
  1432. echo " OemSkipWelcome=1"
  1433. echo " AdminPassword=$password"
  1434. echo " TimeZone=0"
  1435. echo " AutoLogon=Yes"
  1436. echo " AutoLogonCount=65432"
  1437. echo ""
  1438. echo "[UserData]"
  1439. echo " FullName=\"$username\""
  1440. echo " ComputerName=\"*\""
  1441. echo " OrgName=\"$APP for $ENGINE\""
  1442. echo " $KEY"
  1443. echo ""
  1444. echo "[Identification]"
  1445. echo " JoinWorkgroup = WORKGROUP"
  1446. echo ""
  1447. echo "[Display]"
  1448. echo " BitsPerPel=32"
  1449. echo " XResolution=$WIDTH"
  1450. echo " YResolution=$HEIGHT"
  1451. echo ""
  1452. echo "[Networking]"
  1453. echo " InstallDefaultComponents=Yes"
  1454. echo ""
  1455. echo "[Branding]"
  1456. echo " BrandIEUsingUnattended=Yes"
  1457. echo ""
  1458. echo "[URL]"
  1459. echo " Home_Page = http://www.google.com"
  1460. echo " Search_Page = http://www.google.com"
  1461. echo ""
  1462. echo "[TerminalServices]"
  1463. echo " AllowConnections=1"
  1464. echo ""
  1465. } | unix2dos > "$target/WINNT.SIF"
  1466. if [[ "$driver" == "2k3" ]]; then
  1467. { echo "[Components]"
  1468. echo " TerminalServer=On"
  1469. echo ""
  1470. echo "[LicenseFilePrintData]"
  1471. echo " AutoMode=PerServer"
  1472. echo " AutoUsers=5"
  1473. echo ""
  1474. } | unix2dos >> "$target/WINNT.SIF"
  1475. fi
  1476. { echo "Windows Registry Editor Version 5.00"
  1477. echo ""
  1478. echo "[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Security]"
  1479. echo "\"FirstRunDisabled\"=dword:00000001"
  1480. echo "\"UpdatesDisableNotify\"=dword:00000001"
  1481. echo "\"FirewallDisableNotify\"=dword:00000001"
  1482. echo "\"AntiVirusDisableNotify\"=dword:00000001"
  1483. echo ""
  1484. echo "[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\wscsvc]"
  1485. echo "\"Start\"=dword:00000004"
  1486. echo ""
  1487. echo "[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\StandardProfile\GloballyOpenPorts\List]"
  1488. echo "\"3389:TCP\"=\"3389:TCP:*:Enabled:@xpsp2res.dll,-22009\""
  1489. echo ""
  1490. echo "[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Applets\Tour]"
  1491. echo "\"RunCount\"=dword:00000000"
  1492. echo ""
  1493. echo "[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced]"
  1494. echo "\"HideFileExt\"=dword:00000000"
  1495. echo ""
  1496. echo "[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer]"
  1497. echo "\"NoWelcomeScreen\"=\"1\""
  1498. echo ""
  1499. echo "[HKEY_CURRENT_USER\Software\Microsoft\Internet Connection Wizard]"
  1500. echo "\"Completed\"=\"1\""
  1501. echo "\"Desktopchanged\"=\"1\""
  1502. echo ""
  1503. echo "[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon]"
  1504. echo "\"AutoAdminLogon\"=\"1\""
  1505. echo "\"DefaultUserName\"=\"$username\""
  1506. echo "\"DefaultPassword\"=\"$password\""
  1507. echo "\"DefaultDomainName\"=\"Dockur\""
  1508. echo ""
  1509. echo "[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Video\{23A77BF7-ED96-40EC-AF06-9B1F4867732A}\0000]"
  1510. echo "\"DefaultSettings.BitsPerPel\"=dword:00000020"
  1511. echo "\"DefaultSettings.XResolution\"=dword:00000$XHEX"
  1512. echo "\"DefaultSettings.YResolution\"=dword:00000$YHEX"
  1513. echo ""
  1514. echo "[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Hardware Profiles\Current\System\CurrentControlSet\Control\VIDEO\{23A77BF7-ED96-40EC-AF06-9B1F4867732A}\0000]"
  1515. echo "\"DefaultSettings.BitsPerPel\"=dword:00000020"
  1516. echo "\"DefaultSettings.XResolution\"=dword:00000$XHEX"
  1517. echo "\"DefaultSettings.YResolution\"=dword:00000$YHEX"
  1518. echo ""
  1519. echo "[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\RunOnce]"
  1520. echo "\"ScreenSaver\"=\"reg add \\\"HKCU\\\\Control Panel\\\\Desktop\\\" /f /v \\\"SCRNSAVE.EXE\\\" /t REG_SZ /d \\\"off\\\"\""
  1521. echo "\"ScreenSaverOff\"=\"reg add \\\"HKCU\\\\Control Panel\\\\Desktop\\\" /f /v \\\"ScreenSaveActive\\\" /t REG_SZ /d \\\"0\\\"\""
  1522. echo "$oem"
  1523. echo ""
  1524. } | unix2dos > "$dir/\$OEM\$/install.reg"
  1525. if [[ "$driver" == "2k" ]]; then
  1526. { echo "[HKEY_USERS\.DEFAULT\Software\Microsoft\Windows\CurrentVersion\Runonce]"
  1527. echo "\"^SetupICWDesktop\"=-"
  1528. echo ""
  1529. } | unix2dos >> "$dir/\$OEM\$/install.reg"
  1530. fi
  1531. if [[ "$driver" == "2k3" ]]; then
  1532. { echo "[HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\srvWiz]"
  1533. echo "@=dword:00000000"
  1534. echo ""
  1535. echo "[HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\ServerOOBE\SecurityOOBE]"
  1536. echo "\"DontLaunchSecurityOOBE\"=dword:00000000"
  1537. echo ""
  1538. } | unix2dos >> "$dir/\$OEM\$/install.reg"
  1539. fi
  1540. { echo "Set WshShell = WScript.CreateObject(\"WScript.Shell\")"
  1541. echo "Set WshNetwork = WScript.CreateObject(\"WScript.Network\")"
  1542. echo "Set Domain = GetObject(\"WinNT://\" & WshNetwork.ComputerName)"
  1543. echo ""
  1544. echo "Function DecodeSID(binSID)"
  1545. echo " ReDim o(LenB(binSID))"
  1546. echo ""
  1547. echo " For i = 1 To LenB(binSID)"
  1548. echo " o(i-1) = AscB(MidB(binSID, i, 1))"
  1549. echo " Next"
  1550. echo ""
  1551. echo " sid = \"S-\" & CStr(o(0)) & \"-\" & OctetArrayToString _"
  1552. echo " (Array(o(2), o(3), o(4), o(5), o(6), o(7)))"
  1553. echo " For i = 8 To (4 * o(1) + 4) Step 4"
  1554. echo " sid = sid & \"-\" & OctetArrayToString _"
  1555. echo " (Array(o(i+3), o(i+2), o(i+1), o(i)))"
  1556. echo " Next"
  1557. echo ""
  1558. echo " DecodeSID = sid"
  1559. echo "End Function"
  1560. echo ""
  1561. echo "Function OctetArrayToString(arr)"
  1562. echo " v = 0"
  1563. echo " For i = 0 To UBound(arr)"
  1564. echo " v = v * 256 + arr(i)"
  1565. echo " Next"
  1566. echo ""
  1567. echo " OctetArrayToString = CStr(v)"
  1568. echo "End Function"
  1569. echo ""
  1570. echo "For Each DomainItem in Domain"
  1571. echo " If DomainItem.Class = \"User\" Then"
  1572. echo " sid = DecodeSID(DomainItem.Get(\"objectSID\"))"
  1573. echo " If Left(sid, 9) = \"S-1-5-21-\" And Right(sid, 4) = \"-500\" Then"
  1574. echo " LocalAdminADsPath = DomainItem.ADsPath"
  1575. echo " Exit For"
  1576. echo " End If"
  1577. echo " End If"
  1578. echo "Next"
  1579. echo ""
  1580. echo "Call Domain.MoveHere(LocalAdminADsPath, \"$username\")"
  1581. echo ""
  1582. echo "Set oLink = WshShell.CreateShortcut(WshShell.ExpandEnvironmentStrings(\"%userprofile%\\Desktop\\Shared.lnk\"))"
  1583. echo "With oLink"
  1584. echo " .TargetPath = \"\\\\host.lan\\Data\""
  1585. echo " .Save"
  1586. echo "End With"
  1587. echo "Set oLink = Nothing"
  1588. echo ""
  1589. } | unix2dos > "$dir/\$OEM\$/install.vbs"
  1590. { echo "[COMMANDS]"
  1591. echo "\"REGEDIT /s install.reg\""
  1592. echo "\"Wscript install.vbs\""
  1593. echo ""
  1594. } | unix2dos > "$dir/\$OEM\$/cmdlines.txt"
  1595. return 0
  1596. }
  1597. prepareLegacy() {
  1598. local iso="$1"
  1599. local dir="$2"
  1600. local desc="$3"
  1601. ETFS="boot.img"
  1602. [ -f "$dir/$ETFS" ] && [ -s "$dir/$ETFS" ] && return 0
  1603. rm -f "$dir/$ETFS"
  1604. local len offset
  1605. len=$(isoinfo -d -i "$iso" | grep "Nsect " | grep -o "[^ ]*$")
  1606. offset=$(isoinfo -d -i "$iso" | grep "Bootoff " | grep -o "[^ ]*$")
  1607. if ! dd "if=$iso" "of=$dir/$ETFS" bs=2048 "count=$len" "skip=$offset" status=none; then
  1608. error "Failed to extract boot image from $desc ISO!" && return 1
  1609. fi
  1610. [ -f "$dir/$ETFS" ] && [ -s "$dir/$ETFS" ] && return 0
  1611. error "Failed to locate file \"$ETFS\" in $desc ISO image!"
  1612. return 1
  1613. }
  1614. detectLegacy() {
  1615. local dir="$1"
  1616. local find
  1617. find=$(find "$dir" -maxdepth 1 -type d -iname WIN95 -print -quit)
  1618. [ -n "$find" ] && DETECTED="win95" && return 0
  1619. find=$(find "$dir" -maxdepth 1 -type d -iname WIN98 -print -quit)
  1620. [ -n "$find" ] && DETECTED="win98" && return 0
  1621. find=$(find "$dir" -maxdepth 1 -type d -iname WIN9X -print -quit)
  1622. [ -n "$find" ] && DETECTED="win9x" && return 0
  1623. find=$(find "$dir" -maxdepth 1 -type f -iname CDROM_W.40 -print -quit)
  1624. [ -z "$find" ] && find=$(find "$dir" -maxdepth 1 -type f -iname CDROM_S.40 -print -quit)
  1625. [ -z "$find" ] && find=$(find "$dir" -maxdepth 1 -type f -iname CDROM_TS.40 -print -quit)
  1626. [ -n "$find" ] && DETECTED="winnt4" && return 0
  1627. find=$(find "$dir" -maxdepth 1 -type f -iname CDROM_NT.5 -print -quit)
  1628. if [ -n "$find" ]; then
  1629. find=$(find "$dir" -maxdepth 1 -type f -iname CDROM_IA.5 -print -quit)
  1630. [ -z "$find" ] && find=$(find "$dir" -maxdepth 1 -type f -iname CDROM_ID.5 -print -quit)
  1631. [ -z "$find" ] && find=$(find "$dir" -maxdepth 1 -type f -iname CDROM_IP.5 -print -quit)
  1632. [ -z "$find" ] && find=$(find "$dir" -maxdepth 1 -type f -iname CDROM_IS.5 -print -quit)
  1633. [ -n "$find" ] && DETECTED="win2k" && return 0
  1634. fi
  1635. find=$(find "$dir" -maxdepth 1 -iname WIN51 -print -quit)
  1636. if [ -n "$find" ]; then
  1637. find=$(find "$dir" -maxdepth 1 -type f -iname WIN51AP -print -quit)
  1638. [ -n "$find" ] && DETECTED="winxpx64" && return 0
  1639. find=$(find "$dir" -maxdepth 1 -type f -iname WIN51IC -print -quit)
  1640. [ -z "$find" ] && find=$(find "$dir" -maxdepth 1 -type f -iname WIN51IP -print -quit)
  1641. [ -z "$find" ] && find=$(find "$dir" -maxdepth 1 -type f -iname setupxp.htm -print -quit)
  1642. [ -n "$find" ] && DETECTED="winxpx86" && return 0
  1643. find=$(find "$dir" -maxdepth 1 -type f -iname WIN51IS -print -quit)
  1644. [ -z "$find" ] && find=$(find "$dir" -maxdepth 1 -type f -iname WIN51IA -print -quit)
  1645. [ -z "$find" ] && find=$(find "$dir" -maxdepth 1 -type f -iname WIN51IB -print -quit)
  1646. [ -z "$find" ] && find=$(find "$dir" -maxdepth 1 -type f -iname WIN51ID -print -quit)
  1647. [ -z "$find" ] && find=$(find "$dir" -maxdepth 1 -type f -iname WIN51IL -print -quit)
  1648. [ -z "$find" ] && find=$(find "$dir" -maxdepth 1 -type f -iname WIN51IS -print -quit)
  1649. [ -z "$find" ] && find=$(find "$dir" -maxdepth 1 -type f -iname WIN51AA -print -quit)
  1650. [ -z "$find" ] && find=$(find "$dir" -maxdepth 1 -type f -iname WIN51AD -print -quit)
  1651. [ -z "$find" ] && find=$(find "$dir" -maxdepth 1 -type f -iname WIN51AS -print -quit)
  1652. [ -z "$find" ] && find=$(find "$dir" -maxdepth 1 -type f -iname WIN51MA -print -quit)
  1653. [ -z "$find" ] && find=$(find "$dir" -maxdepth 1 -type f -iname WIN51MD -print -quit)
  1654. [ -n "$find" ] && DETECTED="win2003r2" && return 0
  1655. fi
  1656. return 1
  1657. }
  1658. skipVersion() {
  1659. local id="$1"
  1660. case "${id,,}" in
  1661. "win9"* | "winxp"* | "win2k"* | "win2003"* )
  1662. return 0 ;;
  1663. esac
  1664. return 1
  1665. }
  1666. isCompatible() {
  1667. return 0
  1668. }
  1669. setMachine() {
  1670. local id="$1"
  1671. local iso="$2"
  1672. local dir="$3"
  1673. local desc="$4"
  1674. case "${id,,}" in
  1675. "win9"* )
  1676. ETFS="[BOOT]/Boot-1.44M.img" ;;
  1677. "win2k"* )
  1678. if ! prepareInstall "$iso" "$dir" "$desc" "2k"; then
  1679. error "Failed to prepare $desc ISO!" && return 1
  1680. fi ;;
  1681. "winxp"* )
  1682. if ! prepareInstall "$iso" "$dir" "$desc" "xp"; then
  1683. error "Failed to prepare $desc ISO!" && return 1
  1684. fi ;;
  1685. "win2003"* )
  1686. if ! prepareInstall "$iso" "$dir" "$desc" "2k3"; then
  1687. error "Failed to prepare $desc ISO!" && return 1
  1688. fi ;;
  1689. esac
  1690. case "${id,,}" in
  1691. "win9"* )
  1692. USB="no"
  1693. VGA="cirrus"
  1694. DISK_TYPE="auto"
  1695. MACHINE="pc-i440fx-2.4"
  1696. BOOT_MODE="windows_legacy"
  1697. [ -z "${ADAPTER:-}" ] && ADAPTER="pcnet" ;;
  1698. "win2k"* )
  1699. VGA="cirrus"
  1700. MACHINE="pc"
  1701. USB="pci-ohci"
  1702. DISK_TYPE="auto"
  1703. BOOT_MODE="windows_legacy"
  1704. [ -z "${ADAPTER:-}" ] && ADAPTER="rtl8139" ;;
  1705. "winxp"* | "win2003"* )
  1706. DISK_TYPE="blk"
  1707. BOOT_MODE="windows_legacy" ;;
  1708. "winvista"* | "win7"* | "win2008"* )
  1709. BOOT_MODE="windows_legacy" ;;
  1710. esac
  1711. case "${id,,}" in
  1712. "winxp"* | "win2003"* | "winvistax86"* | "win7x86"* | "win2008r2x86"* )
  1713. # Prevent bluescreen if 64 bit PCI hole size is >2G.
  1714. ARGS="-global q35-pcihost.x-pci-hole64-fix=false" ;;
  1715. esac
  1716. return 0
  1717. }
  1718. return 0