{"id":126,"date":"2018-11-30T23:45:15","date_gmt":"2018-11-30T15:45:15","guid":{"rendered":"http:\/\/www.zhangyijun.com\/?p=126"},"modified":"2018-11-30T23:45:15","modified_gmt":"2018-11-30T15:45:15","slug":"linux-shell-%e9%80%9a%e7%94%a8%e6%97%a0%e9%99%90%e5%88%b6%e5%9c%a8-linux-vps-%e4%b8%8a%e4%b8%80%e9%94%ae%e5%85%a8%e8%87%aa%e5%8a%a8-dd-%e5%ae%89%e8%a3%85-windows-%e7%b3%bb%e7%bb%9f","status":"publish","type":"post","link":"http:\/\/www.zhangyijun.com\/?p=126","title":{"rendered":"[ Linux Shell ] \u901a\u7528\u65e0\u9650\u5236\u5728 Linux VPS \u4e0a\u4e00\u952e\u5168\u81ea\u52a8 dd \u5b89\u88c5 Windows \u7cfb\u7edf"},"content":{"rendered":"<p>\t\t\t\thttps:\/\/moeclub.org\/2017\/11\/19\/483\/?v=140<\/p>\n<p><a href=\"https:\/\/moeclub.org\/2017\/11\/19\/483\/\" target=\"_blank\" rel=\"noopener noreferrer\"><strong>\u65e0\u9650\u5236\u5168\u81ea\u52a8dd\u5b89\u88c5Windows<\/strong><\/a><br \/>\n\u7a81\u7834\u6ca1\u6709VNC,\u6ca1\u6709\u6551\u63f4\u6a21\u5f0f,\u5185\u5b58\u6bd4dd\u5305\u5c0f\u7684\u9650\u5236.<br \/>\n\u4f7f\u7528Debian Live CD\u4e2d\u7684busybox\u505a\u4e2d\u95f4\u5a92\u4ecb,\u7ecf\u8fc7\u590d\u6742\u7684\u5904\u7406,<br \/>\n\u4f7f\u672c\u673a\u7684\u7f51\u7edc\u53c2\u6570\u4f20\u8fdbWindows\u64cd\u4f5c\u7cfb\u7edf\u4e2d,<br \/>\n\u5373\u4f7f\u6ca1\u6709DHCP\u80fd\u591f\u8ba9Windows\u83b7\u53d6\u7f51\u7edc\u53c2\u6570,<br \/>\n\u4e5f\u80fd\u8ba9Windows\u64cd\u4f5c\u7cfb\u7edf\u5728\u5f00\u673a\u7684\u7b2c\u4e00\u65f6\u95f4\u80fd\u591f\u8fde\u901a\u7f51\u7edc.<br \/>\n<span id=\"more-483\"><\/span><\/p>\n<ul>\n<li style=\"list-style-type: none;\">\n<ul>\n<li><strong>\u66f4\u65b0<\/strong>:\n<ul>\n<li>[2018.04.03]<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>\u529f\u80fd\u5408\u5e76:<br \/>\n<strong><a href=\"https:\/\/moeclub.org\/2018\/04\/03\/603\/\" target=\"_blank\" rel=\"noopener noreferrer\"><u>[ Linux VPS ] Debian\/Ubuntu\/CentOS \u7f51\u7edc\u5b89\u88c5\/\u91cd\u88c5\u7cfb\u7edf\/\u7eaf\u51c0\u5b89\u88c5 \u4e00\u952e\u811a\u672c<\/u><\/a><\/strong><\/p>\n<ul>\n<li style=\"list-style-type: none;\">\n<ul>\n<li style=\"list-style-type: none;\">\n<ul>\n<li>[2018.03.30]<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>\u4f18\u5316GRUB\u68c0\u6d4b\u6d4b\u903b\u8f91.<br \/>\n\u6dfb\u52a0\u7ec4\u4ef6\u4f9d\u8d56\u68c0\u6d4b.<br \/>\n\u4fee\u590d\u4e00\u4e9b\u5df2\u77e5BUG.<\/p>\n<ul>\n<li style=\"list-style-type: none;\">\n<ul>\n<li style=\"list-style-type: none;\">\n<ul>\n<li>[2018.03.25]<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>\u4f18\u5316\u5224\u65ad\u903b\u8f91.<br \/>\n\u589e\u52a0\u624b\u52a8\u6307\u5b9a\u7f51\u7edc\u53c2\u6570\u9009\u9879,\u53ef\u6709\u6548\u907f\u514d\u81ea\u52a8\u83b7\u53d6\u7f51\u7edc\u53c2\u6570\u65e0\u6548\u9020\u6210\u65e0\u6cd5\u76f4\u63a5\u8054\u7f51\u7684\u95ee\u9898.<\/p>\n<ul>\n<li style=\"list-style-type: none;\">\n<ul>\n<li style=\"list-style-type: none;\"><\/li>\n<li><strong>\u80cc\u666f:<\/strong><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>1.\u5e26Windows\u7684\u4e3a\u4ec0\u4e48\u5c31\u5356\u5f97\u90a3\u4e48\u8d35?<br \/>\n2.\u5f53\u7136\u662f\u4e3a\u4e86\u66f4\u81ea\u7531\u7684\u4f7f\u7528\u81ea\u5df1\u7684\u673a\u5668.<\/p>\n<ul>\n<li><strong>\u9700\u6c42:<\/strong>\n<ol>\n<li>\u4e0e<a href=\"https:\/\/moeclub.org\/\" target=\"_blank\" rel=\"noopener noreferrer\"><strong>\u840c\u5496<\/strong><\/a>\u535a\u5ba2\u4e2d\u7684<a href=\"https:\/\/moeclub.org\/2017\/03\/25\/82\/\" target=\"_blank\" rel=\"noopener noreferrer\"><strong><u>Debian(Ubuntu)\u7f51\u7edc\u5b89\u88c5\/\u91cd\u88c5\u4e00\u952e\u811a\u672c<\/u><\/strong><\/a>\u9700\u6c42\u4e00\u6837.<\/li>\n<li>\u65e0DHCP\u65f6\u989d\u5916\u9700\u6c42:\u00a0<em>iconv<\/em><\/li>\n<\/ol>\n<\/li>\n<li>\n<pre class=\"pure-highlightjs\"><code class=\"\" null=\"\">#Debian\/Ubuntu\n## \u4e00\u822c\u81ea\u5e26\n#RedHat\/CentOS\nyum install glibc-common<\/code><\/pre>\n<p>&nbsp;<\/li>\n<li><strong>\u9650\u5236:<\/strong>\n<ul>\n<li><strong>\u9700\u8981\u5b9a\u5236dd\u5305.<\/strong>\n<ol>\n<li><strong>\u5f00\u542f\u5185\u7f6eAdministrator\u8d26\u6237\u767b\u5f55(\u914d\u7f6e\u81ea\u52a8\u767b\u9646).<\/strong>.<\/li>\n<li><strong>\u5f00\u542f\u8fdc\u7a0b\u684c\u9762<\/strong>(\u9ed8\u8ba43389\u7aef\u53e3).<\/li>\n<li><strong>\u7981\u7528UAC.<\/strong>.<\/li>\n<li>\u9002\u5f53\u7684\u8c03\u6574\u9632\u706b\u5899.(\u53ef\u9009)<\/li>\n<\/ol>\n<\/li>\n<li><strong>\u9700\u8981\u76f8\u5173\u7684\u865a\u62df\u5316\u9a71\u52a8.<\/strong>\n<ul>\n<li><a href=\"https:\/\/fedorapeople.org\/groups\/virt\/virtio-win\/direct-downloads\/stable-virtio\/virtio-win.iso\" target=\"_blank\" rel=\"noopener noreferrer\"><u>VirtIO\u9a71\u52a8<\/u><\/a>(\u5907\u4efd\u4e0b\u8f7d)\u00a0<a href=\"https:\/\/xenbits.xen.org\/pvdrivers\/win\/\" target=\"_blank\" rel=\"noopener noreferrer\"><u>XEN\u9a71\u52a8<\/u><\/a>(\u5907\u4efd\u4e0b\u8f7d)<\/li>\n<\/ul>\n<\/li>\n<li>dd\u5305\u89e3\u538b\u540e\u7684\u4f53\u79ef\u4e0d\u80fd\u8d85\u8fc7\u673a\u5668\u7b2c\u4e00\u5757\u786c\u76d8\u7684\u6700\u5927\u5bb9\u79ef.<\/li>\n<\/ul>\n<\/li>\n<li><strong>\u76f8\u5173\u6559\u7a0b:<\/strong>\n<ol>\n<li><a href=\"https:\/\/moeclub.org\/2017\/08\/31\/361\/\" target=\"_blank\" rel=\"noopener noreferrer\"><u><strong>\u4ece\u96f6\u5f00\u59cb:\u5728Linux\u4e0a\u8986\u76d6\u5b89\u88c5WINDOWS\u901a\u7528\u6559\u7a0b(dd)<br \/>\n#\u5236\u4f5c\u53ef\u7528\u7684\u955c\u50cf\u6587\u4ef6<\/strong><\/u><\/a><\/li>\n<li><a href=\"https:\/\/moeclub.org\/2017\/09\/06\/376\/\" target=\"_blank\" rel=\"noopener noreferrer\"><u>\u5173\u4e8e\u5728Windows\u4e0a\u5173\u95edCtrl+Alt+Del\u767b\u9646<\/u><\/a><\/li>\n<li><a href=\"https:\/\/moeclub.org\/2017\/09\/03\/367\/\" target=\"_blank\" rel=\"noopener noreferrer\"><u>\u6ce8\u518c\u8868\u5f00\u542f\u8fdc\u7a0b\u684c\u9762\u670d\u52a1\u548c3389\u7aef\u53e3<\/u><\/a><\/li>\n<li><a href=\"https:\/\/moeclub.org\/2017\/09\/03\/370\/\" target=\"_blank\" rel=\"noopener noreferrer\"><u>Windows\u901a\u8fc7\u6ce8\u518c\u8868\u7981\u7528\u6216\u5f00\u542f\u670d\u52a1\u9879<\/u><\/a><\/li>\n<li><a href=\"https:\/\/moeclub.org\/2017\/11\/20\/486\/\" target=\"_blank\" rel=\"noopener noreferrer\"><u>Windows\u901a\u8fc7\u6ce8\u518c\u8868\u7981\u7528UAC<\/u><\/a><\/li>\n<li><a href=\"https:\/\/moeclub.org\/2017\/11\/20\/489\/\" target=\"_blank\" rel=\"noopener noreferrer\"><u>Windows\u81ea\u52a8\u5e94\u7b54\u6587\u4ef6\u793a\u4f8b<\/u><\/a><\/li>\n<\/ol>\n<\/li>\n<li><strong>\u4f7f\u7528\u65b9\u6cd5:<\/strong><\/li>\n<\/ul>\n<pre class=\"pure-highlightjs\"><code class=\"\" null=\"\">wget --no-check-certificate -qO InstallNET.sh 'https:\/\/moeclub.org\/attachment\/LinuxShell\/InstallNET.sh' &amp;&amp; bash InstallNET.sh -dd '[Windows dd\u5305\u76f4\u8fde\u5730\u5740]'<\/code><\/pre>\n<ul>\n<li><strong>\u840c\u5496\u63d0\u4f9b\u7684demo\u5305<\/strong>(1.19G;\u5df2\u6fc0\u6d3b)<strong>:<\/strong><\/li>\n<li>\n<pre class=\"pure-highlightjs\"><code class=\"\" null=\"\">https:\/\/moeclub.org\/get-win7embx86-auto\n# \u8c37\u6b4c\u6587\u4ef6ID: 1srhylymTjYS-Ky8uLw4R6LCWfAo1F3s7\n# \u8be5\u5305\u53ea\u6dfb\u52a0\u4e86VirtIO\u9a71\u52a8,\u7406\u8bba\u4e0a\u4ec5\u80fd\u5728KVM,Hyper-V\u6784\u67b6\u4e0b\u6b63\u5e38\u8fd0\u884c.\n# \u5982\u9700\u5728\u5176\u4ed6\u865a\u62df\u5316\u6784\u67b6\u4e0b\u8fd0\u884c,\u8bf7\u81ea\u884c\u6dfb\u52a0\u76f8\u5173\u865a\u62df\u5316\u9a71\u52a8.<\/code><\/pre>\n<p>\u4f7f\u7528\u7684\u662fWindows Embedded Standard 7(Thin PC)\u4f5c\u4e3a\u5e95\u5305,\u5b98\u65b9\u7cbe\u7b80.<br \/>\n\u5982\u9700\u5176\u4ed6\u7ec4\u4ef6,\u4f8b\u5982:\u5b8c\u6574\u7684\u684c\u9762\u7279\u5f81,Windows\u7167\u7247\u67e5\u770b\u5668\u7b49.<br \/>\n\u8bf7\u53c2\u8003:\u00a0<a href=\"https:\/\/moeclub.org\/2017\/09\/08\/384\/\" target=\"_blank\" rel=\"noopener noreferrer\"><strong><u>Thin PC (Win7 Embedded) \u5b89\u88c5\u7ec4\u4ef6<\/u><\/strong><\/a><\/li>\n<li><strong>\u4f7f\u7528\u793a\u4f8b:<\/strong><\/li>\n<\/ul>\n<pre class=\"pure-highlightjs\"><code class=\"\" null=\"\">#\u5728\u4f60\u7684\u673a\u5668\u4e0a\u5168\u65b0\u5b89\u88c5,\u5982\u679c\u4f60\u6709VNC,\u53ef\u4ee5\u770b\u5230\u5168\u90e8\u8fc7\u7a0b.\n#\u5728dd\u7684\u8fc7\u7a0b\u4e2d,\u4f1a\u5361\u5728\u5206\u533a\u7684\u754c\u9762\u4e0a,\u4e0d\u4f1a\u8d70\u8fdb\u5ea6\u6761.\u5b8c\u6210\u540e\u5c06\u4f1a\u81ea\u52a8\u91cd\u542f.\n \nwget --no-check-certificate -qO InstallNET.sh 'https:\/\/moeclub.org\/attachment\/LinuxShell\/InstallNET.sh' &amp;&amp; bash InstallNET.sh -dd 'https:\/\/moeclub.org\/get-win7embx86-auto'<\/code><\/pre>\n<ul>\n<li><strong>\u4f7f\u7528\u793a\u4f8b(\u6307\u5b9a\u7f51\u7edc\u53c2\u6570):<\/strong><\/li>\n<\/ul>\n<pre class=\"pure-highlightjs\"><code class=\"\" null=\"\"># \u5c06X.X.X.X\u66ff\u6362\u4e3a\u81ea\u5df1\u7684\u7f51\u7edc\u53c2\u6570.\n# --ip-addr :IP Address\/IP\u5730\u5740\n# --ip-mask :Netmask   \/\u5b50\u7f51\u63a9\u7801\n# --ip-gate :Gateway   \/\u7f51\u5173\n# wget --no-check-certificate -qO InstallNET.sh 'https:\/\/moeclub.org\/attachment\/LinuxShell\/InstallNET.sh' &amp;&amp; bash InstallNET.sh --ip-addr X.X.X.X --ip-mask X.X.X.X --ip-gate X.X.X.X -dd 'https:\/\/moeclub.org\/get-win7embx86-auto'<\/code><\/pre>\n<ul>\n<li><strong>\u6ce8\u610f\u4e8b\u9879:<\/strong>\n<ol>\n<li>\u8fdc\u7a0b\u767b\u9646\u8d26\u53f7\u4e3a:\u00a0<strong><em>Administrator<\/em><\/strong><\/li>\n<li>\u8fdc\u7a0b\u767b\u9646\u5bc6\u7801\u4e3a:\u00a0<strong><em>Vicer<\/em><\/strong><\/li>\n<li>\u4ec5\u4fee\u6539\u4e86\u4e3b\u673a\u540d,\u53ef\u653e\u5fc3\u4f7f\u7528.(\u5efa\u8bae\u81ea\u5df1\u5236\u4f5c.)<\/li>\n<li>\u4f7f\u7528\u7684\u516c\u7528\u7f51\u76d8,\u5982\u9700\u957f\u671f\/\u5927\u91cf\u4f7f\u7528\u6b64\u5305\u8bf7\u81ea\u884c\u5907\u4efd.<\/li>\n<li><strong>\u5982\u679c\u56e0\u6b64\u8fdd\u53cd\u4e86TOS,<a href=\"https:\/\/moeclub.org\/\" target=\"_blank\" rel=\"noopener noreferrer\">\u840c\u5496<\/a>\u4e0d\u8d1f\u4efb\u4f55\u8d23\u4efb.<\/strong><\/li>\n<\/ol>\n<\/li>\n<li><strong>\u53ef\u80fd\u7528\u5230\u7684\u547d\u4ee4:<\/strong><\/li>\n<\/ul>\n<pre class=\"pure-highlightjs\"><code class=\"\" null=\"\">::\u4ee5\u7ba1\u7406\u5458\u8eab\u4efd\u8fd0\u884cCMD::\n \n::\u66f4\u6539\u7528\u6237\u7684\u5bc6\u7801\nnet user [\u7528\u6237\u540d] [\u5bc6\u7801]\n::\u6fc0\u6d3b Administrator \u8d26\u6237\nnet user Administrator \/active:yes\n::\u8bbe\u7f6e Administrator \u8d26\u6237\u5bc6\u7801\nnet user Administrator [\u65b0\u5bc6\u7801]\n::\u6dfb\u52a0\u7528\u6237\nnet user [\u7528\u6237\u540d] [\u5bc6\u7801] \/add\n::\u5c06\u7528\u6237\u6dfb\u52a0\u81f3 Administrator \u7ec4\nnet localgroup Administrators [\u7528\u6237\u540d] \/add\n::\u5220\u9664\u7528\u6237\nnet user [\u7528\u6237\u540d] \/del<\/code><\/pre>\n<ul>\n<li style=\"list-style-type: none;\">\n<ul>\n<li><strong>\u6e29\u99a8\u63d0\u793a:<\/strong><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>\u5728<strong>\u78c1\u76d8\u7ba1\u7406<\/strong>\u4e2d,\u70b9\u51fb\u2019<strong>C<\/strong>\u2018\u76d8,\u53f3\u952e\u9009\u62e9\u2019<strong>\u6269\u5c55\u5377<\/strong>\u2018,\u53ef\u4ee5\u76f4\u63a5\u2019<strong>\u589e\u52a0<\/strong>\u2018C\u76d8\u7684\u7a7a\u95f4.<br \/>\n<strong>\u6fc0\u6d3b\u76f8\u5173\u8bf7\u53c2\u8003:\u00a0<u><a href=\"https:\/\/moeclub.org\/kms\" target=\"_blank\" rel=\"noopener noreferrer\">https:\/\/moeclub.org\/kms<\/a><\/u><\/strong><\/p>\n<ul>\n<li style=\"list-style-type: none;\">\n<ul>\n<li><strong><a href=\"https:\/\/moeclub.org\/\" target=\"_blank\" rel=\"noopener noreferrer\">\u840c\u5496<\/a>\u63d0\u4f9b\u7684\u53ef\u7528\u5305:<\/strong>\n<ul>\u4e0e\u672c\u5730\u7528iso\u955c\u50cf\u5b89\u88c5\u8fc7\u7a0b\u4e00\u6837,\u5982\u679c\u4f60\u6709VNC,\u53ef\u770b\u5230\u5168\u90e8\u8fc7\u7a0b.<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul>\n<li style=\"list-style-type: none;\">\n<ul>\n<li style=\"list-style-type: none;\">\n<ul>\u56e0\u4e3a<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p><strong>\u5168\u65b0\u5b89\u88c5!!! \u5168\u65b0\u5b89\u88c5!!! \u5168\u65b0\u5b89\u88c5!!!<\/strong><\/p>\n<ul>\n<li style=\"list-style-type: none;\">\n<ul>\u00a0\u6240\u4ee5\u4f1a\u7b49\u5f85\u4e45\u4e00\u70b9.<\/p>\n<li>Windows Embedded 8.1 Industry Pro x64 (2.87G;KVM;XEN;Hyper-V;\u672a\u6fc0\u6d3b)<\/li>\n<\/ul>\n<\/li>\n<li>\n<pre class=\"pure-highlightjs\"><code class=\"\" null=\"\">\u76f4\u94fe:\nhttps:\/\/moeclub.org\/get-win8embx64-auto\n\u8c37\u6b4c\u7f51\u76d8\u6587\u4ef6ID:\n1cqVl2wSGx92UTdhOxU9pW3wJgmvZMT_J<\/code><\/pre>\n<p>&nbsp;<\/li>\n<li><strong>\u9884\u89c8:<\/strong><\/li>\n<li>\n<pre class=\"pure-highlightjs\"><code class=\"\" null=\"\">#!\/bin\/bash\n \nexport tmpVER=''\nexport tmpDIST=''\nexport tmpURL=''\nexport tmpWORD=''\nexport tmpMirror=''\nexport tmpSSL=''\nexport tmpINS=''\nexport tmpFW=''\nexport ipAddr=''\nexport ipMask=''\nexport ipGate=''\nexport linuxdists=''\nexport ddMode='0'\nexport setNet='0'\nexport isMirror='0'\nexport FindDists='0'\n \nwhile [[ $# -ge 1 ]]; do\n  case $1 in\n    -v|--ver)\n      shift\n      tmpVER=\"$1\"\n      shift\n      ;;\n    -d|--debian)\n      shift\n      linuxdists='debian'\n      tmpDIST=\"$1\"\n      shift\n      ;;\n    -u|--ubuntu)\n      shift\n      linuxdists='ubuntu'\n      tmpDIST=\"$1\"\n      shift\n      ;;\n    -dd|--image)\n      shift\n      ddMode='1'\n      tmpURL=\"$1\"\n      shift\n      ;;\n    -p|--password)\n      shift\n      tmpWORD=\"$1\"\n      shift\n      ;;\n    --ip-addr)\n      shift\n      ipAddr=\"$1\"\n      shift\n      ;;\n    --ip-mask)\n      shift\n      ipMask=\"$1\"\n      shift\n      ;;\n    --ip-gate)\n      shift\n      ipGate=\"$1\"\n      shift\n      ;;\n    -a|--auto)\n      shift\n      tmpINS='auto'\n      ;;\n    -m|--manual)\n      shift\n      tmpINS='manual'\n      ;;\n    -apt|--mirror)\n      shift\n      isMirror='1'\n      tmpMirror=\"$1\"\n      shift\n      ;;\n    -ssl)\n      shift\n      tmpSSL=\"$1\"\n      shift\n      ;;\n    --firmware)\n      shift\n      tmpFW='1'\n      ;;\n    *)\n      echo -ne \" Usage:\\n\\t$0\\t-d\/--debian [\\033[33m\\033[04mdists-name\\033[0m]\\n\\t\\t\\t\\t-u\/--ubuntu [\\033[04mdists-name\\033[0m]\\n\\t\\t\\t\\t-v\/--ver [32\/\\033[33m\\033[04mi386\\033[0m|64\/amd64]\\n\\t\\t\\t\\t--ip-addr\/--ip-gate\/--ip-mask\\n\\t\\t\\t\\t-apt\/--mirror\\n\\t\\t\\t\\t-dd\/--image\\n\\t\\t\\t\\t-a\/--auto\\n\\t\\t\\t\\t-m\/--manual\\n\"\n      exit 1;\n      ;;\n    esac\n  done\n \n[[ \"$EUID\" -ne '0' ]] &amp;&amp; echo \"Error:This script must be run as root!\" &amp;&amp; exit 1;\n \nfunction CheckDependence(){\nFullDependence='0';\nfor BIN_DEP in `echo \"$1\" |sed 's\/,\/\\n\/g'`\n  do\n    if [[ -n \"$BIN_DEP\" ]]; then\n      Founded='0';\n      for BIN_PATH in `echo \"$PATH\" |sed 's\/:\/\\n\/g'`\n        do\n          ls $BIN_PATH\/$BIN_DEP &gt;\/dev\/null 2&gt;&amp;1;\n          if [ $? == '0' ]; then\n            Founded='1';\n            break;\n          fi\n        done\n      if [ \"$Founded\" == '1' ]; then\n        echo -en \"$BIN_DEP\\t\\t[\\033[32mok\\033[0m]\\n\";\n      else\n        FullDependence='1';\n        echo -en \"$BIN_DEP\\t\\t[\\033[31mfail\\033[0m]\\n\";\n      fi\n    fi\n  done\nif [ \"$FullDependence\" == '1' ]; then\n  exit 1;\nfi\n}\n \nclear &amp;&amp; echo -e \"\\n\\033[36m# Check Dependence\\033[0m\\n\"\nCheckDependence wget,awk,grep,sed,cut,cat,cpio,gzip\n \n[ \"$ddMode\" == '1' ] &amp;&amp; {\nCheckDependence iconv\n}\n \n[[ -f '\/boot\/grub\/grub.cfg' ]] &amp;&amp; GRUBOLD='0' &amp;&amp; GRUBDIR='\/boot\/grub' &amp;&amp; GRUBFILE='grub.cfg';\n[[ -z \"$GRUBDIR\" ]] &amp;&amp; [[ -f '\/boot\/grub2\/grub.cfg' ]] &amp;&amp; GRUBOLD='0' &amp;&amp; GRUBDIR='\/boot\/grub2' &amp;&amp; GRUBFILE='grub.cfg';\n[[ -z \"$GRUBDIR\" ]] &amp;&amp; [[ -f '\/boot\/grub\/grub.conf' ]] &amp;&amp; GRUBOLD='1' &amp;&amp; GRUBDIR='\/boot\/grub' &amp;&amp; GRUBFILE='grub.conf';\n[ -z \"$GRUBDIR\" -o -z \"$GRUBFILE\" ] &amp;&amp; echo -ne \"Error! \\nNot Found grub path.\\n\" &amp;&amp; exit 1;\n \n[[ -n \"$tmpVER\" ]] &amp;&amp; {\n  [ \"$tmpVER\" == '32' -o \"$tmpVER\" == 'i386' ] &amp;&amp; VER='i386';\n  [ \"$tmpVER\" == '64' -o \"$tmpVER\" == 'amd64' ] &amp;&amp; VER='amd64';\n}\n[[ -z \"$VER\" ]] &amp;&amp; VER='i386';\n \n[[ -z \"$linuxdists\" ]] &amp;&amp; linuxdists='debian';\n \n[[ \"$isMirror\" == '1' ]] &amp;&amp; [[ -n \"$tmpMirror\" ]] &amp;&amp; {\n  tmpDebianMirror=\"$(echo -n \"$tmpMirror\" |grep -Eo '.*\\.(\\w+)')\";\n  echo -n \"$tmpDebianMirror\" |grep -q ':\/\/';\n  [[ $? -eq '0' ]] &amp;&amp; {\n    DebianMirror=\"$(echo -n \"$tmpDebianMirror\" |awk -F':\/\/' '{print $2}')\";\n  } || {\n    DebianMirror=\"$(echo -n \"$tmpDebianMirror\")\";\n  }\n} || {\n  [[ \"$linuxdists\" == 'debian' ]] &amp;&amp; DebianMirror='httpredir.debian.org';\n  [[ \"$linuxdists\" == 'ubuntu' ]] &amp;&amp; DebianMirror='archive.ubuntu.com';\n}\n \n[[ -z \"$DebianMirrorDirectory\" ]] &amp;&amp; [[ -n \"$DebianMirror\" ]] &amp;&amp; [[ -n \"$tmpMirror\" ]] &amp;&amp; {\n  DebianMirrorDirectory=\"$(echo -n \"$tmpMirror\" |awk -F''${DebianMirror}'' '{print $2}' |sed 's\/\\\/$\/\/g')\";\n}\n \n[[ -n \"$DebianMirror\" ]] &amp;&amp; {\n  [[ \"$DebianMirrorDirectory\" == '\/' ]] &amp;&amp; {\n    [[ \"$linuxdists\" == 'debian' ]] &amp;&amp; DebianMirrorDirectory='\/debian';\n    [[ \"$linuxdists\" == 'ubuntu' ]] &amp;&amp; DebianMirrorDirectory='\/ubuntu';\n  }\n  [[ -z \"$DebianMirrorDirectory\" ]] &amp;&amp; {\n    [[ \"$linuxdists\" == 'debian' ]] &amp;&amp; DebianMirrorDirectory='\/debian';\n    [[ \"$linuxdists\" == 'ubuntu' ]] &amp;&amp; DebianMirrorDirectory='\/ubuntu';\n  }\n}\n \n[[ -z \"$tmpDIST\" ]] &amp;&amp; {\n  [[ \"$linuxdists\" == 'debian' ]] &amp;&amp; DIST='wheezy';\n  [[ \"$linuxdists\" == 'ubuntu' ]] &amp;&amp; DIST='trusty';\n}\n \n[[ -z \"$DIST\" ]] &amp;&amp; {\n  DIST=\"$(echo \"$tmpDIST\" |sed -r 's\/(.*)\/\\L\\1\/')\";\n  echo \"$DIST\" |grep -q '[0-9]';\n  [[ $? -eq '0' ]] &amp;&amp; {\n    isDigital=\"$(echo \"$DIST\" |grep -o '[0-9\\.]\\{1,\\}' |sed -n '1h;1!H;$g;s\/\\n\/\/g;$p' |cut -d'.' -f1)\";\n    [[ -n $isDigital ]] &amp;&amp; {\n      [[ \"$isDigital\" == '7' ]] &amp;&amp; DIST='wheezy';\n      [[ \"$isDigital\" == '8' ]] &amp;&amp; DIST='jessie';\n      [[ \"$isDigital\" == '9' ]] &amp;&amp; DIST='stretch';\n      [[ \"$isDigital\" == '10' ]] &amp;&amp; DIST='buster';\n    }\n  }\n}\n \n[[ \"$ddMode\" == '1' ]] &amp;&amp; {\n  [[ -n \"$tmpURL\" ]] &amp;&amp; {\n    linuxdists='debian';\n    DIST='jessie';\n    VER='amd64';\n    tmpINS='auto';\n    DDURL=\"$tmpURL\"\n    echo \"$DDURL\" |grep -q '^http:\/\/\\|^ftp:\/\/\\|^https:\/\/';\n    [[ $? -ne '0' ]] &amp;&amp; echo 'Please input vaild URL,Only support http:\/\/, ftp:\/\/ and https:\/\/ !' &amp;&amp; exit 1;\n    [[ -n \"$tmpSSL\" ]] &amp;&amp; SSL_SUPPORT=\"$tmpSSL\";\n    [[ -z \"$SSL_SUPPORT\" ]] &amp;&amp; SSL_SUPPORT='https:\/\/moeclub.org\/get-wget_udeb_amd64';\n  } || {\n    echo 'Please input vaild URL! ';\n    exit 1;\n  }\n}\n \nDistsList=\"$(wget --no-check-certificate -qO- \"http:\/\/$DebianMirror$DebianMirrorDirectory\/dists\/\" |grep -o 'href=.*\/\"' |cut -d'\"' -f2 |sed '\/-\\|old\\|Debian\\|experimental\\|stable\\|test\\|sid\\|devel\/d' |grep '^[^\/]' |sed -n '1h;1!H;$g;s\/\\n\/\/g;s\/\\\/\/\\;\/g;$p')\";\nfor CheckDEB in `echo \"$DistsList\" |sed 's\/;\/\\n\/g'`\n  do\n    [[ \"$CheckDEB\" == \"$DIST\" ]] &amp;&amp; FindDists='1';\n    [[ \"$FindDists\" == '1' ]] &amp;&amp; break;\n  done\n[[ \"$FindDists\" == '0' ]] &amp;&amp; {\n  echo -ne '\\nThe dists version not found, Please check it! \\n\\n'\n  bash $0 error;\n  exit 1;\n}\n \n[[ -n \"$tmpINS\" ]] &amp;&amp; {\n  [[ \"$tmpINS\" == 'auto' ]] &amp;&amp; inVNC='n';\n  [[ \"$tmpINS\" == 'manual' ]] &amp;&amp; inVNC='y';\n}\n \n[ -n \"$ipAddr\" ] &amp;&amp; [ -n \"$ipMask\" ] &amp;&amp; [ -n \"$ipGate\" ] &amp;&amp; setNet='1';\n[[ -n \"$tmpWORD\" ]] &amp;&amp; myPASSWORD=\"$tmpWORD\";\n[[ -n \"$tmpFW\" ]] &amp;&amp; INCFW=\"$tmpFW\";\n[[ -z \"$myPASSWORD\" ]] &amp;&amp; myPASSWORD='Vicer';\n[[ -z \"$INCFW\" ]] &amp;&amp; INCFW='0';\n \nclear &amp;&amp; echo -e \"\\n\\033[36m# Install\\033[0m\\n\"\n \nASKVNC(){\n  inVNC='y';\n  [[ \"$ddMode\" == '0' ]] &amp;&amp; {\n    echo -ne \"\\033[34mCan you login VNC?\\033[0m\\e[33m[\\e[32my\\e[33m\/n]\\e[0m \"\n    read tmpinVNC\n    [[ -n \"$tmpinVNC\" ]] &amp;&amp; inVNCtmp=\"$tmpinVNC\"\n  }\n  [ \"$inVNCtmp\" == 'y' -o \"$inVNCtmp\" == 'Y' ] &amp;&amp; inVNC='y';\n  [ \"$inVNCtmp\" == 'n' -o \"$inVNCtmp\" == 'N' ] &amp;&amp; inVNC='n';\n}\n \n[ \"$inVNC\" == 'y' -o \"$inVNC\" == 'n' ] || ASKVNC;\n[[ \"$linuxdists\" == 'debian' ]] &amp;&amp; LinuxName='Debian';\n[[ \"$linuxdists\" == 'ubuntu' ]] &amp;&amp; LinuxName='Ubuntu';\n[[ \"$ddMode\" == '0' ]] &amp;&amp; { \n  [[ \"$inVNC\" == 'y' ]] &amp;&amp; echo -e \"\\033[34mManual Mode\\033[0m insatll \\033[33m$LinuxName\\033[0m [\\033[33m$DIST\\033[0m] [\\033[33m$VER\\033[0m] in VNC. \"\n  [[ \"$inVNC\" == 'n' ]] &amp;&amp; echo -e \"\\033[34mAuto Mode\\033[0m insatll \\033[33m$LinuxName\\033[0m [\\033[33m$DIST\\033[0m] [\\033[33m$VER\\033[0m]. \"\n}\n[[ \"$ddMode\" == '1' ]] &amp;&amp; {\n  echo -ne \"\\033[34mAuto Mode\\033[0m insatll \\033[33mWindows\\033[0m\\n[\\033[33m$DDURL\\033[0m]\\n\"\n}\n \necho -e \"\\n[\\033[33m$LinuxName\\033[0m] [\\033[33m$DIST\\033[0m] [\\033[33m$VER\\033[0m] Downloading...\"\n[[ -z \"$DebianMirror\" ]] &amp;&amp; echo -ne \"\\033[31mError! \\033[0mGet debian mirror fail! \\n\" &amp;&amp; exit 1\n[[ -z \"$DebianMirrorDirectory\" ]] &amp;&amp; echo -ne \"\\033[31mError! \\033[0mGet debian mirror directory fail! \\n\" &amp;&amp; exit 1\nwget --no-check-certificate -qO '\/boot\/initrd.gz' \"http:\/\/$DebianMirror$DebianMirrorDirectory\/dists\/$DIST\/main\/installer-$VER\/current\/images\/netboot\/$linuxdists-installer\/$VER\/initrd.gz\"\n[[ $? -ne '0' ]] &amp;&amp; echo -ne \"\\033[31mError! \\033[0mDownload 'initrd.gz' failed! \\n\" &amp;&amp; exit 1\nwget --no-check-certificate -qO '\/boot\/linux' \"http:\/\/$DebianMirror$DebianMirrorDirectory\/dists\/$DIST\/main\/installer-$VER\/current\/images\/netboot\/$linuxdists-installer\/$VER\/linux\"\n[[ $? -ne '0' ]] &amp;&amp; echo -ne \"\\033[31mError! \\033[0mDownload 'linux' failed! \\n\" &amp;&amp; exit 1\n[[ \"$INCFW\" == '1' ]] &amp;&amp; [[ \"$linuxdists\" == 'debian' ]] &amp;&amp; {\n  wget --no-check-certificate -qO '\/boot\/firmware.cpio.gz' \"http:\/\/cdimage.debian.org\/cdimage\/unofficial\/non-free\/firmware\/$DIST\/current\/firmware.cpio.gz\"\n  [[ $? -ne '0' ]] &amp;&amp; echo -ne \"\\033[31mError! \\033[0mDownload 'firmware' failed! \\n\" &amp;&amp; exit 1\n}\n \n[[ \"$setNet\" == '1' ]] &amp;&amp; {\n  IPv4=\"$ipAddr\";\n  MASK=\"$ipMask\";\n  GATE=\"$ipGate\";\n} || {\n  DEFAULTNET=\"$(ip route show |grep -o 'default via [0-9]\\{1,3\\}.[0-9]\\{1,3\\}.[0-9]\\{1,3\\}.[0-9]\\{1,3\\}.*' |head -n1 |sed 's\/proto.*\\|onlink.*\/\/g' |awk '{print $NF}')\";\n  [[ -n \"$DEFAULTNET\" ]] &amp;&amp; IPSUB=\"$(ip addr |grep ''${DEFAULTNET}'' |grep 'global' |grep 'brd' |head -n1 |grep -o '[0-9]\\{1,3\\}.[0-9]\\{1,3\\}.[0-9]\\{1,3\\}.[0-9]\\{1,3\\}\/[0-9]\\{1,2\\}')\";\n  IPv4=\"$(echo -n \"$IPSUB\" |cut -d'\/' -f1)\";\n  NETSUB=\"$(echo -n \"$IPSUB\" |grep -o '\/[0-9]\\{1,2\\}')\";\n  GATE=\"$(ip route show |grep -o 'default via [0-9]\\{1,3\\}.[0-9]\\{1,3\\}.[0-9]\\{1,3\\}.[0-9]\\{1,3\\}' |head -n1 |grep -o '[0-9]\\{1,3\\}.[0-9]\\{1,3\\}.[0-9]\\{1,3\\}.[0-9]\\{1,3\\}')\";\n  [[ -n \"$NETSUB\" ]] &amp;&amp; MASK=\"$(echo -n '128.0.0.0\/1,192.0.0.0\/2,224.0.0.0\/3,240.0.0.0\/4,248.0.0.0\/5,252.0.0.0\/6,254.0.0.0\/7,255.0.0.0\/8,255.128.0.0\/9,255.192.0.0\/10,255.224.0.0\/11,255.240.0.0\/12,255.248.0.0\/13,255.252.0.0\/14,255.254.0.0\/15,255.255.0.0\/16,255.255.128.0\/17,255.255.192.0\/18,255.255.224.0\/19,255.255.240.0\/20,255.255.248.0\/21,255.255.252.0\/22,255.255.254.0\/23,255.255.255.0\/24,255.255.255.128\/25,255.255.255.192\/26,255.255.255.224\/27,255.255.255.240\/28,255.255.255.248\/29,255.255.255.252\/30,255.255.255.254\/31,255.255.255.255\/32' |grep -o '[0-9]\\{1,3\\}.[0-9]\\{1,3\\}.[0-9]\\{1,3\\}.[0-9]\\{1,3\\}'${NETSUB}'' |cut -d'\/' -f1)\";\n}\n \n[[ -n \"$GATE\" ]] &amp;&amp; [[ -n \"$MASK\" ]] &amp;&amp; [[ -n \"$IPv4\" ]] || {\necho \"Not found `ip command`, It will use `route command`.\"\nipNum() {\n  local IFS='.';\n  read ip1 ip2 ip3 ip4 &lt;&lt;&lt;\"$1\";\n  echo $((ip1*(1&lt;&lt;24)+ip2*(1&lt;&lt;16)+ip3*(1&lt;&lt;8)+ip4));\n}\n \nSelectMax(){\nii=0;\nfor IPITEM in `route -n |awk -v OUT=$1 '{print $OUT}' |grep '[0-9]\\{1,3\\}.[0-9]\\{1,3\\}.[0-9]\\{1,3\\}.[0-9]\\{1,3\\}'`\n  do\n    NumTMP=\"$(ipNum $IPITEM)\";\n    eval \"arrayNum[$ii]='$NumTMP,$IPITEM'\";\n    ii=$[$ii+1];\n  done\necho ${arrayNum[@]} |sed 's\/\\s\/\\n\/g' |sort -n -k 1 -t ',' |tail -n1 |cut -d',' -f2;\n}\n \n[[ -z $IPv4 ]] &amp;&amp; IPv4=\"$(ifconfig |grep 'Bcast' |head -n1 |grep -o '[0-9]\\{1,3\\}.[0-9]\\{1,3\\}.[0-9]\\{1,3\\}.[0-9]\\{1,3\\}' |head -n1)\";\n[[ -z $GATE ]] &amp;&amp; GATE=\"$(SelectMax 2)\";\n[[ -z $MASK ]] &amp;&amp; MASK=\"$(SelectMax 3)\";\n \n[[ -n \"$GATE\" ]] &amp;&amp; [[ -n \"$MASK\" ]] &amp;&amp; [[ -n \"$IPv4\" ]] || {\n  echo \"Error! Not configure network. \";\n  exit 1;\n}\n}\n \n[[ \"$setNet\" != '1' ]] &amp;&amp; [[ -f '\/etc\/network\/interfaces' ]] &amp;&amp; {\n  [[ -z \"$(sed -n '\/iface.*inet static\/p' \/etc\/network\/interfaces)\" ]] &amp;&amp; AutoNet='1' || AutoNet='0';\n  [[ -d \/etc\/network\/interfaces.d ]] &amp;&amp; {\n    ICFGN=\"$(find \/etc\/network\/interfaces.d -name '*.cfg' |wc -l)\" || ICFGN='0';\n    [[ \"$ICFGN\" -ne '0' ]] &amp;&amp; {\n      for NetCFG in `ls -1 \/etc\/network\/interfaces.d\/*.cfg`\n        do \n          [[ -z \"$(cat $NetCFG | sed -n '\/iface.*inet static\/p')\" ]] &amp;&amp; AutoNet='1' || AutoNet='0';\n          [[ \"$AutoNet\" -eq '0' ]] &amp;&amp; break;\n        done\n    }\n  }\n}\n \n[[ \"$setNet\" != '1' ]] &amp;&amp; [[ -d '\/etc\/sysconfig\/network-scripts' ]] &amp;&amp; {\n  ICFGN=\"$(find \/etc\/sysconfig\/network-scripts -name 'ifcfg-*' |grep -v 'lo'|wc -l)\" || ICFGN='0';\n  [[ \"$ICFGN\" -ne '0' ]] &amp;&amp; {\n    for NetCFG in `ls -1 \/etc\/sysconfig\/network-scripts\/ifcfg-* |grep -v 'lo$' |grep -v ':[0-9]\\{1,\\}'`\n      do \n        [[ -n \"$(cat $NetCFG | sed -n '\/BOOTPROTO.*[dD][hH][cC][pP]\/p')\" ]] &amp;&amp; AutoNet='1' || {\n          AutoNet='0' &amp;&amp; . $NetCFG;\n          [[ -n $NETMASK ]] &amp;&amp; MASK=\"$NETMASK\";\n          [[ -n $GATEWAY ]] &amp;&amp; GATE=\"$GATEWAY\";\n        }\n        [[ \"$AutoNet\" -eq '0' ]] &amp;&amp; break;\n      done\n  }\n}\n \n[[ ! -f $GRUBDIR\/$GRUBFILE ]] &amp;&amp; echo \"Error! Not Found $GRUBFILE. \" &amp;&amp; exit 1;\n \n[[ ! -f $GRUBDIR\/$GRUBFILE.old ]] &amp;&amp; [[ -f $GRUBDIR\/$GRUBFILE.bak ]] &amp;&amp; mv -f $GRUBDIR\/$GRUBFILE.bak $GRUBDIR\/$GRUBFILE.old;\nmv -f $GRUBDIR\/$GRUBFILE $GRUBDIR\/$GRUBFILE.bak;\n[[ -f $GRUBDIR\/$GRUBFILE.old ]] &amp;&amp; cat $GRUBDIR\/$GRUBFILE.old &gt;$GRUBDIR\/$GRUBFILE || cat $GRUBDIR\/$GRUBFILE.bak &gt;$GRUBDIR\/$GRUBFILE;\n \n[[ \"$GRUBOLD\" == '0' ]] &amp;&amp; {\n  READGRUB='\/tmp\/grub.read'\n  cat $GRUBDIR\/$GRUBFILE |sed -n '1h;1!H;$g;s\/\\n\/+++\/g;$p' |grep -oPm 1 'menuentry\\ .*\\{.*\\}\\+\\+\\+' |sed 's\/\\+\\+\\+\/\\n\/g' &gt;$READGRUB\n  LoadNum=\"$(cat $READGRUB |grep -c 'menuentry ')\"\n  if [[ \"$LoadNum\" -eq '1' ]]; then\n    cat $READGRUB |sed '\/^$\/d' &gt;\/tmp\/grub.new;\n  elif [[ \"$LoadNum\" -gt '1' ]]; then\n    CFG0=\"$(awk '\/menuentry \/{print NR}' $READGRUB|head -n 1)\";\n    CFG2=\"$(awk '\/menuentry \/{print NR}' $READGRUB|head -n 2 |tail -n 1)\";\n    CFG1=\"\";\n    for tmpCFG in `awk '\/}\/{print NR}' $READGRUB`\n      do\n        [ \"$tmpCFG\" -gt \"$CFG0\" -a \"$tmpCFG\" -lt \"$CFG2\" ] &amp;&amp; CFG1=\"$tmpCFG\";\n      done\n    [[ -z \"$CFG1\" ]] &amp;&amp; {\n      echo \"Error! read $GRUBFILE. \";\n      exit 1;\n    }\n \n    sed -n \"$CFG0,$CFG1\"p $READGRUB &gt;\/tmp\/grub.new;\n    [[ -f \/tmp\/grub.new ]] &amp;&amp; [[ \"$(grep -c '{' \/tmp\/grub.new)\" -eq \"$(grep -c '}' \/tmp\/grub.new)\" ]] || {\n      echo -ne \"\\033[31mError! \\033[0mNot configure $GRUBFILE. \\n\";\n      exit 1;\n    }\n  fi\n  [ ! -f \/tmp\/grub.new ] &amp;&amp; echo \"Error! $GRUBFILE. \" &amp;&amp; exit 1;\n  sed -i \"\/menuentry.*\/c\\menuentry\\ \\'Install OS \\[$DIST\\ $VER\\]\\'\\ --class debian\\ --class\\ gnu-linux\\ --class\\ gnu\\ --class\\ os\\ \\{\" \/tmp\/grub.new\n  sed -i \"\/echo.*Loading\/d\" \/tmp\/grub.new;\n}\n \n[[ \"$GRUBOLD\" == '1' ]] &amp;&amp; {\n  CFG0=\"$(awk '\/title \/{print NR}' $GRUBDIR\/$GRUBFILE|head -n 1)\";\n  CFG1=\"$(awk '\/title \/{print NR}' $GRUBDIR\/$GRUBFILE|head -n 2 |tail -n 1)\";\n  [[ -n $CFG0 ]] &amp;&amp; [ -z $CFG1 -o $CFG1 == $CFG0 ] &amp;&amp; sed -n \"$CFG0,$\"p $GRUBDIR\/$GRUBFILE &gt;\/tmp\/grub.new;\n  [[ -n $CFG0 ]] &amp;&amp; [ -z $CFG1 -o $CFG1 != $CFG0 ] &amp;&amp; sed -n \"$CFG0,$CFG1\"p $GRUBDIR\/$GRUBFILE &gt;\/tmp\/grub.new;\n  [[ ! -f \/tmp\/grub.new ]] &amp;&amp; echo \"Error! configure append $GRUBFILE. \" &amp;&amp; exit 1;\n  sed -i \"\/title.*\/c\\title\\ \\'Install OS \\[$DIST\\ $VER\\]\\'\" \/tmp\/grub.new;\n  sed -i '\/^#\/d' \/tmp\/grub.new;\n}\n \n[[ -n \"$(grep 'linux.*\/\\|kernel.*\/' \/tmp\/grub.new |awk '{print $2}' |tail -n 1 |grep '^\/boot\/')\" ]] &amp;&amp; Type='InBoot' || Type='NoBoot';\n \nLinuxKernel=\"$(grep 'linux.*\/\\|kernel.*\/' \/tmp\/grub.new |awk '{print $1}' |head -n 1)\";\n[[ -z \"$LinuxKernel\" ]] &amp;&amp; echo \"Error! read grub config! \" &amp;&amp; exit 1;\nLinuxIMG=\"$(grep 'initrd.*\/' \/tmp\/grub.new |awk '{print $1}' |tail -n 1)\";\n[ -z \"$LinuxIMG\" ] &amp;&amp; sed -i \"\/$LinuxKernel.*\\\/\/a\\\\\\tinitrd\\ \\\/\" \/tmp\/grub.new &amp;&amp; LinuxIMG='initrd';\n \n[[ \"$Type\" == 'InBoot' ]] &amp;&amp; {\n  sed -i \"\/$LinuxKernel.*\\\/\/c\\\\\\t$LinuxKernel\\\\t\\\/boot\\\/linux auto=true hostname=$linuxdists domain= -- quiet\" \/tmp\/grub.new;\n  sed -i \"\/$LinuxIMG.*\\\/\/c\\\\\\t$LinuxIMG\\\\t\\\/boot\\\/initrd.gz\" \/tmp\/grub.new;\n}\n \n[[ \"$Type\" == 'NoBoot' ]] &amp;&amp; {\n  sed -i \"\/$LinuxKernel.*\\\/\/c\\\\\\t$LinuxKernel\\\\t\\\/linux auto=true hostname=$linuxdists domain= -- quiet\" \/tmp\/grub.new;\n  sed -i \"\/$LinuxIMG.*\\\/\/c\\\\\\t$LinuxIMG\\\\t\\\/initrd.gz\" \/tmp\/grub.new;\n}\n \nsed -i '$a\\\\n' \/tmp\/grub.new;\n \n[[ \"$inVNC\" == 'n' ]] &amp;&amp; {\nGRUBPATCH='0';\n \n[ -f '\/etc\/network\/interfaces' -o -d '\/etc\/sysconfig\/network-scripts' ] || {\n  echo \"Error, Not found interfaces config.\";\n  exit 1;\n}\n \nINSERTGRUB=\"$(awk '\/menuentry \/{print NR}' $GRUBDIR\/$GRUBFILE|head -n 1)\"\nsed -i ''${INSERTGRUB}'i\\\\n' $GRUBDIR\/$GRUBFILE;\nsed -i ''${INSERTGRUB}'r \/tmp\/grub.new' $GRUBDIR\/$GRUBFILE;\n[[ -f  $GRUBDIR\/grubenv ]] &amp;&amp; sed -i 's\/saved_entry\/#saved_entry\/g' $GRUBDIR\/grubenv;\n \n[[ -d \/boot\/tmp ]] &amp;&amp; rm -rf \/boot\/tmp;\nmkdir -p \/boot\/tmp;\ncd \/boot\/tmp;\ngzip -d &lt; ..\/initrd.gz | cpio --extract --verbose --make-directories --no-absolute-filenames &gt;&gt;\/dev\/null 2&gt;&amp;1\n \ncat &gt;\/boot\/tmp\/preseed.cfg&lt;&lt;EOF\nd-i debian-installer\/locale string en_US\nd-i console-setup\/layoutcode string us\n \nd-i keyboard-configuration\/xkb-keymap string us\n \nd-i netcfg\/choose_interface select auto\n \nd-i netcfg\/disable_autoconfig boolean true\nd-i netcfg\/dhcp_failed note\nd-i netcfg\/dhcp_options select Configure network manually\nd-i netcfg\/get_ipaddress string $IPv4\nd-i netcfg\/get_netmask string $MASK\nd-i netcfg\/get_gateway string $GATE\nd-i netcfg\/get_nameservers string 8.8.8.8\nd-i netcfg\/no_default_route boolean true\nd-i netcfg\/confirm_static boolean true\n \nd-i hw-detect\/load_firmware boolean true\n \nd-i mirror\/country string manual\nd-i mirror\/http\/hostname string $DebianMirror\nd-i mirror\/http\/directory string $DebianMirrorDirectory\nd-i mirror\/http\/proxy string\n \nd-i passwd\/root-login boolean ture\nd-i passwd\/make-user boolean false\nd-i passwd\/root-password password $myPASSWORD\nd-i passwd\/root-password-again password $myPASSWORD\nd-i user-setup\/allow-password-weak boolean true\nd-i user-setup\/encrypt-home boolean false\n \nd-i clock-setup\/utc boolean true\nd-i time\/zone string US\/Eastern\nd-i clock-setup\/ntp boolean true\n \nd-i preseed\/early_command string anna-install libfuse2-udeb fuse-udeb ntfs-3g-udeb fuse-modules-3.16.0-4-amd64-di\nd-i partman\/early_command string \\\ndebconf-set partman-auto\/disk \"\\$(list-devices disk |head -n1)\"; \\\nwget -qO- '$DDURL' |gunzip -dc |\/bin\/dd of=\\$(list-devices disk |head -n1); \\\nmount.ntfs-3g \\$(list-devices partition |head -n1) \/mnt; \\\ncd '\/mnt\/ProgramData\/Microsoft\/Windows\/Start Menu\/Programs'; \\\ncd Start* || cd start*; \\\ncp -f '\/net.bat' '.\/net.bat'; \\\n\/sbin\/reboot; \\\ndebconf-set grub-installer\/bootdev string \"\\$(list-devices disk |head -n1)\"; \\\numount \/media || true; \\\n \nd-i partman\/mount_style select uuid\nd-i partman-auto\/init_automatically_partition select Guided - use entire disk\nd-i partman-auto\/method string regular\nd-i partman-lvm\/device_remove_lvm boolean true\nd-i partman-md\/device_remove_md boolean true\nd-i partman-auto\/choose_recipe select atomic\nd-i partman-partitioning\/confirm_write_new_label boolean true\nd-i partman\/choose_partition select finish\nd-i partman-lvm\/confirm boolean true\nd-i partman-lvm\/confirm_nooverwrite boolean true\nd-i partman\/confirm boolean true\nd-i partman\/confirm_nooverwrite boolean true\n \nd-i debian-installer\/allow_unauthenticated boolean true\n \ntasksel tasksel\/first multiselect minimal\nd-i pkgsel\/update-policy select none\nd-i pkgsel\/include string openssh-server\nd-i pkgsel\/upgrade select none\n \npopularity-contest popularity-contest\/participate boolean false\n \nd-i grub-installer\/only_debian boolean true\nd-i grub-installer\/bootdev string default\nd-i finish-install\/reboot_in_progress note\nd-i debian-installer\/exit\/reboot boolean true\nd-i preseed\/late_command string\t\\\nsed -ri 's\/^#?PermitRootLogin.*\/PermitRootLogin yes\/g' \/target\/etc\/ssh\/sshd_config; \\\nsed -ri 's\/^#?PasswordAuthentication.*\/PasswordAuthentication yes\/g' \/target\/etc\/ssh\/sshd_config;\nEOF\n \n[[ \"$setNet\" == '0' ]] &amp;&amp; [[ \"$AutoNet\" == '1' ]] &amp;&amp; {\n  sed -i '\/netcfg\\\/disable_autoconfig\/d' \/boot\/tmp\/preseed.cfg\n  sed -i '\/netcfg\\\/dhcp_options\/d' \/boot\/tmp\/preseed.cfg\n  sed -i '\/netcfg\\\/get_.*\/d' \/boot\/tmp\/preseed.cfg\n  sed -i '\/netcfg\\\/confirm_static\/d' \/boot\/tmp\/preseed.cfg\n}\n \n[[ \"$DIST\" == 'trusty' ]] &amp;&amp; GRUBPATCH='1'\n[[ \"$DIST\" == 'wily' ]] &amp;&amp; GRUBPATCH='1'\n \n[[ \"$GRUBPATCH\" == '1' ]] &amp;&amp; {\n  sed -i 's\/^d-i\\ grub-installer\\\/bootdev\\ string\\ default\/\/g' \/boot\/tmp\/preseed.cfg\n}\n[[ \"$GRUBPATCH\" == '0' ]] &amp;&amp; {\n  sed -i 's\/debconf-set\\ grub-installer\\\/bootdev.*\\\"\\;\/\/g' \/boot\/tmp\/preseed.cfg\n}\n[[ \"$DIST\" == 'xenial' ]] &amp;&amp; {\n  sed -i 's\/^d-i\\ clock-setup\\\/ntp\\ boolean\\ true\/d-i\\ clock-setup\\\/ntp\\ boolean\\ false\/g' \/boot\/tmp\/preseed.cfg\n}\n \n[[ \"$linuxdists\" == 'debian' ]] &amp;&amp; {\n  sed -i '\/user-setup\\\/allow-password-weak\/d' \/boot\/tmp\/preseed.cfg\n  sed -i '\/user-setup\\\/encrypt-home\/d' \/boot\/tmp\/preseed.cfg\n  sed -i '\/pkgsel\\\/update-policy\/d' \/boot\/tmp\/preseed.cfg\n  sed -i 's\/umount\\ \\\/media.*true\\;\\ \/\/g' \/boot\/tmp\/preseed.cfg\n}\n \n[[ \"$ddMode\" == '1' ]] &amp;&amp; {\nWinDHCP(){\n  echo -ne \"@ECHO OFF\\r\\ncd\\040\\057d\\040\\042\\045ProgramData\\045\\057Microsoft\\057Windows\\057Start\\040Menu\\057Programs\\057Startup\\042\\r\\ndel\\040\\057f\\040\\057q\\040net\\056bat\\r\\n\\r\\n\" &gt;'\/boot\/tmp\/net.tmp';\n}\nWinNoDHCP(){\n  echo -ne \"@ECHO OFF\\r\\ncd\\056\\076\\045windir\\045\\GetAdmin\\r\\nif\\040exist\\040\\045windir\\045\\GetAdmin\\040\\050del\\040\\057f\\040\\057q\\040\\042\\045windir\\045\\GetAdmin\\042\\051\\040else\\040\\050\\r\\necho\\040CreateObject^\\050\\042Shell\\056Application\\042^\\051\\056ShellExecute\\040\\042\\045~s0\\042\\054\\040\\042\\045\\052\\042\\054\\040\\042\\042\\054\\040\\042runas\\042\\054\\040\\061\\040\\076\\076\\040\\042\\045temp\\045\\Admin\\056vbs\\042\\r\\n\\042\\045temp\\045\\Admin\\056vbs\\042\\r\\ndel\\040\\057f\\040\\057q\\040\\042\\045temp\\045\\Admin\\056vbs\\042\\r\\nexit\\040\\057b\\040\\062\\051\\r\\nfor\\040\\057f\\040\\042tokens=\\063\\052\\042\\040\\045\\045i\\040in\\040\\050\\047netsh\\040interface\\040show\\040interface\\040^|more\\040+3\\040^|findstr\\040\\057R\\040\\042\\u672c\\u5730\\056\\052\\040\\u4ee5\\u592a\\056\\052\\040Local\\056\\052\\040Ethernet\\042\\047\\051\\040do\\040\\050set\\040EthName=\\045\\045j\\051\\r\\nnetsh\\040-c\\040interface\\040ip\\040set\\040address\\040name=\\042\\045EthName\\045\\042\\040source=static\\040address=$IPv4\\040mask=$MASK\\040gateway=$GATE\\r\\nnetsh\\040-c\\040interface\\040ip\\040add\\040dnsservers\\040name=\\042\\045EthName\\045\\042\\040address=\\070\\056\\070\\056\\070\\056\\070\\040index=1\\040validate=no\\r\\nnetsh\\040-c\\040interface\\040ip\\040add\\040dnsservers\\040name=\\042\\045EthName\\045\\042\\040address=\\070\\056\\070\\056\\064\\056\\064\\040index=2\\040validate=no\\r\\ncd\\040\\057d\\040\\042\\045ProgramData\\045\\057Microsoft\\057Windows\\057Start\\040Menu\\057Programs\\057Startup\\042\\r\\ndel\\040\\057f\\040\\057q\\040net\\056bat\\r\\n\\r\\n\" &gt;'\/boot\/tmp\/net.tmp';\n}\n  [[ \"$setNet\" == '1' ]] &amp;&amp; WinNoDHCP;\n  [[ \"$setNet\" == '0' ]] &amp;&amp; {\n    [[ \"$AutoNet\" -eq '1' ]] &amp;&amp; WinDHCP;\n    [[ \"$AutoNet\" -eq '0' ]] &amp;&amp; WinNoDHCP;\n  }\n  iconv -f 'UTF-8' -t 'GBK' '\/boot\/tmp\/net.tmp' -o '\/boot\/tmp\/net.bat'\n  rm -rf '\/boot\/tmp\/net.tmp'\n  echo \"$DDURL\" |grep -q '^https:\/\/'\n  [[ $? -eq '0' ]] &amp;&amp; {\n    echo -ne '\\nAdd ssl support...\\n'\n    [[ -n $SSL_SUPPORT ]] &amp;&amp; {\n      wget --no-check-certificate -qO- \"$SSL_SUPPORT\" |tar -x\n      [[ ! -f  \/boot\/tmp\/usr\/bin\/wget ]] &amp;&amp; echo 'Error! SSL_SUPPORT.' &amp;&amp; exit 1;\n      sed -i 's\/wget\\ -qO-\/\\\/usr\\\/bin\\\/wget\\ --no-check-certificate\\ --retry-connrefused\\ --tries=7\\ --continue\\ -qO-\/g' \/boot\/tmp\/preseed.cfg\n      [[ $? -eq '0' ]] &amp;&amp; echo -ne 'Success! \\n\\n'\n    } || {\n    echo -ne 'Not ssl support package! \\n\\n';\n    exit 1;\n    }\n  }\n}\n \n[[ \"$ddMode\" == '0' ]] &amp;&amp; {\n  sed -i '\/anna-install\/d' \/boot\/tmp\/preseed.cfg\n  sed -i 's\/wget.*\\\/sbin\\\/reboot\\;\\ \/\/g' \/boot\/tmp\/preseed.cfg\n}\n[[ \"$INCFW\" == '1' ]] &amp;&amp; [[ \"$linuxdists\" == 'debian' ]] &amp;&amp; [[ -f '\/boot\/firmware.cpio.gz' ]] &amp;&amp; {\n  gzip -d &lt; ..\/firmware.cpio.gz | cpio --extract --verbose --make-directories --no-absolute-filenames &gt;&gt;\/dev\/null 2&gt;&amp;1\n}\nrm -rf ..\/initrd.gz;\nfind . | cpio -H newc --create --verbose | gzip -9 &gt; ..\/initrd.gz;\nrm -rf \/boot\/tmp;\n}\n \n[[ \"$inVNC\" == 'y' ]] &amp;&amp; {\n  sed -i '$i\\\\n' $GRUBDIR\/$GRUBFILE\n  sed -i '$r \/tmp\/grub.new' $GRUBDIR\/$GRUBFILE\n  echo -e \"\\n\\033[33m\\033[04mIt will reboot! \\nPlease look at VNC! \\nSelect\\033[0m\\033[32m Install OS [$DIST $VER] \\033[33m\\033[4mto install system.\\033[04m\\n\\n\\033[31m\\033[04mThere is some information for you.\\nDO NOT CLOSE THE WINDOW! \\033[0m\\n\"\n  echo -e \"\\033[35mIPv4\\t\\tNETMASK\\t\\tGATEWAY\\033[0m\"\n  echo -e \"\\033[36m\\033[04m$IPv4\\033[0m\\t\\033[36m\\033[04m$MASK\\033[0m\\t\\033[36m\\033[04m$GATE\\033[0m\\n\\n\"\n \n  read -n 1 -p \"Press Enter to reboot...\" INP\n  [[ \"$INP\" != '' ]] &amp;&amp; echo -ne '\\b \\n\\n';\n}\n \nchown root:root $GRUBDIR\/$GRUBFILE\nchmod 444 $GRUBDIR\/$GRUBFILE\n \nsleep 3 &amp;&amp; reboot &gt;\/dev\/null 2&gt;&amp;1<\/code><\/pre>\n<p>&nbsp;<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>\t\t\t\t\t\t&#8230; <\/p>\n<div class=\"read-more navbutton\"><a href=\"http:\/\/www.zhangyijun.com\/?p=126\">\u9605\u8bfb\u66f4\u591a<i class=\"fa fa-angle-double-right\"><\/i><\/a><\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-126","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"http:\/\/www.zhangyijun.com\/index.php?rest_route=\/wp\/v2\/posts\/126","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.zhangyijun.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.zhangyijun.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.zhangyijun.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.zhangyijun.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=126"}],"version-history":[{"count":0,"href":"http:\/\/www.zhangyijun.com\/index.php?rest_route=\/wp\/v2\/posts\/126\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.zhangyijun.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=126"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.zhangyijun.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=126"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.zhangyijun.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=126"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}