{"id":121,"date":"2018-11-30T23:27:35","date_gmt":"2018-11-30T15:27:35","guid":{"rendered":"http:\/\/www.zhangyijun.com\/?p=121"},"modified":"2018-11-30T23:27:35","modified_gmt":"2018-11-30T15:27:35","slug":"echo-offpushd-dp0-title-win32loader-setlocal-enabledelayedexpansion-author-moeclub-org-color-87-cd-windirgetadmin-if-exist-windirgetadmin-del-f-q-windirgetadmin-else-echo-creat","status":"publish","type":"post","link":"http:\/\/www.zhangyijun.com\/?p=121","title":{"rendered":"[ Linux VPS ] Debian\/Ubuntu\/CentOS \u7f51\u7edc\u5b89\u88c5\/\u91cd\u88c5\u7cfb\u7edf\/\u7eaf\u51c0\u5b89\u88c5 \u4e00\u952e\u811a\u672c"},"content":{"rendered":"<p>\t\t\t\thttps:\/\/moeclub.org\/2018\/04\/03\/603\/?v=273<\/p>\n<ul>\n<li style=\"list-style-type: none;\">\n<ul>\n<li><strong>\u80cc\u666f<\/strong>:<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>\u9002\u7528\u4e8e\u7531GRUB\u5f15\u5bfc\u7684CentOS,Ubuntu,Debian\u7cfb\u7edf.<br \/>\n\u4f7f\u7528\u5b98\u65b9\u53d1\u884c\u7248\u53bb\u6389\u6a21\u677f\u9884\u88c5\u7684\u8f6f\u4ef6.<br \/>\n\u540c\u65f6\u4e5f\u53ef\u4ee5\u89e3\u51b3\u5185\u6838\u7248\u672c\u4e0e\u8f6f\u4ef6\u4e0d\u517c\u5bb9\u7684\u95ee\u9898\u3002<br \/>\n\u53ea\u8981\u6709root\u6743\u9650,\u8fd8\u60a8\u4e00\u4e2a\u7eaf\u51c0\u7684\u7cfb\u7edf\u3002<\/p>\n<ul>\n<li style=\"list-style-type: none;\">\n<ul>\n<li><strong>\u76f8\u5173\u6587\u7ae0<\/strong>:<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p><strong><a href=\"https:\/\/moeclub.org\/2017\/03\/25\/82\/\"><u>[ Linux VPS ] Debian(Ubuntu)\u7f51\u7edc\u5b89\u88c5\/\u91cd\u88c5\u7cfb\u7edf\u4e00\u952e\u811a\u672c<\/u><\/a><\/strong><br \/>\n<strong><a href=\"https:\/\/moeclub.org\/2018\/03\/26\/597\/\"><u>[ Linux VPS ] CentOS \u7f51\u7edc\u5b89\u88c5\/\u91cd\u88c5\u7cfb\u7edf\u4e00\u952e\u811a\u672c \u7eaf\u51c0\u5b89\u88c5<\/u><\/a><\/strong><br \/>\n<strong><a href=\"https:\/\/moeclub.org\/2017\/11\/19\/483\/\"><u>[ Linux Shell ] \u901a\u7528\u65e0\u9650\u5236\u5728 Linux VPS \u4e0a\u4e00\u952e\u5168\u81ea\u52a8 dd \u5b89\u88c5 Windows<\/u><\/a><\/strong><\/p>\n<hr \/>\n<ul>\n<li style=\"list-style-type: none;\">\n<ul>\n<li><strong>\u6ce8\u610f<\/strong>:\n<ul>\n<li>\u5168\u81ea\u52a8\u5b89\u88c5\u9ed8\u8ba4root\u5bc6\u7801:<code>Vicer<\/code>,\u5b89\u88c5\u5b8c\u6210\u540e\u8bf7\u7acb\u5373\u66f4\u6539\u5bc6\u7801.<\/li>\n<li>\u80fd\u591f\u5168\u81ea\u52a8\u91cd\u88c5Debian\/Ubuntu\/CentOS\u7b49\u7cfb\u7edf.<\/li>\n<li>\u540c\u65f6\u63d0\u4f9bdd\u5b89\u88c5\u955c\u50cf\u529f\u80fd,\u4f8b\u5982:\u00a0<a href=\"https:\/\/moeclub.org\/2017\/11\/19\/483\/\">\u5168\u81ea\u52a8\u65e0\u6551\u63f4dd\u5b89\u88c5windows\u7cfb\u7edf<\/a><\/li>\n<li>\u5168\u81ea\u52a8\u5b89\u88c5CentOS\u65f6\u9ed8\u8ba4\u63d0\u4f9bVNC\u529f\u80fd,\u53ef\u4f7f\u7528<a href=\"https:\/\/moeclub.org\/go-vncviewer\" target=\"_blank\" rel=\"noopener noreferrer\"><strong><u>VNC Viewer<\/u><\/strong><\/a>\u67e5\u770b\u8fdb\u5ea6,<br \/>\n<strong>VNC\u7aef\u53e3<\/strong>\u4e3a<strong>1<\/strong>\u6216\u8005<strong>5901<\/strong>,\u53ef\u81ea\u884c\u5c1d\u8bd5\u8fde\u63a5.(\u6210\u529f\u540eVNC\u529f\u80fd\u4f1a\u6d88\u5931.)<\/li>\n<li>\u76ee\u524dCentOS\u7cfb\u7edf\u53ea\u652f\u6301\u4efb\u610f\u7248\u672c\u91cd\u88c5\u4e3a\u00a0<strong>CentOS 6.x<\/strong>\u00a0\u53ca\u4ee5\u4e0b\u7248\u672c.<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p><strong>\u7279\u522b\u6ce8\u610f:<em><code>OpenVZ<\/code>\u6784\u67b6\u4e0d\u9002\u7528.<\/em><\/strong><\/p>\n<ul>\n<li style=\"list-style-type: none;\">\n<ul>\n<li><strong>\u66f4\u65b0<\/strong>:\n<ul>\n<li>[2018.11.12]<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>\u4fee\u590d\u4e86\u4e00\u5199\u9519\u8bef\u903b\u8f91.<\/p>\n<ul>\n<li style=\"list-style-type: none;\">\n<ul>\n<li style=\"list-style-type: none;\">\n<ul>\n<li>[2018.10.31]<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>\u589e\u52a0 \u2013loader \u53c2\u6570.(\u7528\u4e8e\u5b9a\u5236\u955c\u50cf)<\/p>\n<ul>\n<li style=\"list-style-type: none;\">\n<ul>\n<li style=\"list-style-type: none;\">\n<ul>\n<li>[2018.08.10]<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>\u4fee\u590d\u4e00\u4e9bBug.<br \/>\n\u589e\u52a0 -i\u00a0\u53c2\u6570.(\u7528\u4e8e\u6307\u5b9a\u7f51\u5361)<\/p>\n<ul>\n<li style=\"list-style-type: none;\">\n<ul>\n<li style=\"list-style-type: none;\">\n<ul>\n<li>[2018.06.09]<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>\u652f\u6301\u81ea\u5b9a\u4e49\u8fdc\u7a0b\u684c\u9762\u7aef\u53e3\u5e76\u6253\u5f00\u76f8\u5173\u9632\u706b\u5899\u7aef\u53e3(\u9ed8\u8ba4\u4e3a3389).<br \/>\n\u81ea\u52a8\u6269\u5c55\u7cfb\u7edf\u76d8\u7a7a\u95f4\u4e3a\u6574\u4e2a\u786c\u76d8.<br \/>\n\u589e\u52a0 -rdp\u00a0\u53c2\u6570.(\u7528\u4e8e\u66f4\u6362RDP\u7aef\u53e3,\u5e76\u5f3a\u5236\u6253\u5f00\u8be5\u7aef\u53e3\u9632\u706b\u5899)<\/p>\n<ul>\n<li style=\"list-style-type: none;\">\n<ul>\n<li style=\"list-style-type: none;\">\n<ul>\n<li>[2018.04.17]<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>\u4fee\u590d\u5bf9grub.conf\u6293\u53d6\u8bc6\u522b\u7684\u95ee\u9898.<\/p>\n<ul>\n<li style=\"list-style-type: none;\">\n<ul>\n<li style=\"list-style-type: none;\">\n<ul>\n<li>[2018.04.06]<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>\u4f18\u5316\u6b63\u5219\u8868\u8fbe\u5f0f.<br \/>\n\u4e22\u5f03\u5bf9grep -P\u7684\u4f9d\u8d56.<\/p>\n<ul>\n<li style=\"list-style-type: none;\">\n<ul>\n<li style=\"list-style-type: none;\">\n<ul>\n<li>[2018.04.03]<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>\u5408\u5e76Debian\/Ubuntu\/CentOS\/dd\u5b89\u88c5\u955c\u50cf\u529f\u80fd.<br \/>\n\u4f7f\u7528\u6700\u5c11\u4f9d\u8d56\u539f\u5219.<br \/>\n\u4f18\u5316\u90e8\u5206\u6d41\u7a0b.<br \/>\n\u4fee\u590d\u4e00\u4e9b\u5df2\u77e5BUG.<\/p>\n<hr \/>\n<ul>\n<li><strong>\u4f9d\u8d56\u5305<\/strong>:<\/li>\n<\/ul>\n<pre class=\"lang:default decode:true \">#\u4e8c\u8fdb\u5236\u6587\u4ef6    Debian\/Ubuntu    RedHat\/CentOS\niconv         [libc-bin]       [glibc-common]\nxz            [xz-utils]       [xz]\nawk           [gawk]           [gawk]\nsed           [sed]            [sed]\nfile          [file]           [file]\ngrep          [grep]           [grep]\nopenssl       [openssl]        [openssl]\ncpio          [cpio]           [cpio]\ngzip          [gzip]           [gzip]\ncat,cut..     [coreutils]      [coreutils]<\/pre>\n<ul>\n<li><strong>\u786e\u4fdd\u5b89\u88c5\u4e86\u6240\u9700\u8f6f\u4ef6<\/strong>:<\/li>\n<\/ul>\n<pre class=\"lang:default decode:true \">#Debian\/Ubuntu:\napt-get install -y xz-utils openssl gawk file\n \n#RedHat\/CentOS:\nyum install -y xz openssl gawk file<\/pre>\n<ul>\n<li><strong>\u5982\u679c\u51fa\u73b0\u4e86\u9519\u8bef,\u8bf7\u8fd0\u884c<\/strong>:<\/li>\n<\/ul>\n<pre class=\"lang:default decode:true \">#Debian\/Ubuntu:\napt-get update\n \n#RedHat\/CentOS:\nyum update<\/pre>\n<p>&nbsp;<\/p>\n<ul>\n<li><strong>\u5feb\u901f\u4f7f\u7528\u793a\u4f8b<\/strong>:<\/li>\n<\/ul>\n<pre class=\"lang:default decode:true \">bash &lt;(wget --no-check-certificate -qO- 'https:\/\/moeclub.org\/attachment\/LinuxShell\/InstallNET.sh') -d 8 -v 64 -a<\/pre>\n<ul>\n<li><strong>\u4e0b\u8f7d\u53ca\u8bf4\u660e<\/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; chmod a+x InstallNET.sh<\/code><\/pre>\n<pre class=\"pure-highlightjs\"><code class=\"\" null=\"\">Usage:\n        bash InstallNET.sh      -d\/--debian [dist-name]\n                                -u\/--ubuntu [dist-name]\n                                -c\/--centos [dist-version]\n                                -v\/--ver [32\/i386|64\/amd64]\n                                --ip-addr\/--ip-gate\/--ip-mask\n                                -apt\/-yum\/--mirror\n                                -dd\/--image\n                                -a\/-m\n \n# dist-name: \u53d1\u884c\u7248\u672c\u4ee3\u53f7\n# dist-version: \u53d1\u884c\u7248\u672c\u53f7\n# -apt\/-yum\/--mirror : \u4f7f\u7528\u5b9a\u4e49\u955c\u50cf\n# -a\/-m : \u8be2\u95ee\u662f\u5426\u80fd\u8fdb\u5165VNC\u81ea\u884c\u64cd\u4f5c. -a \u4e3a\u4e0d\u63d0\u793a(\u4e00\u822c\u7528\u4e8e\u5168\u81ea\u52a8\u5b89\u88c5), -m \u4e3a\u63d0\u793a.<\/code><\/pre>\n<ul>\n<li><strong>\u4f7f\u7528\u793a\u4f8b<\/strong>:<\/li>\n<\/ul>\n<pre class=\"pure-highlightjs\"><code class=\"\" null=\"\">\u4f7f\u7528\u9ed8\u8ba4\u955c\u50cf\u5168\u81ea\u52a8\u5b89\u88c5\nbash InstallNET.sh -d 8 -v 64 -a\n \n#\u4f7f\u7528\u81ea\u5b9a\u4e49\u955c\u50cf\u5168\u81ea\u52a8\u5b89\u88c5\nbash InstallNET.sh -c 6.9 -v 64 -a --mirror 'http:\/\/mirror.centos.org\/centos'\n \n \n# \u4ee5\u4e0b\u793a\u4f8b\u4e2d,\u5c06X.X.X.X\u66ff\u6362\u4e3a\u81ea\u5df1\u7684\u7f51\u7edc\u53c2\u6570.\n# --ip-addr :IP Address\/IP\u5730\u5740\n# --ip-gate :Gateway   \/\u7f51\u5173\n# --ip-mask :Netmask   \/\u5b50\u7f51\u63a9\u7801\n \n#\u4f7f\u7528\u81ea\u5b9a\u4e49\u955c\u50cf\u81ea\u5b9a\u4e49\u7f51\u7edc\u53c2\u6570\u5168\u81ea\u52a8\u5b89\u88c5\n#bash InstallNET.sh -u 16.04 -v 64 -a --ip-addr x.x.x.x --ip-gate x.x.x.x --ip-mask x.x.x.x --mirror 'http:\/\/archive.ubuntu.com\/ubuntu'\n \n#\u4f7f\u7528\u81ea\u5b9a\u4e49\u7f51\u7edc\u53c2\u6570\u5168\u81ea\u52a8dd\u65b9\u5f0f\u5b89\u88c5\n#bash InstallNET.sh --ip-addr x.x.x.x --ip-gate x.x.x.x --ip-mask x.x.x.x -dd 'https:\/\/moeclub.org\/get-win7embx86-auto'\n \n#\u4f7f\u7528\u81ea\u5b9a\u4e49\u7f51\u7edc\u53c2\u6570\u5168\u81ea\u52a8dd\u65b9\u5f0f\u5b89\u88c5\u5b58\u50a8\u5728\u8c37\u6b4c\u7f51\u76d8\u4e2d\u7684\u955c\u50cf(\u8c03\u7528\u6587\u4ef6ID\u7684\u65b9\u5f0f)\n#bash InstallNET.sh --ip-addr x.x.x.x --ip-gate x.x.x.x --ip-mask x.x.x.x -dd \"$(echo \"1cqVl2wSGx92UTdhOxU9pW3wJgmvZMT_J\" |xargs -n1 bash &lt;(wget --no-check-certificate -qO- 'https:\/\/moeclub.org\/get-gdlink'))\"\n \n#\u4f7f\u7528\u81ea\u5b9a\u4e49\u7f51\u7edc\u53c2\u6570\u5168\u81ea\u52a8dd\u65b9\u5f0f\u5b89\u88c5\u5b58\u50a8\u5728\u8c37\u6b4c\u7f51\u76d8\u4e2d\u7684\u955c\u50cf\n#bash InstallNET.sh --ip-addr x.x.x.x --ip-gate x.x.x.x --ip-mask x.x.x.x -dd \"$(echo \"https:\/\/drive.google.com\/open?id=1cqVl2wSGx92UTdhOxU9pW3wJgmvZMT_J\" |xargs -n1 bash &lt;(wget --no-check-certificate -qO- 'https:\/\/moeclub.org\/get-gdlink'))\"<\/code><\/pre>\n<ul>\n<li><strong>\u4e00\u4e9b\u53ef\u7528\u955c\u50cf\u5730\u5740<\/strong>:<\/li>\n<\/ul>\n<pre class=\"pure-highlightjs\"><code class=\"\" null=\"\"># \u63a8\u8350\u4f7f\u7528\u5e26\u6709 \/GoogleDrive\/&lt;File_ID&gt; \u94fe\u63a5, \u901f\u5ea6\u66f4\u5feb.\n# \u5f53\u7136\u4e5f\u53ef\u4ee5\u4f7f\u7528\u81ea\u5df1GoogleDrive\u4e2d\u50a8\u5b58\u7684\u955c\u50cf,\u4f7f\u7528\u65b9\u5f0f:\n  https:\/\/image.moeclub.org\/GoogleDrive\/&lt;File_ID&gt;\n \n# win7emb_x86.tar.gz:\n  https:\/\/image.moeclub.org\/GoogleDrive\/1srhylymTjYS-Ky8uLw4R6LCWfAo1F3s7 \n  https:\/\/image.moeclub.org\/win7emb_x86.tar.gz\n \n# win8.1emb_x64.tar.gz:\n  https:\/\/image.moeclub.org\/GoogleDrive\/1cqVl2wSGx92UTdhOxU9pW3wJgmvZMT_J\n  https:\/\/image.moeclub.org\/win8.1emb_x64.tar.gz<\/code><\/pre>\n<p>&nbsp;<\/p>\n<ul>\n<li style=\"list-style-type: none\">\n<ul>\n<li><strong>\u4e00\u4e9b\u63d0\u793a<\/strong>:\n<ul>\n<li><strong>\u7279\u522b\u6ce8\u610f<\/strong>:<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p><a href=\"https:\/\/moeclub.org\/\" target=\"_blank\" rel=\"noopener noreferrer\">\u840c\u5496<\/a>\u63d0\u4f9b\u7684dd\u5b89\u88c5\u955c\u50cf<br \/>\n\u8fdc\u7a0b\u767b\u9646\u8d26\u53f7\u4e3a:\u00a0<strong><em>Administrator<\/em><\/strong><br \/>\n\u8fdc\u7a0b\u767b\u9646\u5bc6\u7801\u4e3a:\u00a0<strong><em>Vicer<\/em><\/strong><br \/>\n\u4ec5\u4fee\u6539\u4e86\u4e3b\u673a\u540d,\u53ef\u653e\u5fc3\u4f7f\u7528.(\u5efa\u8bae\u81ea\u5df1\u5236\u4f5c.)<\/p>\n<ul>\n<li style=\"list-style-type: none\">\n<ul>\n<li style=\"list-style-type: none\">\n<ul>\n<li><strong>\u5728dd\u5b89\u88c5\u7cfb\u7edf\u955c\u50cf\u65f6<\/strong>:<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>\u5728\u4f60\u7684\u673a\u5668\u4e0a\u5168\u65b0\u5b89\u88c5,\u5982\u679c\u4f60\u6709VNC,\u53ef\u4ee5\u770b\u5230\u5168\u90e8\u8fc7\u7a0b.<br \/>\n\u5728dd\u5b89\u88c5\u955c\u50cf\u7684\u8fc7\u7a0b\u4e2d,\u4e0d\u4f1a\u8d70\u8fdb\u5ea6\u6761(\u8fdb\u5ea6\u6761\u4e00\u76f4\u663e\u793a\u4e3a<strong>0%<\/strong>).\u5b8c\u6210\u540e\u5c06\u4f1a\u81ea\u52a8\u91cd\u542f.<br \/>\n\u5206\u533a\u754c\u9762\u6807\u9898\u4e00\u822c\u663e\u793a\u4e3a: \u201c<strong>Starting up the partitioner<\/strong>\u201c<br \/>\n<strong>\u4f7f\u7528\u8c37\u6b4c\u7f51\u76d8\u4e2d\u50a8\u5b58\u7684\u955c\u50cf:\u00a0<u><a href=\"https:\/\/moeclub.org\/2018\/04\/01\/600\/\" target=\"_blank\" rel=\"noopener noreferrer\">[\u65e0\u9650\u5236\u5927\u5c0f] \u83b7\u53d6\u8c37\u6b4c\u7f51\u76d8\u6587\u4ef6\u4e34\u65f6\u76f4\u63a5\u4e0b\u8f7d\u94fe\u63a5<\/a><\/u><\/strong><\/p>\n<ul>\n<li style=\"list-style-type: none\">\n<ul>\n<li style=\"list-style-type: none\">\n<ul>\n<li><strong>\u5728\u5168\u81ea\u52a8\u5b89\u88c5CentOS\u65f6<\/strong>:<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>\u5982\u679c\u770b\u5230 \u201c<strong>Starting graphical installation<\/strong>\u201d \u6216\u8005\u7c7b\u4f3c\u8868\u8fbe,\u5219\u8868\u793a\u6b63\u5728\u5b89\u88c5.<br \/>\n\u6b63\u5e38\u60c5\u51b5\u4e0b\u53ea\u9700\u8981\u8010\u5fc3\u7b49\u5f85\u5b89\u88c5\u5b8c\u6210\u5373\u53ef.<br \/>\n\u5982\u679c\u9700\u8981\u67e5\u770b\u8fdb\u5ea6,\u4f7f\u7528<strong>VNC Viewer<\/strong>(\u6216\u8005\u5176\u4ed6VNC\u8fde\u63a5\u5de5\u5177)<br \/>\n\u8fde\u63a5\u63d0\u793a\u4e2d\u7684<strong>IP\u5730\u5740:\u7aef\u53e3<\/strong>\u8fdb\u884c\u8fde\u63a5.(\u7aef\u53e3\u4e00\u822c\u4e3a<strong>1<\/strong>\u6216\u8005<strong>5901<\/strong>)<\/p>\n<ul>\n<li style=\"list-style-type: none;\"><\/li>\n<li><strong>\u9884\u89c8<\/strong>:<\/li>\n<\/ul>\n<pre class=\"pure-highlightjs\"><code class=\"\" null=\"\">#!\/bin\/bash\n \n## It can reinstall Debian, Ubuntu, CentOS system with network.\n## Suitable for using by GRUB.\n## Default root password: Vicer\n## Blog: https:\/\/moeclub.org\n## Written By Vicer\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 setRDP='0'\nexport isMirror='0'\nexport FindDists='0'\nexport loaderMode='0'\nexport SpikCheckDIST='0'\nexport UNKNOWHW='0'\nexport UNVER='6.4'\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    -c|--centos)\n      shift\n      linuxdists='centos'\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    -i|--interface)\n      shift\n      interface=\"$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    --loader)\n      shift\n      loaderMode='1'\n      ;;\n    --prefer)\n      shift\n      tmpPrefer=\"$1\"\n      shift\n      ;;\n    -a|--auto)\n      shift\n      tmpINS='auto'\n      ;;\n    -m|--manual)\n      shift\n      tmpINS='manual'\n      ;;\n    -apt|-yum|--mirror)\n      shift\n      isMirror='1'\n      tmpMirror=\"$1\"\n      shift\n      ;;\n    -rdp)\n      shift\n      setRDP='1'\n      WinRemote=\"$1\"\n      shift\n      ;;\n    -ssl)\n      shift\n      tmpSSL=\"$1\"\n      shift\n      ;;\n    --firmware)\n      shift\n      tmpFW='1'\n      ;;\n    *)\n      if [[ \"$1\" != 'error' ]]; then echo -ne \"\\nInvaild option: '$1'\\n\\n\"; fi\n      echo -ne \" Usage:\\n\\tbash DebianNET.sh\\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-c\/--centos [\\033[33m\\033[04mdists-verison\\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\/-yum\/--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 \"[\\033[32mok\\033[0m]\\t\";\n      else\n        FullDependence='1';\n        echo -en \"[\\033[31mNot Install\\033[0m]\";\n      fi\n      echo -en \"\\t$BIN_DEP\\n\";\n    fi\n  done\nif [ \"$FullDependence\" == '1' ]; then\n  echo -ne \"\\n\\033[31mError! \\033[0mPlease use '\\033[33mapt-get\\033[0m' or '\\033[33myum\\033[0m' install it.\\n\\n\\n\"\n  exit 1;\nfi\n}\n \nif [[ -z \"$linuxdists\" ]]; then\n  linuxdists='debian';\nfi\n \nclear &amp;&amp; echo -e \"\\n\\033[36m# Check Dependence\\033[0m\\n\"\n \nif [[ \"$ddMode\" == '1' ]]; then\n  CheckDependence iconv;\n  linuxdists='debian';\n  tmpDIST='jessie';\n  tmpVER='amd64';\n  tmpINS='auto';\nfi\n \nif [[ \"$linuxdists\" == 'debian' ]] || [[ \"$linuxdists\" == 'ubuntu' ]]; then\n  CheckDependence wget,awk,grep,sed,cut,cat,cpio,gzip,find,dirname,basename;\nelif [[ \"$linuxdists\" == 'centos' ]]; then\n  CheckDependence wget,awk,grep,sed,cut,cat,cpio,gzip,find,dirname,basename,file,xz;\nfi\n \nif [[ -n \"$tmpWORD\" ]]; then\n  CheckDependence openssl;\nfi\n \nif [[ \"$loaderMode\" == \"0\" ]]; then\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;\nelse\n  tmpINS='auto'\nfi\n \nif [[ \"$isMirror\" == '1' ]]; then\n  if [[ -n \"$tmpMirror\" ]]; then\n    TMPMirrorHost=\"$(echo -n \"$tmpMirror\" |grep -Eo '.*\\.(\\w+)')\";\n    echo \"$TMPMirrorHost\" |grep -q ':\/\/';\n    if [[ $? == '0' ]]; then\n      MirrorHost=\"$(echo \"$TMPMirrorHost\" |awk -F':\/\/' '{print $2}')\";\n    else\n      echo -en \"\\n\\033[31mInvaild Mirror! \\033[0m\\n\";\n      [[ \"$linuxdists\" == 'debian' ]] &amp;&amp; echo -en \"\\033[33mexample:\\033[0m http:\/\/deb.debian.org\/debian\\n\\n\";\n      [[ \"$linuxdists\" == 'ubuntu' ]] &amp;&amp; echo -en \"\\033[33mexample:\\033[0m http:\/\/archive.ubuntu.com\/ubuntu\\n\\n\";\n      [[ \"$linuxdists\" == 'centos' ]] &amp;&amp; echo -en \"\\033[33mexample:\\033[0m http:\/\/mirror.centos.org\/centos\\n\\n\";\n      exit 1\n    fi\n    if [[ -n \"$MirrorHost\" ]]; then\n      MirrorFolder=\"$(echo -n \"$tmpMirror\" |awk -F''${MirrorHost}'' '{print $2}' |sed 's\/\\\/$\/\/g')\";\n      if [[ -z \"$MirrorFolder\" ]]; then\n        [[ \"$linuxdists\" == 'debian' ]] &amp;&amp; MirrorFolder='\/debian';\n        [[ \"$linuxdists\" == 'ubuntu' ]] &amp;&amp; MirrorFolder='\/ubuntu';\n        [[ \"$linuxdists\" == 'centos' ]] &amp;&amp; MirrorFolder='\/centos';\n      fi\n      DISTMirror=\"${MirrorHost}${MirrorFolder}\";\n    fi\n  fi\nfi\n \nif [[ -z \"$DISTMirror\" ]]; then\n  [[ \"$linuxdists\" == 'debian' ]] &amp;&amp; MirrorHost='deb.debian.org' &amp;&amp; MirrorFolder='\/debian' &amp;&amp; DISTMirror=\"${MirrorHost}${MirrorFolder}\";\n  [[ \"$linuxdists\" == 'ubuntu' ]] &amp;&amp; MirrorHost='archive.ubuntu.com' &amp;&amp; MirrorFolder='\/ubuntu' &amp;&amp; DISTMirror=\"${MirrorHost}${MirrorFolder}\";\n  [[ \"$linuxdists\" == 'centos' ]] &amp;&amp; DISTMirror='vault.centos.org';\nfi\n \nif [[ -n \"$tmpVER\" ]]; then\n  tmpVER=\"$(echo \"$tmpVER\" |sed -r 's\/(.*)\/\\L\\1\/')\";\n  if  [[ \"$tmpVER\" == '32' ]] || [[ \"$tmpVER\" == 'i386' ]] || [[ \"$tmpVER\" == 'x86' ]]; then\n    VER='i386';\n  fi\n  if  [[ \"$tmpVER\" == '64' ]] || [[ \"$tmpVER\" == 'amd64' ]] || [[ \"$tmpVER\" == 'x86_64' ]] || [[ \"$tmpVER\" == 'x64' ]]; then\n    if [[ \"$linuxdists\" == 'debian' ]] || [[ \"$linuxdists\" == 'ubuntu' ]]; then\n      VER='amd64';\n    elif [[ \"$linuxdists\" == 'centos' ]]; then\n      VER='x86_64';\n    fi\n  fi\nfi\n \nif [[ -z \"$VER\" ]]; then\n  VER='i386';\nfi\n \nif [[ -n \"$tmpPrefer\" ]]; then\n  PreferOption=\"$(echo \"$tmpPrefer\" |sed 's\/[[:space:]]*\/\/g')\"\nfi\n \nif [[ -z \"$PreferOption\" ]]; then\n  PreferOption='current';\nfi\n \nif [[ -z \"$tmpDIST\" ]]; then\n  [[ \"$linuxdists\" == 'debian' ]] &amp;&amp; DIST='jessie';\n  [[ \"$linuxdists\" == 'ubuntu' ]] &amp;&amp; DIST='xenial';\n  [[ \"$linuxdists\" == 'centos' ]] &amp;&amp; DIST='6.8';\nfi\n \nif [[ -z \"$DIST\" ]]; then\n  if [[ \"$linuxdists\" == 'debian' ]]; then\n    SpikCheckDIST='0'\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  fi\n  if [[ \"$linuxdists\" == 'ubuntu' ]]; then\n    SpikCheckDIST='0'\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')\";\n      [[ -n $isDigital ]] &amp;&amp; {\n        [[ \"$isDigital\" == '12.04' ]] &amp;&amp; DIST='precise';\n        [[ \"$isDigital\" == '14.04' ]] &amp;&amp; DIST='trusty';\n        [[ \"$isDigital\" == '16.04' ]] &amp;&amp; DIST='xenial';\n        [[ \"$isDigital\" == '18.04' ]] &amp;&amp; DIST='bionic';\n      }\n    }\n  fi\n  if [[ \"$linuxdists\" == 'centos' ]]; then\n    SpikCheckDIST='1'\n    DISTCheck=\"$(echo \"$tmpDIST\" |grep -o '[\\.0-9]\\{1,\\}')\";\n    ListDIST=\"$(wget --no-check-certificate -qO- \"http:\/\/$DISTMirror\/dir_sizes\" |cut -f2 |grep '^[0-9]')\"\n    DIST=\"$(echo \"$ListDIST\" |grep \"^$DISTCheck\" |head -n1)\"\n    [[ -z \"$DIST\" ]] &amp;&amp; {\n      echo -ne '\\nThe dists version not found in this mirror, Please check it! \\n\\n'\n      bash $0 error;\n      exit 1;\n    }\n    wget --no-check-certificate -qO- \"http:\/\/$DISTMirror\/$DIST\/os\/$VER\/.treeinfo\" |grep -q 'general';\n    [[ $? != '0' ]] &amp;&amp; {\n      wget --no-check-certificate -qO- \"http:\/\/$DISTMirror\/centos\/$DIST\/os\/$VER\/.treeinfo\" |grep -q 'general';\n      [[ $? == '0' ]] &amp;&amp; {\n        DISTMirror=\"${DISTMirror}\/${linuxdists}\"\n      } || {\n        echo -ne \"\\nThe version not found in this mirror, Please change mirror try again! \\n\\n\";\n        exit 1;\n      }\n    }\n \n  fi\nfi\n \nif [[ \"$SpikCheckDIST\" == '0' ]]; then\n  DistsList=\"$(wget --no-check-certificate -qO- \"http:\/\/$DISTMirror\/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')\";\n  for 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  }\nfi\n \n[[ \"$ddMode\" == '1' ]] &amp;&amp; {\n  export SSL_SUPPORT='https:\/\/moeclub.org\/get-wget_udeb_amd64';\n  if [[ -n \"$tmpURL\" ]]; then\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  else\n    echo 'Please input vaild image URL! ';\n    exit 1;\n  fi\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=\"$(openssl passwd -1 \"$tmpWORD\")\";\n[[ -z \"$myPASSWORD\" ]] &amp;&amp; myPASSWORD='$1$0shYGfBd$8v189JOozDO1jPqPO645e1';\n[[ -n \"$tmpFW\" ]] &amp;&amp; INCFW=\"$tmpFW\";\n[[ -z \"$INCFW\" ]] &amp;&amp; INCFW='0';\n \nif [[ -n \"$interface\" ]]; then\n  IFETH=\"$interface\"\nelse\n  if [[ \"$linuxdists\" == 'centos' ]]; then\n    IFETH=\"link\"\n  else\n    IFETH=\"auto\"\n  fi\nfi\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 \"$inVNCtmp\" ]] &amp;&amp; inVNC=\"$tmpinVNC\"\n  }\n  [ \"$inVNC\" == 'y' -o \"$inVNC\" == 'Y' ] &amp;&amp; inVNC='y';\n  [ \"$inVNC\" == 'n' -o \"$inVNC\" == '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[[ \"$linuxdists\" == 'centos' ]] &amp;&amp; LinuxName='CentOS';\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 \nif [[ \"$linuxdists\" == 'centos' ]]; then\n  if [[ \"$DIST\" != \"$UNVER\" ]]; then\n    awk 'BEGIN{print '${UNVER}'-'${DIST}'}' |grep -q '^-'\n    if [ $? != '0' ]; then\n      UNKNOWHW='1';\n      echo -en \"\\033[33mThe version lower then \\033[31m$UNVER\\033[33m may not support in auto mode! \\033[0m\\n\";\n      if [[ \"$inVNC\" == 'n' ]]; then\n        echo -en \"\\033[35mYou can connect VNC with \\033[32mPublic IP\\033[35m and port \\033[32m1\\033[35m\/\\033[32m5901\\033[35m in vnc viewer.\\033[0m\\n\"\n        read -n 1 -p \"Press Enter to continue...\" INP\n        [[ \"$INP\" != '' ]] &amp;&amp; echo -ne '\\b \\n\\n';\n      fi\n    fi\n    awk 'BEGIN{print '${UNVER}'-'${DIST}'+0.59}' |grep -q '^-'\n    if [ $? == '0' ]; then\n      echo -en \"\\n\\033[31mThe version higher then \\033[33m6.9 \\033[31mis not support in current! \\033[0m\\n\\n\"\n      exit 1;\n    fi\n  fi\nfi\n \necho -e \"\\n[\\033[33m$LinuxName\\033[0m] [\\033[33m$DIST\\033[0m] [\\033[33m$VER\\033[0m] Downloading...\"\n \n[[ -z \"$DISTMirror\" ]] &amp;&amp; echo -ne \"\\033[31mError! \\033[0mInvaild mirror! \\n\" &amp;&amp; exit 1\n \nif [[ \"$linuxdists\" == 'debian' ]] || [[ \"$linuxdists\" == 'ubuntu' ]]; then\nwget --no-check-certificate -qO '\/boot\/initrd.img' \"http:\/\/$DISTMirror\/dists\/$DIST\/main\/installer-$VER\/$PreferOption\/images\/netboot\/$linuxdists-installer\/$VER\/initrd.gz\"\n[[ $? -ne '0' ]] &amp;&amp; echo -ne \"\\033[31mError! \\033[0mDownload 'initrd.img' for \\033[33m$linuxdists\\033[0m failed! \\n\" &amp;&amp; exit 1\nwget --no-check-certificate -qO '\/boot\/vmlinuz' \"http:\/\/$DISTMirror\/dists\/$DIST\/main\/installer-$VER\/$PreferOption\/images\/netboot\/$linuxdists-installer\/$VER\/linux\"\n[[ $? -ne '0' ]] &amp;&amp; echo -ne \"\\033[31mError! \\033[0mDownload 'vmlinuz' for \\033[33m$linuxdists\\033[0m failed! \\n\" &amp;&amp; exit 1\nelif [[ \"$linuxdists\" == 'centos' ]]; then\nwget --no-check-certificate -qO '\/boot\/initrd.img' \"http:\/\/$DISTMirror\/$DIST\/os\/$VER\/isolinux\/initrd.img\"\n[[ $? -ne '0' ]] &amp;&amp; echo -ne \"\\033[31mError! \\033[0mDownload 'initrd.img' for \\033[33m$linuxdists\\033[0m failed! \\n\" &amp;&amp; exit 1\nwget --no-check-certificate -qO '\/boot\/vmlinuz' \"http:\/\/$DISTMirror\/$DIST\/os\/$VER\/isolinux\/vmlinuz\"\n[[ $? -ne '0' ]] &amp;&amp; echo -ne \"\\033[31mError! \\033[0mDownload 'vmlinuz' for \\033[33m$linuxdists\\033[0m failed! \\n\" &amp;&amp; exit 1\nfi\nif [[ \"$linuxdists\" == 'debian' ]]; then\n  if [[ \"$INCFW\" == '1' ]]; then\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' for \\033[33m$linuxdists\\033[0m failed! \\n\" &amp;&amp; exit 1\n  fi\n  if [[ \"$ddMode\" == '1' ]]; then\n    vKernel_udeb=$(wget --no-check-certificate -qO- \"http:\/\/$DISTMirror\/dists\/$DIST\/main\/installer-$VER\/$PreferOption\/images\/udeb.list\" |grep '^acpi-modules' |head -n1 |grep -o '[0-9]\\{1,2\\}.[0-9]\\{1,2\\}.[0-9]\\{1,2\\}-[0-9]\\{1,2\\}' |head -n1)\n    [[ -z \"vKernel_udeb\" ]] &amp;&amp; vKernel_udeb=\"3.16.0-4\"\n  fi\nfi\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 \nif [[ \"$loaderMode\" == \"0\" ]]; then\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;\n  mv -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;\nelse\n  GRUBOLD='2'\nfi\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 -om 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  INSERTGRUB=\"$(awk '\/menuentry \/{print NR}' $GRUBDIR\/$GRUBFILE|head -n 1)\"\n}\n \n[[ \"$GRUBOLD\" == '1' ]] &amp;&amp; {\n  CFG0=\"$(awk '\/title[\\ ]|title[\\t]\/{print NR}' $GRUBDIR\/$GRUBFILE|head -n 1)\";\n  CFG1=\"$(awk '\/title[\\ ]|title[\\t]\/{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-1]\"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  INSERTGRUB=\"$(awk '\/title[\\ ]|title[\\t]\/{print NR}' $GRUBDIR\/$GRUBFILE|head -n 1)\"\n}\n \nif [[ \"$loaderMode\" == \"0\" ]]; then\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 \nif [[ \"$linuxdists\" == 'debian' ]] || [[ \"$linuxdists\" == 'ubuntu' ]]; then\n  BOOT_OPTION=\"auto=true hostname=$linuxdists domain= -- quiet\"\nelif [[ \"$linuxdists\" == 'centos' ]]; then\n  BOOT_OPTION=\"ks=file:\/\/ks.cfg ksdevice=$IFETH\"\nfi\n \n[[ \"$Type\" == 'InBoot' ]] &amp;&amp; {\n  sed -i \"\/$LinuxKernel.*\\\/\/c\\\\\\t$LinuxKernel\\\\t\\\/boot\\\/vmlinuz $BOOT_OPTION\" \/tmp\/grub.new;\n  sed -i \"\/$LinuxIMG.*\\\/\/c\\\\\\t$LinuxIMG\\\\t\\\/boot\\\/initrd.img\" \/tmp\/grub.new;\n}\n \n[[ \"$Type\" == 'NoBoot' ]] &amp;&amp; {\n  sed -i \"\/$LinuxKernel.*\\\/\/c\\\\\\t$LinuxKernel\\\\t\\\/vmlinuz $BOOT_OPTION\" \/tmp\/grub.new;\n  sed -i \"\/$LinuxIMG.*\\\/\/c\\\\\\t$LinuxIMG\\\\t\\\/initrd.img\" \/tmp\/grub.new;\n}\n \nsed -i '$a\\\\n' \/tmp\/grub.new;\nfi\n \n[[ \"$inVNC\" == 'n' ]] &amp;&amp; {\nGRUBPATCH='0';\n \nif [[ \"$loaderMode\" == \"0\" ]]; then\n[ -f '\/etc\/network\/interfaces' -o -d '\/etc\/sysconfig\/network-scripts' ] || {\n  echo \"Error, Not found interfaces config.\";\n  exit 1;\n}\n \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;\nfi\n \n[[ -d \/tmp\/boot ]] &amp;&amp; rm -rf \/tmp\/boot;\nmkdir -p \/tmp\/boot;\ncd \/tmp\/boot;\nif [[ \"$linuxdists\" == 'debian' ]] || [[ \"$linuxdists\" == 'ubuntu' ]]; then\n  COMPTYPE=\"gzip\";\nelif [[ \"$linuxdists\" == 'centos' ]]; then\n  COMPTYPE=\"$(file \/boot\/initrd.img |grep -o ':.*compressed data' |cut -d' ' -f2 |sed -r 's\/(.*)\/\\L\\1\/' |head -n1)\"\n  [[ -z \"$COMPTYPE\" ]] &amp;&amp; echo \"Detect compressed type fail.\" &amp;&amp; exit 1;\nfi\nCompDected='0'\nfor ListCOMP in `echo -en 'gzip\\nlzma\\nxz'`\n  do\n    if [[ \"$COMPTYPE\" == \"$ListCOMP\" ]]; then\n      CompDected='1'\n      if [[ \"$COMPTYPE\" == 'gzip' ]]; then\n        NewIMG=\"initrd.img.gz\"\n      else\n        NewIMG=\"initrd.img.$COMPTYPE\"\n      fi\n      mv -f \"\/boot\/initrd.img\" \"\/tmp\/$NewIMG\"\n      break;\n    fi\n  done\n[[ \"$CompDected\" != '1' ]] &amp;&amp; echo \"Detect compressed type not support.\" &amp;&amp; exit 1;\n[[ \"$COMPTYPE\" == 'lzma' ]] &amp;&amp; UNCOMP='xz --format=lzma --decompress';\n[[ \"$COMPTYPE\" == 'xz' ]] &amp;&amp; UNCOMP='xz --decompress';\n[[ \"$COMPTYPE\" == 'gzip' ]] &amp;&amp; UNCOMP='gzip -d';\n \n$UNCOMP &lt; \/tmp\/$NewIMG | cpio --extract --verbose --make-directories --no-absolute-filenames &gt;&gt;\/dev\/null 2&gt;&amp;1\n \nif [[ \"$linuxdists\" == 'debian' ]] || [[ \"$linuxdists\" == 'ubuntu' ]]; then\ncat &gt;\/tmp\/boot\/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 $IFETH\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 $MirrorHost\nd-i mirror\/http\/directory string $MirrorFolder\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-crypted 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-${vKernel_udeb}-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[[ \"$loaderMode\" != \"0\" ]] &amp;&amp; AutoNet='1'\n \n[[ \"$setNet\" == '0' ]] &amp;&amp; [[ \"$AutoNet\" == '1' ]] &amp;&amp; {\n  sed -i '\/netcfg\\\/disable_autoconfig\/d' \/tmp\/boot\/preseed.cfg\n  sed -i '\/netcfg\\\/dhcp_options\/d' \/tmp\/boot\/preseed.cfg\n  sed -i '\/netcfg\\\/get_.*\/d' \/tmp\/boot\/preseed.cfg\n  sed -i '\/netcfg\\\/confirm_static\/d' \/tmp\/boot\/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' \/tmp\/boot\/preseed.cfg\n}\n[[ \"$GRUBPATCH\" == '0' ]] &amp;&amp; {\n  sed -i 's\/debconf-set\\ grub-installer\\\/bootdev.*\\\"\\;\/\/g' \/tmp\/boot\/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' \/tmp\/boot\/preseed.cfg\n}\n \n[[ \"$linuxdists\" == 'debian' ]] &amp;&amp; {\n  sed -i '\/user-setup\\\/allow-password-weak\/d' \/tmp\/boot\/preseed.cfg\n  sed -i '\/user-setup\\\/encrypt-home\/d' \/tmp\/boot\/preseed.cfg\n  sed -i '\/pkgsel\\\/update-policy\/d' \/tmp\/boot\/preseed.cfg\n  sed -i 's\/umount\\ \\\/media.*true\\;\\ \/\/g' \/tmp\/boot\/preseed.cfg\n}\n[[ \"$INCFW\" == '1' ]] &amp;&amp; [[ \"$linuxdists\" == 'debian' ]] &amp;&amp; [[ -f '\/boot\/firmware.cpio.gz' ]] &amp;&amp; {\n  gzip -d &lt; \/boot\/firmware.cpio.gz | cpio --extract --verbose --make-directories --no-absolute-filenames &gt;&gt;\/dev\/null 2&gt;&amp;1\n}\n \n[[ \"$ddMode\" == '1' ]] &amp;&amp; {\nWinNoDHCP(){\n  echo -ne \"for\\0040\\0057f\\0040\\0042tokens\\00753\\0052\\0042\\0040\\0045\\0045i\\0040in\\0040\\0050\\0047netsh\\0040interface\\0040show\\0040interface\\0040\\0136\\0174more\\0040\\00533\\0040\\0136\\0174findstr\\0040\\0057I\\0040\\0057R\\0040\\0042\u672c\u5730\\0056\\0052\\0040\u4ee5\u592a\\0056\\0052\\0040Local\\0056\\0052\\0040Ethernet\\0042\\0047\\0051\\0040do\\0040\\0050set\\0040EthName\\0075\\0045\\0045j\\0051\\r\\nnetsh\\0040\\0055c\\0040interface\\0040ip\\0040set\\0040address\\0040name\\0075\\0042\\0045EthName\\0045\\0042\\0040source\\0075static\\0040address\\0075$IPv4\\0040mask\\0075$MASK\\0040gateway\\0075$GATE\\r\\nnetsh\\0040\\0055c\\0040interface\\0040ip\\0040add\\0040dnsservers\\0040name\\0075\\0042\\0045EthName\\0045\\0042\\0040address\\00758\\00568\\00568\\00568\\0040index\\00751\\0040validate\\0075no\\r\\n\\r\\n\" &gt;&gt;'\/tmp\/boot\/net.tmp';\n}\nWinRDP(){\n  echo -ne \"netsh\\0040firewall\\0040set\\0040portopening\\0040protocol\\0075ALL\\0040port\\0075$WinRemote\\0040name\\0075RDP\\0040mode\\0075ENABLE\\0040scope\\0075ALL\\0040profile\\0075ALL\\r\\nnetsh\\0040firewall\\0040set\\0040portopening\\0040protocol\\0075ALL\\0040port\\0075$WinRemote\\0040name\\0075RDP\\0040mode\\0075ENABLE\\0040scope\\0075ALL\\0040profile\\0075CURRENT\\r\\nreg\\0040add\\0040\\0042HKLM\\0134SYSTEM\\0134CurrentControlSet\\0134Control\\0134Network\\0134NewNetworkWindowOff\\0042\\0040\\0057f\\r\\nreg\\0040add\\0040\\0042HKLM\\0134SYSTEM\\0134CurrentControlSet\\0134Control\\0134Terminal\\0040Server\\0042\\0040\\0057v\\0040fDenyTSConnections\\0040\\0057t\\0040reg\\0137dword\\0040\\0057d\\00400\\0040\\0057f\\r\\nreg\\0040add\\0040\\0042HKLM\\0134SYSTEM\\0134CurrentControlSet\\0134Control\\0134Terminal\\0040Server\\0134Wds\\0134rdpwd\\0134Tds\\0134tcp\\0042\\0040\\0057v\\0040PortNumber\\0040\\0057t\\0040reg\\0137dword\\0040\\0057d\\0040$WinRemote\\0040\\0057f\\r\\nreg\\0040add\\0040\\0042HKLM\\0134SYSTEM\\0134CurrentControlSet\\0134Control\\0134Terminal\\0040Server\\0134WinStations\\0134RDP\\0055Tcp\\0042\\0040\\0057v\\0040PortNumber\\0040\\0057t\\0040reg\\0137dword\\0040\\0057d\\0040$WinRemote\\0040\\0057f\\r\\nreg\\0040add\\0040\\0042HKLM\\0134SYSTEM\\0134CurrentControlSet\\0134Control\\0134Terminal\\0040Server\\0134WinStations\\0134RDP\\0055Tcp\\0042\\0040\\0057v\\0040UserAuthentication\\0040\\0057t\\0040reg\\0137dword\\0040\\0057d\\00400\\0040\\0057f\\r\\nFOR\\0040\\0057F\\0040\\0042tokens\\00752\\0040delims\\0075\\0072\\0042\\0040\\0045\\0045i\\0040in\\0040\\0050\\0047SC\\0040QUERYEX\\0040TermService\\0040\\0136\\0174FINDSTR\\0040\\0057I\\0040\\0042PID\\0042\\0047\\0051\\0040do\\0040TASKKILL\\0040\\0057F\\0040\\0057PID\\0040\\0045\\0045i\\r\\nFOR\\0040\\0057F\\0040\\0042tokens\\00752\\0040delims\\0075\\0072\\0042\\0040\\0045\\0045i\\0040in\\0040\\0050\\0047SC\\0040QUERYEX\\0040UmRdpService\\0040\\0136\\0174FINDSTR\\0040\\0057I\\0040\\0042PID\\0042\\0047\\0051\\0040do\\0040TASKKILL\\0040\\0057F\\0040\\0057PID\\0040\\0045\\0045i\\r\\nSC\\0040START\\0040TermService\\r\\n\\r\\n\" &gt;&gt;'\/tmp\/boot\/net.tmp';\n}\n  echo -ne \"\\0100ECHO\\0040OFF\\r\\n\\r\\ncd\\0056\\0076\\0045WINDIR\\0045\\0134GetAdmin\\r\\nif\\0040exist\\0040\\0045WINDIR\\0045\\0134GetAdmin\\0040\\0050del\\0040\\0057f\\0040\\0057q\\0040\\0042\\0045WINDIR\\0045\\0134GetAdmin\\0042\\0051\\0040else\\0040\\0050\\r\\necho\\0040CreateObject\\0136\\0050\\0042Shell\\0056Application\\0042\\0136\\0051\\0056ShellExecute\\0040\\0042\\0045\\0176s0\\0042\\0054\\0040\\0042\\0045\\0052\\0042\\0054\\0040\\0042\\0042\\0054\\0040\\0042runas\\0042\\0054\\00401\\0040\\0076\\0076\\0040\\0042\\0045temp\\0045\\0134Admin\\0056vbs\\0042\\r\\n\\0042\\0045temp\\0045\\0134Admin\\0056vbs\\0042\\r\\ndel\\0040\\0057f\\0040\\0057q\\0040\\0042\\0045temp\\0045\\0134Admin\\0056vbs\\0042\\r\\nexit\\0040\\0057b\\00402\\0051\\r\\n\\r\\n\" &gt;'\/tmp\/boot\/net.tmp';\n  [[ \"$setNet\" == '1' ]] &amp;&amp; WinNoDHCP;\n  [[ \"$setNet\" == '0' ]] &amp;&amp; [[ \"$AutoNet\" == '0' ]] &amp;&amp; WinNoDHCP;\n  [[ \"$setRDP\" == '1' ]] &amp;&amp; [[ -n \"$WinRemote\" ]] &amp;&amp; WinRDP\n  echo -ne \"ECHO\\0040SELECT\\0040VOLUME\\0075\\0045\\0045SystemDrive\\0045\\0045\\0040\\0076\\0040\\0042\\0045SystemDrive\\0045\\0134diskpart\\0056extend\\0042\\r\\nECHO\\0040EXTEND\\0040\\0076\\0076\\0040\\0042\\0045SystemDrive\\0045\\0134diskpart\\0056extend\\0042\\r\\nSTART\\0040\/WAIT\\0040DISKPART\\0040\\0057S\\0040\\0042\\0045SystemDrive\\0045\\0134diskpart\\0056extend\\0042\\r\\nDEL\\0040\\0057f\\0040\\0057q\\0040\\0042\\0045SystemDrive\\0045\\0134diskpart\\0056extend\\0042\\r\\n\\r\\n\" &gt;&gt;'\/tmp\/boot\/net.tmp';\n  echo -ne \"cd\\0040\\0057d\\0040\\0042\\0045ProgramData\\0045\\0057Microsoft\\0057Windows\\0057Start\\0040Menu\\0057Programs\\0057Startup\\0042\\r\\ndel\\0040\\0057f\\0040\\0057q\\0040net\\0056bat\\r\\n\\r\\n\\r\\n\" &gt;&gt;'\/tmp\/boot\/net.tmp';\n  iconv -f 'UTF-8' -t 'GBK' '\/tmp\/boot\/net.tmp' -o '\/tmp\/boot\/net.bat'\n  rm -rf '\/tmp\/boot\/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  \/tmp\/boot\/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' \/tmp\/boot\/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' \/tmp\/boot\/preseed.cfg\n  sed -i 's\/wget.*\\\/sbin\\\/reboot\\;\\ \/\/g' \/tmp\/boot\/preseed.cfg\n}\n \nelif [[ \"$linuxdists\" == 'centos' ]]; then\ncat &gt;\/tmp\/boot\/ks.cfg&lt;&lt;EOF\n#platform=x86, AMD64, or Intel EM64T\nfirewall --enabled --ssh\ninstall\nurl --url=\"http:\/\/$DISTMirror\/$DIST\/os\/$VER\/\"\nrootpw --iscrypted $myPASSWORD\nauth --useshadow --passalgo=sha512\nfirstboot --disable\nlang en_US\nkeyboard us\nselinux --disabled\nlogging --level=info\nreboot\ntext\nunsupported_hardware\nvnc\nskipx\ntimezone --isUtc Asia\/Hong_Kong\n#ONDHCP network --bootproto=dhcp --onboot=on\n#NODHCP network --bootproto=static --ip=$IPv4 --netmask=$MASK --gateway=$GATE --nameserver=8.8.8.8 --onboot=on\nbootloader --location=mbr --append=\"rhgb quiet crashkernel=auto\"\nzerombr\nclearpart --all --initlabel \nautopart\n \n%packages\n \n@base\n%end\n \n \n%post --interpreter=\/bin\/bash\n \nrm -rf \/root\/anaconda-ks.cfg\nrm -rf \/root\/install.*log\n%end\n \n \nEOF\n \n[[ \"$setNet\" == '0' ]] &amp;&amp; [[ \"$AutoNet\" == '1' ]] &amp;&amp; {\n  sed -i 's\/#ONDHCP\\ \/\/g' \/tmp\/boot\/ks.cfg\n} || {\n  sed -i 's\/#NODHCP\\ \/\/g' \/tmp\/boot\/ks.cfg\n}\n[[ \"$UNKNOWHW\" == '1' ]] &amp;&amp; sed -i 's\/^unsupported_hardware\/#unsupported_hardware\/g' \/tmp\/boot\/ks.cfg\n[[ \"$(echo \"$DIST\" |grep -o '^[0-9]\\{1\\}')\" == '5' ]] &amp;&amp; sed -i '0,\/^%end\/s\/\/#%end\/' \/tmp\/boot\/ks.cfg\nfi\n \nfind . | cpio -H newc --create --verbose | gzip -9 &gt; \/boot\/initrd.img;\nrm -rf \/tmp\/boot;\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 \nif [[ \"$loaderMode\" == \"0\" ]]; then\n  sleep 3 &amp;&amp; reboot &gt;\/dev\/null 2&gt;&amp;1\nelse\n  rm -rf \"$HOME\/loader\"\n  mkdir -p \"$HOME\/loader\"\n  cp -rf \"\/boot\/initrd.img\" \"$HOME\/loader\/initrd.img\"\n  cp -rf \"\/boot\/vmlinuz\" \"$HOME\/loader\/vmlinuz\"\n  [[ -f \"\/boot\/initrd.img\" ]] &amp;&amp; rm -rf \"\/boot\/initrd.img\"\n  [[ -f \"\/boot\/vmlinuz\" ]] &amp;&amp; rm -rf \"\/boot\/vmlinuz\"\n  echo &amp;&amp; ls -AR1 \"$HOME\/loader\"\nfi<\/code><\/pre>\n<p>&nbsp;\t\t<\/p>\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=121\">\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-121","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"http:\/\/www.zhangyijun.com\/index.php?rest_route=\/wp\/v2\/posts\/121","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=121"}],"version-history":[{"count":0,"href":"http:\/\/www.zhangyijun.com\/index.php?rest_route=\/wp\/v2\/posts\/121\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.zhangyijun.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=121"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.zhangyijun.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=121"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.zhangyijun.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=121"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}