有些厂商的机器因策略问题,不支持Windows重装为Linux. 例如: 腾讯云非大陆区域.
有些厂商Windows系统盘会比Linux系统盘大,想要大一点系统盘. 例如: AZURE, AWS等.
有些厂商不支持VNC,这对于转换系统实在不方便.
这篇文章可以解决以上问题.
Windows to Linux!

使用前,请耐心看完文章.
如果造成损失,萌咖不负任何责任.

  • 更新日志

    • 2018.11.12

    • 1.内置了我博客中提供的两个Windows镜像的选项,仅DHCP可用(谷歌网盘,境外机器使用).
      2.修复了SHA1 校验失败的问题.
      3.兼容了较低版本 PowerShell.

    • 2018.11.02

    • 增加 SHA1 文件校验, 避免下载中意外出错.

  • 使用方法:

    • 下载 win32loader.bat .

    • 双击打开此文件.

    • 自行选择选项.

    • 按回车重启,并等待安装完成.

    win32loder

  • 注意事项:

    • 如果对提供安装的发行版不满意,请参考此文章.

    • [ Linux VPS ] Debian/Ubuntu/CentOS 网络安装/重装系统/纯净安装 一键脚本
      默认提供的是Debian8(Jessie),添加了firmware包,提供了更多的驱动支持,DHCP模式一键.
      非DHCP模式,如果要一键,则需要自己定制镜像.
      定制Debian系镜像应该没问题,其他未作测试.
      默认root账户密码 Vicer .

    • 如需要Linux一键重装为Windows,请参考此文章.

    • [ Linux VPS ] Debian/Ubuntu/CentOS 网络安装/重装系统/纯净安装 一键脚本

    • 如果厂商不支持VNC,则需要自己定制镜像.

    • 定制方法参考上面提到的文章
      [ Linux VPS ] Debian/Ubuntu/CentOS 网络安装/重装系统/纯净安装 一键脚本
      主要在镜像中添加机器的网络参数,以便支持一键安装.
      命令示例:

      1

      2

      3

      4

      # 定制带网络参数的initrd.img

      bash InstallNET.sh -d 8 -v 64 -a --ip-addr <IP> --ip-mask <NetMask> --ip-gate <GATE> --loader

      # 需要dd安装其他系统(例如 Windows to Windows),定制命令.(网络参数有DHCP的,无需添加.)

      bash InstallNET.sh -dd <IMAGE_URL.tar> --ip-addr <IP> --ip-mask <NetMask> --ip-gate <GATE> --loader

      完成后将 initrd.img 和 vmlinuz 存放到能直链下载的位置.

    • 如果厂商支持VNC,则可以直选全部选 1 .

    • 安装的时候,自己填 IP地址子网掩码网关DNS服务器.
      DNS服务器推荐填: 8.8.8.8

    • 区分是否为DHCP模式

    • DHCP

      • 非DHCP模式: 如上图,显示了详细的IP地址.(选中:使用下面的IP地址)

      • DHCP模式: 参考上图.(选中:自动获得IP地址)

  • win32loader.bat:

    • 1

      2

      3

      4

      5

      6

      7

      8

      9

      10

      11

      12

      13

      14

      15

      16

      17

      18

      19

      20

      21

      22

      23

      24

      25

      26

      27

      28

      29

      30

      31

      32

      33

      34

      35

      36

      37

      38

      39

      40

      41

      42

      43

      44

      45

      46

      47

      48

      49

      50

      51

      52

      53

      54

      55

      56

      57

      58

      59

      60

      61

      62

      63

      64

      65

      66

      67

      68

      69

      70

      71

      72

      73

      74

      75

      76

      77

      78

      79

      80

      81

      82

      83

      84

      85

      86

      87

      88

      89

      90

      91

      92

      93

      94

      95

      96

      97

      98

      99

      100

      101

      102

      103

      104

      105

      106

      107

      108

      109

      110

      111

      112

      113

      114

      115

      116

      117

      118

      119

      120

      121

      122

      123

      124

      125

      126

      127

      128

      129

      130

      131

      132

      133

      134

      135

      136

      137

      138

      139

      140

      141

      142

      143

      144

      145

      146

      147

      148

      149

      150

      151

      152

      153

      154

      155

      156

      157

      158

      159

      160

      161

      162

      163

      164

      165

      166

      167

      168

      169

      170

      171

      172

      173

      174

      175

      176

      177

      178

      179

      180

      181

      182

      183

      184

      185

      186

      187

      188

      189

      190

      191

      192

      193

      194

      195

      196

      197

      198

      199

      200

      201

      202

      203

      204

      205

      206

      207

      208

      209

      210

      211

      @ECHO OFF&@PUSHD %~DP0 &TITLE Win32Loader

      setlocal enabledelayedexpansion

      ::Author MoeClub.org

      color 87

      cd.>%windir%\GetAdmin

      if exist %windir%\GetAdmin (del /f /q "%windir%\GetAdmin") else (

      echo CreateObject^("Shell.Application"^).ShellExecute "%~s0", "%*", "", "runas", 1 >> "%temp%\Admin.vbs"

      "%temp%\Admin.vbs"

      del /s /q "%temp%\Admin.vbs"

      exit /b 2)

      cls

       

      echo * Init Win32Loader.

      set download=0

      set try_download=1

      set URL=https://moeclub.org/attachment/WindowsSoftware

       

      :InitCheck

      mkdir "%SystemDrive%\win32-loader" >NUL 2>NUL

      if exist "%SystemDrive%\Windows\System32\WindowsPowerShell" (

      set use_ps=1

      ) else (

      set use_ps=0

      echo Not found PowerShell.

      )

       

      :Init

      if %use_ps% equ 1 (

      goto InitIt

      ) else (

      goto InitFail

      )

       

      :InitIt

      set try_download=0

      call:DownloadFile "!URL!/g2ldr/g2ldr","%SystemDrive%\g2ldr"

      call:DownloadFile "!URL!/g2ldr/g2ldr.mbr","%SystemDrive%\g2ldr.mbr"

      call:DownloadFile "!URL!/g2ldr/grub.cfg","%SystemDrive%\win32-loader\grub.cfg"

      goto InitDone

       

      :InitFail

      echo.

      echo Go to "!URL!/g2ldr",

      echo Please download them by yourself.

      echo '%SystemDrive%\g2ldr'

      echo '%SystemDrive%\g2ldr.mbr'

      echo '%SystemDrive%\win32-loader\grub.cfg'

      echo Press [ENTER] when you finished.

      pause >NUL 2>NUL

      goto InitDone

       

      :InitDone

      if !try_download! equ 0 (

      set InitOption=InitFail

      ) else (

      set InitOption=Init

      )

      if not exist "%SystemDrive%\g2ldr" goto !InitOption!

      if not exist "%SystemDrive%\g2ldr.mbr" goto !InitOption!

      if not exist "%SystemDrive%\win32-loader\grub.cfg" goto !InitOption!

       

      :Image

      echo.

      echo * Please select initrd mode.

      echo     [1] Online download

      echo     [2] Local file

      choice /n /c 12 /m Select:

      if errorlevel 2 goto LocalMode

      if errorlevel 1 goto OnlineMode

      goto Image

       

      :OnlineMode

      echo.

      echo * Please select source.

      echo     [1] by MoeClub [Linux](Debian8, DHCP or VNC Support)

      echo     [2] by MoeClub [Windows](Win7EMB, DHCP or VNC Support)

      echo     [3] by MoeClub [Windows](Win8.1EMB, DHCP or VNC Support)

      echo     [4] by yourself

      choice /n /c 1234 /m Select:

      if errorlevel 4 goto Yourself

      if errorlevel 3 goto MoeClub_Win8.1EMB

      if errorlevel 2 goto MoeClub_Win7EMB

      if errorlevel 1 goto MoeClub

      goto OnlineMode

      :Yourself

      echo.

      echo if 'initrd.img' URL is 'https://moeclub.org/onedrive/IMAGE/Loader/DebianJessie/initrd.img',

      echo Please input 'https://moeclub.org/onedrive/IMAGE/Loader/DebianJessie'.

      set /p IMG_URL_TMP=URL :

      if defined IMG_URL_TMP (

      set IMG_URL=%IMG_URL_TMP%

      goto Download

      ) else (

      goto MoeClub

      )

      :MoeClub_Win8.1EMB

      set IMG_URL=https://moeclub.org/onedrive/IMAGE/Loader/Win8.1EMB

      set INITRD_SHA1=473617320316CCB5A88EDE72CBA6AF501B148071

      set VMLINUZ_SHA1=C84BF89869868B0325F56F1C0E62604A83B9443F

      goto Download

      :MoeClub_Win7EMB

      set IMG_URL=https://moeclub.org/onedrive/IMAGE/Loader/Win7EMB

      set INITRD_SHA1=C1BF2A50802BC23A7EC7373AB4CB8F5A905D5860

      set VMLINUZ_SHA1=C84BF89869868B0325F56F1C0E62604A83B9443F

      goto Download

      :MoeClub

      set IMG_URL=https://moeclub.org/onedrive/IMAGE/Loader/DebianJessie

      set INITRD_SHA1=934CFCD5DC855F360AE72AFCB8E6276FABFBCDD5

      set VMLINUZ_SHA1=C84BF89869868B0325F56F1C0E62604A83B9443F

      goto Download

      :Download

      if %use_ps% equ 1 (

      echo.

      echo Downloading 'initrd.img'...

      call:DownloadFile "!IMG_URL!/initrd.img","%SystemDrive%\win32-loader\initrd.img"

      call:CheckFile "%SystemDrive%\win32-loader\initrd.img"

      call:CheckSUM "%SystemDrive%\win32-loader\initrd.img","%INITRD_SHA1%"

      echo Downloading 'vmlinuz'...

      call:DownloadFile "!IMG_URL!/vmlinuz","%SystemDrive%\win32-loader\vmlinuz"

      call:CheckFile "%SystemDrive%\win32-loader\vmlinuz"

      call:CheckSUM "%SystemDrive%\win32-loader\vmlinuz","%VMLINUZ_SHA1%"

      set download=1

      ) else (

      echo Not support online download, auto change Local initrd.

      goto LocalMode

      )

       

      :LocalMode

      if !download! equ 0 (

      echo.

      echo Please put 'initrd.img' and 'vmlinuz' to '%SystemDrive%\win32-loader' .

      echo Press [ENTER] when you finished.

      pause >NUL 2>NUL

      )

       

      :Done0

      set download=0

      if exist "%SystemDrive%\win32-loader\initrd.img" (

      goto Done1

      ) else (

      echo Not found '%SystemDrive%\win32-loader\initrd.img' .

      goto LocalMode

      )

       

      :Done1

      set download=0

      if exist "%SystemDrive%\win32-loader\vmlinuz" (

      goto Done

      ) else (

      echo Not found '%SystemDrive%\win32-loader\vmlinuz' .

      goto LocalMode

      )

       

      :Done

      echo.

      echo Press [ENTER] to continue...

      echo IT WILL REBOOT IMMEDIATELY

      pause >NUL 2>NUL

      echo.

      call:CheckFile "%SystemDrive%\g2ldr"

      call:CheckFile "%SystemDrive%\g2ldr.mbr"

      call:CheckFile "%SystemDrive%\win32-loader\grub.cfg"

      call:CheckFile "%SystemDrive%\win32-loader\initrd.img"

      call:CheckFile "%SystemDrive%\win32-loader\vmlinuz"

      call:CheckSUM "%SystemDrive%\g2ldr","2FCB1009A64C127AD3CC39FF0B5E068B38CBA772"

      call:CheckSUM "%SystemDrive%\g2ldr.mbr","29401C8BC951F0AEFD30DC370A3797D1055D64B4"

      call:CheckSUM "%SystemDrive%\win32-loader\grub.cfg","58C499EFEE7E60790B3FE2166B536C04B6717B14"

      set id={01234567-89ab-cdef-fedc-ba9876543210}

      bcdedit /create %id% /d "Debian GUN/Linux" /application bootsector >NUL 2>NUL

      bcdedit /set %id% device partition=%SystemDrive% >NUL 2>NUL

      bcdedit /set %id% path \g2ldr.mbr >NUL 2>NUL

      bcdedit /displayorder %id% /addlast >NUL 2>NUL

      bcdedit /bootsequence %id% /addfirst >NUL 2>NUL

      shutdown -r -t 0

       

      :CheckSUM

      for /f "delims=: tokens=2" %%i in ('powershell.exe "& {Get-FileHash -Algorithm SHA1 -Path %1|Format-List -Property HASH}"') do (set tmp_var=%%i)

      set var=%tmp_var:~1%

      if "%var%" == %2 (

      echo Check %1 SHA1 OK.

      ) else (

      if "%var%" == "CommandNotFoundException" (

      echo Check %1 SHA1 SKIP.

      ) else (

      echo Check %1 SHA1 FAIL.

      call:ErrorExit

      )

      )

      GOTO:EOF

       

      :CheckFile

      if not exist %1 (

      echo Not found %1 .

      call:ErrorExit

      )

      GOTO:EOF

       

      :DownloadFile

      powershell.exe -command "& {$client = new-object System.Net.WebClient; $client.DownloadFile('%1','%2')}" >NUL 2>NUL

      GOTO:EOF

       

      :ErrorExit

      echo.

      echo Error, Clear CACHE...

      del /S /F /Q "%SystemDrive%\g2ldr" >NUL 2>NUL

      del /S /F /Q "%SystemDrive%\g2ldr.mbr" >NUL 2>NUL

      rd /S /Q "%SystemDrive%\win32-loader" >NUL 2>NUL

      echo Press [ENTER] to exit.

      pause >NUL 2>NUL

      exit 1

      GOTO:EOF


    • 各种形式的转载请注明出处!


版权声明

1、本类目资源来自互联网收集,本站不保证资源的完整性及可运行性,资源仅供用于学习和交流,请勿用于商业用途。如有侵权、不妥之处,请联系站长并出示版权证明以便删除。敬请谅解!

2、本资源为虚拟可复制性,下单后不予退款,谢谢您的支持!

3、关于本站资源版权的免责说明(下载本站资源即表示你已经阅读)。

4、对于不当转载或引用本网站内容而引起的民事纷争、行政处理或其他损失,本网站不承担责任。

5、对不遵守本声明或其他违法、恶意使用本网站内容者,本网站保留追究其法律责任的权利。

唯一网址: http://www.2min.cn/14_51.html

标 签: windows 一键 网络 安装

上一篇: Bandwagon Host / 搬瓦工 利用API自动切换机房脚本

下一篇: 什么VPS值得抢-2018年黑色星期五VPS主机与独立服务器优惠促销汇总

用户评论 (0)

暂无评论

嘿,我来帮您!