Linux dd 成windows 脚本


参考:https://www.moerats.com/archives/412/

参考:https://www.zhzz.org/asp/346/

实际上,脚本是moeclub大牛编写,系统镜像,随意,80host不错。

至今,2020年五月可用,自动脚本一直可用,建议Linux 系统不要装太高版本。

wget https://xiaofd.github.io/ddwin.sh && bash ddwin.sh -w http://直链地址 -d /dev/vda
或者采用这位大牛的
wget --no-check-certificate -qO InstallNET.sh 'https://moeclub.org/attachment/LinuxShell/InstallNET.sh' && bash InstallNET.sh -dd '[Windows dd包直连地址]'

 




http://down.80host.com/iso/dd
这个网站有完成镜像,比如说:
http://down.80host.com/iso/dd/WS2008R2Enterprise-Joodle-Template.gz
http://down.80host.com/iso/dd/Windows2012R2-Joodle-Template.gz
Username:Administrator
Password:Password147

http://down.80host.com/iso/dd/Windows7-Joodle-Template.gz
http://down.80host.com/iso/dd/Windows8.1-Joodle-Template.gz
Username:Admin
Password:Password147

http://down.80host.com/iso/dd/7.ENT.EVAL.64.VIRTIO-SCSI.gz
Username:WhatUpTime.com
Password:P@ssword64

http://down.80host.com/iso/dd/win7_cn_5gb_virtio_scsi.gz
Username:administrator
Password:www.80host.com
支持OVH VPS的scsi磁盘驱动,其他viostor的DD包在上面会蓝屏

http://down.80host.com/iso/dd/win7_cn_5gb_virtio_scsi_faster.gz
Username:administrator
Password:www.80host.com
支持OVH VPS的scsi磁盘驱动,其他viostor的DD包在上面会蓝屏

http://down.80host.com/iso/dd/Kimsufi2003.gz
Username:Administrator
Password:password!yxz.me

http://down.80host.com/iso/dd/win2003_with_update.gz
Username:administrator
Password:80hostkvmlamjj

http://down.80host.com/iso/dd/ikoula92.gz
Username:administrator
Password:Abcd123400

Laiboke.com制作的中文版2012R2
http://down.80host.com/iso/dd/Win2012R2ZW.gz
Username:Administrator
Password:Laiboke.com

Leaseweb/Linode专用
http://down.80host.com/iso/dd/cn2003-virtio-pass-Linode.gz
Username:Administrator
Password:Linode

 

 bwh可用:

 

 

wget -qO DebianNET.sh qiu.sh/dd && bash DebianNET.sh -dd "https://files.lolico.moe/show/dd/win2016-standard-vultr-bare-metal.gz"
账户:Administrator
密码:lolico.moe123
猜测测试:https://files.lolico.moe/home/dd 里面有俩镜像
win2008R2-standard-x64.gz
密码可能是:
来源及版权:https://moeclub.org
用户名:Administrator
密 码:Vicer

可用:
wget -qO DebianNET.sh qiu.sh/dd && bash DebianNET.sh -dd "https://files.lolico.moe/show/dd/win2008R2-standard-x64.gz"

  

 

 

 

 

最后贴脚本,作为备用

  1 #!/bin/bash
  2 
  3 while [[ $# -ge 1 ]]; do
  4   case $1 in
  5     -v|--ver)
  6       shift
  7       VERtmp="$1"
  8       shift
  9       ;;
 10     -w|--winurl)
 11       shift
 12       WINURL="$1"
 13       shift
 14       ;;
 15     -d|--device)
 16       shift
 17       DEVDISK="$1"
 18       shift
 19       ;;
 20     --debian|--ubuntu)
 21       shift
 22       vDEBtmp="$1"
 23       shift
 24       ;;
 25     -p|--password)
 26       shift
 27       WDtmp="$1"
 28       shift
 29       ;;
 30     -a|--auto)
 31       shift
 32       INStmp='auto'
 33       ;;
 34     -m|--manual)
 35       shift
 36       INStmp='manual'
 37       ;;
 38     -apt|--mirror)
 39       shift
 40       isMirror='1'
 41       tmpMirror="$1"
 42       shift
 43       ;;
 44     *)
 45       echo -ne " Usage:\n\tbash $0\t-d/--debian [7/\033[33m\033[04mwheezy\033[0m|8/jessie|9/stretch]\n\t\t\t\t-v/--ver [32/\033[33m\033[04mi386\033[0m|64/amd64]\n\t\t\t\t-apt/--mirror\n\t\t\t\t-a/--auto\n\t\t\t\t-m/--manual\n"
 46       exit 1;
 47       ;;
 48     esac
 49   done
 50 VERtmp='64'
 51 vDEBtmp='xenial'
 52 INStmp='auto'
 53 [ $EUID -ne 0 ] && echo "Error:This script must be run as root!" && exit 1
 54 [ -f /boot/grub/grub.cfg ] && GRUBOLD='0' && GRUBDIR='/boot/grub' && GRUBFILE='grub.cfg'
 55 [ -z $GRUBDIR ] && [ -f /boot/grub2/grub.cfg ] && GRUBOLD='0' && GRUBDIR='/boot/grub2' && GRUBFILE='grub.cfg'
 56 [ -z $GRUBDIR ] && [ -f /boot/grub/grub.conf ] && GRUBOLD='1' && GRUBDIR='/boot/grub' && GRUBFILE='grub.conf'
 57 [ -z $GRUBDIR -o -z $GRUBFILE ] && echo "Error! Not Found grub path." && exit 1
 58 
 59 [ -n $vDEBtmp ] && {
 60 [ "$vDEBtmp" == '7' -o "$vDEBtmp" == 'wheezy' ] && linuxdists='debian' && vDEB='wheezy';
 61 [ "$vDEBtmp" == '8' -o "$vDEBtmp" == 'jessie' ] && linuxdists='debian' && vDEB='jessie';
 62 [ "$vDEBtmp" == '9' -o "$vDEBtmp" == 'stretch' ] && linuxdists='debian' && vDEB='stretch';
 63 [ "$vDEBtmp" == 'precise' ] && linuxdists='ubuntu' && vDEB='precise';
 64 [ "$vDEBtmp" == 'trusty' ] && linuxdists='ubuntu' && vDEB='trusty';
 65 [ "$vDEBtmp" == 'wily' ] && linuxdists='ubuntu' && vDEB='wily';
 66 [ "$vDEBtmp" == 'xenial' ] && linuxdists='ubuntu' && vDEB='xenial';
 67 [ "$vDEBtmp" == 'yakkety' ] && linuxdists='ubuntu' && vDEB='yakkety';
 68 [ "$vDEBtmp" == 'zesty' ] && linuxdists='ubuntu' && vDEB='zesty';
 69 }
 70 [ -n $vDEBtmp ] && {
 71 [ "$VERtmp" == '32' -o "$VERtmp" == 'i386' ] && VER='i386';
 72 [ "$VERtmp" == '64' -o "$VERtmp" == 'amd64' ] && VER='amd64';
 73 }
 74 
 75 [ -z $linuxdists ] && linuxdists='debian'
 76 [ -n $isMirror ] && [ "$isMirror" == '1' ] && [ -n $tmpMirror ] && {
 77 tmpDebianMirror="$(echo -n "$tmpMirror" |grep -Eo '.*\.(\w+)')"
 78 echo -n "$tmpDebianMirror" |grep -q '://'
 79 [ $? -eq '0' ] && {
 80 DebianMirror="$(echo -n "$tmpDebianMirror" |awk -F'://' '{print $2}')"
 81 } || {
 82 DebianMirror="$(echo -n "$tmpDebianMirror")"
 83 }
 84 } || {
 85 [[ $linuxdists == 'debian' ]] && DebianMirror='httpredir.debian.org'
 86 [[ $linuxdists == 'ubuntu' ]] && DebianMirror='archive.ubuntu.com'
 87 }
 88 [ -z $DebianMirrorDirectory ] && [ -n $DebianMirror ] && [ -n $tmpMirror ] && {
 89 DebianMirrorDirectory="$(echo -n "$tmpMirror" |awk -F''${DebianMirror}'' '{print $2}' |sed 's/\/$//g')"
 90 }
 91 [ "$DebianMirrorDirectory" == '/' ] && [ -n $DebianMirror ] && {
 92 [[ $linuxdists == 'debian' ]] && DebianMirrorDirectory='/debian'
 93 [[ $linuxdists == 'ubuntu' ]] && DebianMirrorDirectory='/ubuntu'
 94 }
 95 [ -z $DebianMirrorDirectory ] && [ -n $DebianMirror ] && {
 96 [[ $linuxdists == 'debian' ]] && DebianMirrorDirectory='/debian'
 97 [[ $linuxdists == 'ubuntu' ]] && DebianMirrorDirectory='/ubuntu'
 98 }
 99 
100 [ -n $INStmp ] && {
101 [ "$INStmp" == 'auto' ] && inVNC='n'
102 [ "$INStmp" == 'manual' ] && inVNC='y'
103 }
104 [ -n $WDtmp ] && myPASSWORD="$WDtmp"
105 
106 [ -z $vDEB ] && vDEB='wheezy';
107 [ -z $VER ] && VER='i386';
108 [ -z $myPASSWORD ] && myPASSWORD='xiaofd'
109 
110 clear && echo -e "\n\033[36m# Install\033[0m\n"
111 
112 [ -z $inVNC ] && ASKVNC(){
113 inVNC='y';
114 echo -ne "\033[34mCan you login VNC?\033[0m\e[33m[\e[32my\e[33m/n]\e[0m "
115 read inVNCtmp
116 [[ -n "$inVNCtmp" ]] && inVNC=$inVNCtmp
117 [ "$inVNC" == 'y' -o "$inVNC" == 'Y' ] && inVNC='y'
118 [ "$inVNC" == 'n' -o "$inVNC" == 'N' ] && inVNC='n'
119 }
120 
121 [ "$inVNC" == 'y' -o "$inVNC" == 'n' ] || ASKVNC;
122 
123 [[ $linuxdists == 'debian' ]] && LinuxName='Debian'
124 [[ $linuxdists == 'ubuntu' ]] && LinuxName='Ubuntu'
125 [ "$inVNC" == 'y' ] && echo -e "\033[34mManual Mode\033[0m insatll \033[33m$LinuxName\033[0m [\033[33m$vDEB\033[0m] [\033[33m$VER\033[0m] in VNC. "
126 [ "$inVNC" == 'n' ] && echo -e "\033[34mAuto Mode\033[0m insatll \033[33m$LinuxName\033[0m [\033[33m$vDEB\033[0m] [\033[33m$VER\033[0m]. "
127 
128 echo -e "\n[\033[33m$vDEB\033[0m] [\033[33m$VER\033[0m] Downloading..."
129 [ -z $DebianMirror ] && echo -ne "\033[31mError! \033[0mGet debian mirror fail! \n" && exit 1
130 [ -z $DebianMirrorDirectory ] && echo -ne "\033[31mError! \033[0mGet debian mirror directory fail! \n" && exit 1
131 wget --no-check-certificate -qO '/boot/initrd.gz' "http://$DebianMirror$DebianMirrorDirectory/dists/$vDEB/main/installer-$VER/current/images/netboot/$linuxdists-installer/$VER/initrd.gz"
132 [ $? -ne '0' ] && echo -ne "\033[31mError! \033[0mDownload 'initrd.gz' failed! \n" && exit 1
133 wget --no-check-certificate -qO '/boot/linux' "http://$DebianMirror$DebianMirrorDirectory/dists/$vDEB/main/installer-$VER/current/images/netboot/$linuxdists-installer/$VER/linux"
134 [ $? -ne '0' ] && echo -ne "\033[31mError! \033[0mDownload 'linux' failed! \n" && exit 1
135 
136 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}')"
137 [ -n "$DEFAULTNET" ] && 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\}')"
138 IPv4="$(echo -n "$IPSUB" |cut -d'/' -f1)"
139 NETSUB="$(echo -n "$IPSUB" |grep -o '/[0-9]\{1,2\}')"
140 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\}')"
141 [ -n "$NETSUB" ] && 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)"
142 
143 [ -n "$GATE" ] && [ -n "$MASK" ] && [ -n "$IPv4" ] || {
144 echo "Not found \`ip command\`, It will use \`route command\`."
145 ipNum() {
146   local IFS='.'
147   read ip1 ip2 ip3 ip4 <<<"$1"
148   echo $((ip1*(1<<24)+ip2*(1<<16)+ip3*(1<<8)+ip4))
149 }
150 
151 SelectMax(){
152 ii=0
153 for 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\}'`
154   do
155     NumTMP="$(ipNum $IPITEM)"
156     eval "arrayNum[$ii]='$NumTMP,$IPITEM'"
157     ii=$[$ii+1]
158   done
159 echo ${arrayNum[@]} |sed 's/\s/\n/g' |sort -n -k 1 -t ',' |tail -n1 |cut -d',' -f2
160 }
161 
162 [[ -z $IPv4 ]] && 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)"
163 [[ -z $GATE ]] && GATE="$(SelectMax 2)"
164 [[ -z $MASK ]] && MASK="$(SelectMax 3)"
165 
166 [ -n "$GATE" ] && [ -n "$MASK" ] && [ -n "$IPv4" ] || {
167 echo "Error! Not configure network. "
168 exit 1
169 }
170 }
171 
172 [ -f /etc/network/interfaces ] && {
173 [[ -z "$(sed -n '/iface.*inet static/p' /etc/network/interfaces)" ]] && AutoNet='1' || AutoNet='0'
174 [ -d /etc/network/interfaces.d ] && {
175 ICFGN="$(find /etc/network/interfaces.d -name '*.cfg' |wc -l)" || ICFGN='0'
176 [ "$ICFGN" -ne '0' ] && {
177 for NetCFG in `ls -1 /etc/network/interfaces.d/*.cfg`
178  do 
179   [[ -z "$(cat $NetCFG | sed -n '/iface.*inet static/p')" ]] && AutoNet='1' || AutoNet='0'
180   [ "$AutoNet" -eq '0' ] && break
181 done
182 }
183 }
184 }
185 [ -d /etc/sysconfig/network-scripts ] && {
186 ICFGN="$(find /etc/sysconfig/network-scripts -name 'ifcfg-*' |grep -v 'lo'|wc -l)" || ICFGN='0'
187 [ "$ICFGN" -ne '0' ] && {
188 for NetCFG in `ls -1 /etc/sysconfig/network-scripts/ifcfg-* |grep -v 'lo$' |grep -v ':[0-9]\{1,\}'`
189  do 
190   [[ -n "$(cat $NetCFG | sed -n '/BOOTPROTO.*[dD][hH][cC][pP]/p')" ]] && AutoNet='1' || {
191   AutoNet='0' && . $NetCFG
192   [ -n $NETMASK ] && MASK="$NETMASK"
193   [ -n $GATEWAY ] && GATE="$GATEWAY"
194 }
195   [ "$AutoNet" -eq '0' ] && break
196 done
197 }
198 }
199 
200 [ ! -f $GRUBDIR/$GRUBFILE ] && echo "Error! Not Found $GRUBFILE. " && exit 1
201 
202 [ ! -f $GRUBDIR/$GRUBFILE.old ] && [ -f $GRUBDIR/$GRUBFILE.bak ] && mv -f $GRUBDIR/$GRUBFILE.bak $GRUBDIR/$GRUBFILE.old
203 mv -f $GRUBDIR/$GRUBFILE $GRUBDIR/$GRUBFILE.bak
204 [ -f $GRUBDIR/$GRUBFILE.old ] && cat $GRUBDIR/$GRUBFILE.old >$GRUBDIR/$GRUBFILE || cat $GRUBDIR/$GRUBFILE.bak >$GRUBDIR/$GRUBFILE
205 
206 [ "$GRUBOLD" == '0' ] && {
207 CFG0="$(awk '/menuentry /{print NR}' $GRUBDIR/$GRUBFILE|head -n 1)"
208 CFG2="$(awk '/menuentry /{print NR}' $GRUBDIR/$GRUBFILE|head -n 2 |tail -n 1)"
209 CFG1=""
210 for CFGtmp in `awk '/}/{print NR}' $GRUBDIR/$GRUBFILE`
211  do
212   [ $CFGtmp -gt "$CFG0" -a $CFGtmp -lt "$CFG2" ] && CFG1="$CFGtmp";
213  done
214 [ -z "$CFG1" ] && {
215 echo "Error! read $GRUBFILE. "
216 exit 1
217 }
218 sed -n "$CFG0,$CFG1"p $GRUBDIR/$GRUBFILE >/tmp/grub.new
219 [ -f /tmp/grub.new ] && [ "$(grep -c '{' /tmp/grub.new)" -eq "$(grep -c '}' /tmp/grub.new)" ] || {
220 echo -ne "\033[31mError! \033[0mNot configure $GRUBFILE. \n"
221 exit 1
222 }
223 
224 sed -i "/menuentry.*/c\menuentry\ \'Install OS \[$vDEB\ $VER\]\'\ --class debian\ --class\ gnu-linux\ --class\ gnu\ --class\ os\ \{" /tmp/grub.new
225 [ "$(grep -c '{' /tmp/grub.new)" -eq "$(grep -c '}' /tmp/grub.new)" ] || {
226 echo "Error! configure append $GRUBFILE. "
227 exit 1
228 }
229 sed -i "/echo.*Loading/d" /tmp/grub.new
230 }
231 
232 [ "$GRUBOLD" == '1' ] && {
233 CFG0="$(awk '/title /{print NR}' $GRUBDIR/$GRUBFILE|head -n 1)"
234 CFG1="$(awk '/title /{print NR}' $GRUBDIR/$GRUBFILE|head -n 2 |tail -n 1)"
235 [ -n $CFG0 ] && [ -z $CFG1 -o $CFG1 == $CFG0 ] && sed -n "$CFG0,$"p $GRUBDIR/$GRUBFILE >/tmp/grub.new
236 [ -n $CFG0 ] && [ -z $CFG1 -o $CFG1 != $CFG0 ] && sed -n "$CFG0,$CFG1"p $GRUBDIR/$GRUBFILE >/tmp/grub.new
237 [ ! -f /tmp/grub.new ] && echo "Error! configure append $GRUBFILE. " && exit 1
238 sed -i "/title.*/c\title\ \'Install OS \[$vDEB\ $VER\]\'" /tmp/grub.new
239 sed -i '/^#/d' /tmp/grub.new
240 }
241 
242 [ -n "$(grep 'initrd.*/' /tmp/grub.new |awk '{print $2}' |tail -n 1 |grep '^/boot/')" ] && Type='InBoot' || Type='NoBoot'
243 
244 LinuxKernel="$(grep 'linux.*/' /tmp/grub.new |awk '{print $1}' |head -n 1)"
245 [ -z $LinuxKernel ] && LinuxKernel="$(grep 'kernel.*/' /tmp/grub.new |awk '{print $1}' |head -n 1)"
246 LinuxIMG="$(grep 'initrd.*/' /tmp/grub.new |awk '{print $1}' |tail -n 1)"
247 
248 [ "$Type" == 'InBoot' ] && {
249 sed -i "/$LinuxKernel.*\//c\\\t$LinuxKernel\\t\/boot\/linux auto=true hostname=$linuxdists domain= -- quiet" /tmp/grub.new
250 sed -i "/$LinuxIMG.*\//c\\\t$LinuxIMG\\t\/boot\/initrd.gz" /tmp/grub.new
251 }
252 
253 [ "$Type" == 'NoBoot' ] && {
254 sed -i "/$LinuxKernel.*\//c\\\t$LinuxKernel\\t\/linux auto=true hostname=$linuxdists domain= -- quiet" /tmp/grub.new
255 sed -i "/$LinuxIMG.*\//c\\\t$LinuxIMG\\t\/initrd.gz" /tmp/grub.new
256 }
257 
258 sed -i '$a\\n' /tmp/grub.new
259 
260 [ "$inVNC" == 'n' ] && {
261 GRUBPATCH='0'
262 [ -f /etc/network/interfaces -o -d /etc/sysconfig/network-scripts ] && {
263 sed -i ''${CFG0}'i\\n' $GRUBDIR/$GRUBFILE
264 sed -i ''${CFG0}'r /tmp/grub.new' $GRUBDIR/$GRUBFILE
265 [ -z $AutoNet ] && echo "Error, Not found interfaces config." && exit 1
266 [ -f  $GRUBDIR/grubenv ] && sed -i 's/saved_entry/#saved_entry/g' $GRUBDIR/grubenv
267 [ -d /boot/tmp ] && rm -rf /boot/tmp
268 mkdir -p /boot/tmp/
269 cd /boot/tmp/
270 gzip -d < ../initrd.gz | cpio --extract --verbose --make-directories --no-absolute-filenames >>/dev/null 2>&1
271 cat >/boot/tmp/preseed.cfg<<EOF
272 d-i debian-installer/locale string en_US
273 d-i console-setup/layoutcode string us
274 d-i keyboard-configuration/xkb-keymap string us
275 d-i netcfg/choose_interface select auto
276 d-i netcfg/disable_autoconfig boolean true
277 d-i netcfg/dhcp_failed note
278 d-i netcfg/dhcp_options select Configure network manually
279 d-i netcfg/get_ipaddress string $IPv4
280 d-i netcfg/get_netmask string $MASK
281 d-i netcfg/get_gateway string $GATE
282 d-i netcfg/get_nameservers string 8.8.8.8
283 d-i netcfg/no_default_route boolean true
284 d-i netcfg/confirm_static boolean true
285 d-i mirror/country string manual
286 d-i mirror/http/hostname string $DebianMirror
287 d-i mirror/http/directory string $DebianMirrorDirectory
288 d-i mirror/http/proxy string
289 d-i passwd/root-login boolean ture
290 d-i passwd/make-user boolean false
291 d-i passwd/root-password password $myPASSWORD
292 d-i passwd/root-password-again password $myPASSWORD
293 d-i user-setup/allow-password-weak boolean true
294 d-i user-setup/encrypt-home boolean false
295 d-i clock-setup/utc boolean true
296 d-i time/zone string US/Eastern
297 d-i clock-setup/ntp boolean true
298 d-i partman/early_command string \
299 debconf-set partman-auto/disk "\$(list-devices disk |head -n1)"; \
300 debconf-set grub-installer/bootdev string "\$(list-devices disk |head -n1)"; \
301 umount /media || true; \
302 [ -z $DEVDISK ] && DEVDISK=$(list-devices disk |head -n1); \
303 wget -O- '$WINURL' | gunzip -dc | /bin/dd of=$DEVDISK; \
304 /sbin/reboot;
305 d-i partman/mount_style select uuid
306 d-i partman-auto/init_automatically_partition select Guided - use entire disk
307 d-i partman-auto/method string regular
308 d-i partman-lvm/device_remove_lvm boolean true
309 d-i partman-md/device_remove_md boolean true
310 d-i partman-auto/choose_recipe select atomic
311 d-i partman-partitioning/confirm_write_new_label boolean true
312 d-i partman/choose_partition select finish
313 d-i partman-lvm/confirm boolean true
314 d-i partman-lvm/confirm_nooverwrite boolean true
315 d-i partman/confirm boolean true
316 d-i partman/confirm_nooverwrite boolean true
317 d-i debian-installer/allow_unauthenticated boolean true
318 tasksel tasksel/first multiselect minimal
319 d-i pkgsel/update-policy select none
320 d-i pkgsel/include string openssh-server
321 d-i pkgsel/upgrade select none
322 popularity-contest popularity-contest/participate boolean false
323 d-i grub-installer/only_debian boolean true
324 d-i grub-installer/bootdev string default
325 d-i finish-install/reboot_in_progress note
326 d-i debian-installer/exit/reboot boolean true
327 EOF
328 [ "$AutoNet" -eq '1' ] && {
329 sed -i '/netcfg\/disable_autoconfig/d' /boot/tmp/preseed.cfg
330 sed -i '/netcfg\/dhcp_options/d' /boot/tmp/preseed.cfg
331 sed -i '/netcfg\/get_.*/d' /boot/tmp/preseed.cfg
332 sed -i '/netcfg\/confirm_static/d' /boot/tmp/preseed.cfg
333 }
334 [ "$vDEB" == 'trusty' ] && GRUBPATCH='1'
335 [ "$vDEB" == 'wily' ] && GRUBPATCH='1'
336 [ "$GRUBPATCH" == '1' ] && {
337 sed -i 's/^d-i\ grub-installer\/bootdev\ string\ default//g' /boot/tmp/preseed.cfg
338 }
339 [ "$GRUBPATCH" == '0' ] && {
340 sed -i 's/debconf-set\ grub-installer\/bootdev.*\"\;//g' /boot/tmp/preseed.cfg
341 }
342 [ "$vDEB" == 'xenial' ] && {
343 sed -i 's/^d-i\ clock-setup\/ntp\ boolean\ true/d-i\ clock-setup\/ntp\ boolean\ false/g' /boot/tmp/preseed.cfg
344 }
345 [ "$linuxdists" == 'debian' ] && {
346 sed -i '/user-setup\/allow-password-weak/d' /boot/tmp/preseed.cfg
347 sed -i '/user-setup\/encrypt-home/d' /boot/tmp/preseed.cfg
348 sed -i '/pkgsel\/update-policy/d' /boot/tmp/preseed.cfg
349 sed -i 's/umount\ \/media.*\;//g' /boot/tmp/preseed.cfg
350 }
351 rm -rf ../initrd.gz
352 find . | cpio -H newc --create --verbose | gzip -9 > ../initrd.gz
353 rm -rf /boot/tmp
354 }
355 }
356 
357 [ "$inVNC" == 'y' ] && {
358 sed -i '$i\\n' $GRUBDIR/$GRUBFILE
359 sed -i '$r /tmp/grub.new' $GRUBDIR/$GRUBFILE
360 echo -e "\n\033[33m\033[04mIt will reboot! \nPlease look at VNC! \nSelect\033[0m\033[32m Install OS [$vDEB $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"
361 echo -e "\033[35mIPv4\t\tNETMASK\t\tGATEWAY\033[0m"
362 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"
363 
364 read -n 1 -p "Press Enter to reboot..." INP
365 if [ "$INP" != '' ] ; then
366 echo -ne '\b \n'
367 echo "";
368 fi
369 }
370 
371 chown root:root $GRUBDIR/$GRUBFILE
372 chmod 444 $GRUBDIR/$GRUBFILE
373 
374 sleep 3 && reboot >/dev/null 2>&1

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM