admin管理员组

文章数量:1635363

文章转载自 萌咖 && 狗仔小分队

特别注意:OpenVZ构架不适用,安装之前备份重要数据。

特别注意:OpenVZ构架不适用,安装之前备份重要数据。

特别注意:OpenVZ构架不适用,安装之前备份重要数据。

背景

适用于由GRUB引导的CentOS,Ubuntu,Debian系统.

使用官方发行版去掉模板预装的软件。

同时也可以解决内核版本与软件不兼容的问题。

只要有root权限,还您一个纯净的系统。

运行要求

Debian/Ubuntu/CentOS 系统(由GRUB引导);

wget 用来下载文件,获取公网IP;

ip 获取网关,掩码等;

sed awk grep 处理文本流;

VNC 安装系统(此项为可选)。

安装脚本

全自动安装默认 root 密码:Vicer,安装完成后请立即更改密码。

Debian 7 x32

1

wget--no-check-certificate-qODebianNET.sh'https://moeclub/attachment/LinuxShell/DebianNET.sh'&&chmod-xDebianNET.sh&&bashDebianNET.sh-d7-v32

Debian 7 x64

1

wget--no-check-certificate-qODebianNET.sh'https://moeclub/attachment/LinuxShell/DebianNET.sh'&&chmod-xDebianNET.sh&&bashDebianNET.sh-d7-v64

Debian 8 x32

1

wget--no-check-certificate-qODebianNET.sh'https://moeclub/attachment/LinuxShell/DebianNET.sh'&&chmod-xDebianNET.sh&&bashDebianNET.sh-d8-v32

Debian 8 x64

1

wget--no-check-certificate-qODebianNET.sh'https://moeclub/attachment/LinuxShell/DebianNET.sh'&&chmod-xDebianNET.sh&&bashDebianNET.sh-d8-v64

Debian 9 x32

1

wget--no-check-certificate-qODebianNET.sh'https://moeclub/attachment/LinuxShell/DebianNET.sh'&&chmod-xDebianNET.sh&&bashDebianNET.sh-d9-v32

Debian 9 x64

1

wget--no-check-certificate-qODebianNET.sh'https://moeclub/attachment/LinuxShell/DebianNET.sh'&&chmod-xDebianNET.sh&&bashDebianNET.sh-d9-v64

Ubuntu 14.04 x32

1

wget--no-check-certificate-qODebianNET.sh'https://moeclub/attachment/LinuxShell/DebianNET.sh'&&chmod-xDebianNET.sh&&bashDebianNET.sh-dtrusty-v32

Ubuntu 14.04 x64

1

wget--no-check-certificate-qODebianNET.sh'https://moeclub/attachment/LinuxShell/DebianNET.sh'&&chmod-xDebianNET.sh&&bashDebianNET.sh-dtrusty-v64

Ubuntu 16.04 x32

1

wget--no-check-certificate-qODebianNET.sh'https://moeclub/attachment/LinuxShell/DebianNET.sh'&&chmod-xDebianNET.sh&&bashDebianNET.sh-dxenial-v32

Ubuntu 16.04 x64

1

wget--no-check-certificate-qODebianNET.sh'https://moeclub/attachment/LinuxShell/DebianNET.sh'&&chmod-xDebianNET.sh&&bashDebianNET.sh-dxenial-v64

Ubuntu 17.04 x32

1

wget--no-check-certificate-qODebianNET.sh'https://moeclub/attachment/LinuxShell/DebianNET.sh'&&chmod-xDebianNET.sh&&bashDebianNET.sh-dzesty-v32

Ubuntu 17.04 x64

1

wget--no-check-certificate-qODebianNET.sh'https://moeclub/attachment/LinuxShell/DebianNET.sh'&&chmod-xDebianNET.sh&&bashDebianNET.sh-dzesty-v64

CentOS 6+ X64

1

wgetxiaofd.github.io/centos.sh&&bashcentos.sh

安装时间(Vultr 2.5刀机器 重装大概15分钟) root用户密码为 xiaofd.win

注意事项

确保安装了所需软件:

1

2

3

4

5

#Debian/Ubuntu:

apt-getinstall-ygawksedgrep

#RedHat/CentOS:

yuminstall-ygawksedgrep

如果出现了错误,请运行:

1

2

3

4

5

#Debian/Ubuntu:

apt-getupdate

#RedHat/CentOS:

yumupdate

在安装Ubuntu时,可能会遇到:

Getting the time form a network time server...

界面进度条很长时间不会动,可以等待它超时或者更换别的版本.

该问题是Ubuntu系统的问题.

代码备份!!!

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

59

60

61

62

63

64

65

66

67

68

69

70

71

72

73

74

75

76

77

78

79

80

81

82

83

84

85

86

87

88

89

90

91

92

93

94

95

96

97

98

99

100

101

102

103

104

105

106

107

108

109

110

111

112

113

114

115

116

117

118

119

120

121

122

123

124

125

126

127

128

129

130

131

132

133

134

135

136

137

138

139

140

141

142

143

144

145

146

147

148

149

150

151

152

153

154

155

156

157

158

159

160

161

162

163

164

165

166

167

168

169

170

171

172

173

174

175

176

177

178

179

180

181

182

183

184

185

186

187

188

189

190

191

192

193

194

195

196

197

198

199

200

201

202

203

204

205

206

207

208

209

210

211

212

213

214

215

216

217

218

219

220

221

222

223

224

225

226

227

228

229

230

231

232

233

234

235

236

237

238

239

240

241

242

243

244

245

246

247

248

249

250

251

252

253

254

255

256

257

258

259

260

261

262

263

264

265

266

267

268

269

270

271

272

273

274

275

276

277

278

279

280

281

282

283

284

285

286

287

288

289

290

291

292

293

294

295

296

297

298

299

300

301

302

303

304

305

306

307

308

309

310

311

312

313

314

315

316

317

318

319

320

321

322

323

324

325

326

327

328

329

330

331

332

333

334

335

336

337

338

339

340

341

342

343

344

345

346

347

348

349

350

351

352

353

354

355

356

357

358

359

360

361

362

363

364

365

366

367

368

369

370

#!/bin/bash

while[[$# -ge 1 ]]; do

case$1in

-v|--ver)

shift

VERtmp="$1"

shift

;;

-d|--debian|--ubuntu)

shift

vDEBtmp="$1"

shift

;;

-p|--password)

shift

WDtmp="$1"

shift

;;

-a|--auto)

shift

INStmp='auto'

;;

-m|--manual)

shift

INStmp='manual'

;;

-apt|--mirror)

shift

isMirror='1'

tmpMirror="$1"

shift

;;

*)

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"

exit1;

;;

esac

done

[$EUID-ne0]&&echo"Error:This script must be run as root!"&&exit1

[-f/boot/grub/grub.cfg]&&GRUBOLD='0'&&GRUBDIR='/boot/grub'&&GRUBFILE='grub.cfg'

[-z$GRUBDIR]&&[-f/boot/grub2/grub.cfg]&&GRUBOLD='0'&&GRUBDIR='/boot/grub2'&&GRUBFILE='grub.cfg'

[-z$GRUBDIR]&&[-f/boot/grub/grub.conf]&&GRUBOLD='1'&&GRUBDIR='/boot/grub'&&GRUBFILE='grub.conf'

[-z$GRUBDIR-o-z$GRUBFILE]&&echo"Error! Not Found grub path."&&exit1

[-n$vDEBtmp]&&{

["$vDEBtmp"=='7'-o"$vDEBtmp"=='wheezy']&&linuxdists='debian'&&vDEB='wheezy';

["$vDEBtmp"=='8'-o"$vDEBtmp"=='jessie']&&linuxdists='debian'&&vDEB='jessie';

["$vDEBtmp"=='9'-o"$vDEBtmp"=='stretch']&&linuxdists='debian'&&vDEB='stretch';

["$vDEBtmp"=='precise']&&linuxdists='ubuntu'&&vDEB='precise';

["$vDEBtmp"=='trusty']&&linuxdists='ubuntu'&&vDEB='trusty';

["$vDEBtmp"=='wily']&&linuxdists='ubuntu'&&vDEB='wily';

["$vDEBtmp"=='xenial']&&linuxdists='ubuntu'&&vDEB='xenial';

["$vDEBtmp"=='yakkety']&&linuxdists='ubuntu'&&vDEB='yakkety';

["$vDEBtmp"=='zesty']&&linuxdists='ubuntu'&&vDEB='zesty';

}

[-n$vDEBtmp]&&{

["$VERtmp"=='32'-o"$VERtmp"=='i386']&&VER='i386';

["$VERtmp"=='64'-o"$VERtmp"=='amd64']&&VER='amd64';

}

[-z$linuxdists]&&linuxdists='debian'

[-n$isMirror]&&["$isMirror"=='1']&&[-n$tmpMirror]&&{

tmpDebianMirror="$(echo -n "$tmpMirror" |grep -Eo '.*\.(\w+)')"

echo-n"$tmpDebianMirror"|grep-q'://'

[$?-eq'0']&&{

DebianMirror="$(echo -n "$tmpDebianMirror" |awk -F'://' '{print $2}')"

}||{

DebianMirror="$(echo -n "$tmpDebianMirror")"

}

}||{

[[$linuxdists=='debian']]&&DebianMirror='httpredir.debian'

[[$linuxdists=='ubuntu']]&&DebianMirror='archive.ubuntu'

}

[-z$DebianMirrorDirectory]&&[-n$DebianMirror]&&[-n$tmpMirror]&&{

DebianMirrorDirectory="$(echo -n "$tmpMirror" |awk -F''${DebianMirror}'' '{print $2}' |sed 's/\/$//g')"

}

["$DebianMirrorDirectory"=='/']&&[-n$DebianMirror]&&{

[[$linuxdists=='debian']]&&DebianMirrorDirectory='/debian'

[[$linuxdists=='ubuntu']]&&DebianMirrorDirectory='/ubuntu'

}

[-z$DebianMirrorDirectory]&&[-n$DebianMirror]&&{

[[$linuxdists=='debian']]&&DebianMirrorDirectory='/debian'

[[$linuxdists=='ubuntu']]&&DebianMirrorDirectory='/ubuntu'

}

[-n$INStmp]&&{

["$INStmp"=='auto']&&inVNC='n'

["$INStmp"=='manual']&&inVNC='y'

}

[-n$WDtmp]&&myPASSWORD="$WDtmp"

[-z$vDEB]&&vDEB='wheezy';

[-z$VER]&&VER='i386';

[-z$myPASSWORD]&&myPASSWORD='Vicer'

clear&&echo-e"\n\033[36m# Install\033[0m\n"

[-z$inVNC]&&ASKVNC(){

inVNC='y';

echo-ne"\033[34mCan you login VNC?\033[0m\e[33m[\e[32my\e[33m/n]\e[0m "

readinVNCtmp

[[-n"$inVNCtmp"]]&&inVNC=$inVNCtmp

["$inVNC"=='y'-o"$inVNC"=='Y']&&inVNC='y'

["$inVNC"=='n'-o"$inVNC"=='N']&&inVNC='n'

}

["$inVNC"=='y'-o"$inVNC"=='n']||ASKVNC;

[[$linuxdists=='debian']]&&LinuxName='Debian'

[[$linuxdists=='ubuntu']]&&LinuxName='Ubuntu'

["$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. "

["$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]. "

echo-e"\n[\033[33m$vDEB\033[0m] [\033[33m$VER\033[0m] Downloading..."

[-z$DebianMirror]&&echo-ne"\033[31mError! \033[0mGet debian mirror fail! \n"&&exit1

[-z$DebianMirrorDirectory]&&echo-ne"\033[31mError! \033[0mGet debian mirror directory fail! \n"&&exit1

wget--no-check-certificate-qO'/boot/initrd.gz'"http://$DebianMirror$DebianMirrorDirectory/dists/$vDEB/main/installer-$VER/current/images/netboot/$linuxdists-installer/$VER/initrd.gz"

[$?-ne'0']&&echo-ne"\033[31mError! \033[0mDownload 'initrd.gz' failed! \n"&&exit1

wget--no-check-certificate-qO'/boot/linux'"http://$DebianMirror$DebianMirrorDirectory/dists/$vDEB/main/installer-$VER/current/images/netboot/$linuxdists-installer/$VER/linux"

[$?-ne'0']&&echo-ne"\033[31mError! \033[0mDownload 'linux' failed! \n"&&exit1

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"$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\}')"

IPv4="$(echo -n "$IPSUB" |cut -d'/' -f1)"

NETSUB="$(echo -n "$IPSUB" |grep -o '/[0-9]\{1,2\}')"

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"$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)"

[-n"$GATE"]&&[-n"$MASK"]&&[-n"$IPv4"]||{

echo"Not found `ip command`, It will use `route command`."

ipNum(){

localIFS='.'

readip1ip2ip3ip4<<

echo$((ip1*(1<<24)+ip2*(1<<16)+ip3*(1<<8)+ip4))

}

SelectMax(){

ii=0

forIPITEMin`route-n|awk-vOUT=$1'{print $OUT}'|grep'[0-9]\{1,3\}.[0-9]\{1,3\}.[0-9]\{1,3\}.[0-9]\{1,3\}'`

do

NumTMP="$(ipNum $IPITEM)"

eval"arrayNum[$ii]='$NumTMP,$IPITEM'"

ii=$[$ii+1]

done

echo${arrayNum[@]}|sed's/\s/\n/g'|sort-n-k1-t','|tail-n1|cut-d','-f2

}

[[-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)"

[[-z$GATE]]&&GATE="$(SelectMax 2)"

[[-z$MASK]]&&MASK="$(SelectMax 3)"

[-n"$GATE"]&&[-n"$MASK"]&&[-n"$IPv4"]||{

echo"Error! Not configure network. "

exit1

}

}

[-f/etc/network/interfaces]&&{

[[-z"$(sed -n '/iface.*inet static/p' /etc/network/interfaces)"]]&&AutoNet='1'||AutoNet='0'

[-d/etc/network/interfaces.d]&&{

ICFGN="$(find /etc/network/interfaces.d -name '*.cfg' |wc -l)"||ICFGN='0'

["$ICFGN"-ne'0']&&{

forNetCFGin`ls-1/etc/network/interfaces.d/*.cfg`

do

[[ -z "$(cat $NetCFG | sed -n '/iface.*inet static/p')" ]] && AutoNet='1' || AutoNet='0'

[ "$AutoNet" -eq '0' ] && break

done

}

}

}

[ -d /etc/sysconfig/network-scripts ] && {

ICFGN="$(find /etc/sysconfig/network-scripts -name 'ifcfg-*' |grep -v 'lo'|wc -l)" || ICFGN='0'

[ "$ICFGN" -ne '0' ] && {

for NetCFG in `ls -1 /etc/sysconfig/network-scripts/ifcfg-* |grep -v 'lo$' |grep -v ':[0-9]\{1,\}'`

do

[[ -n "$(cat $NetCFG | sed -n '/BOOTPROTO.*[dD][hH][cC][pP]/p')" ]] && AutoNet='1' || {

AutoNet='0' && . $NetCFG

[ -n $NETMASK ] && MASK="$NETMASK"

[ -n $GATEWAY ] && GATE="$GATEWAY"

}

[ "$AutoNet" -eq '0' ] && break

done

}

}

[ ! -f $GRUBDIR/$GRUBFILE ] && echo "Error! Not Found $GRUBFILE. " && exit 1

[ ! -f $GRUBDIR/$GRUBFILE.old ] && [ -f $GRUBDIR/$GRUBFILE.bak ] && mv -f $GRUBDIR/$GRUBFILE.bak $GRUBDIR/$GRUBFILE.old

mv -f $GRUBDIR/$GRUBFILE $GRUBDIR/$GRUBFILE.bak

[ -f $GRUBDIR/$GRUBFILE.old ] && cat $GRUBDIR/$GRUBFILE.old >$GRUBDIR/$GRUBFILE || cat $GRUBDIR/$GRUBFILE.bak >$GRUBDIR/$GRUBFILE

[ "$GRUBOLD" == '0' ] && {

CFG0="$(awk '/menuentry /{print NR}' $GRUBDIR/$GRUBFILE|head -n 1)"

CFG2="$(awk '/menuentry /{print NR}' $GRUBDIR/$GRUBFILE|head -n 2 |tail -n 1)"

CFG1=""

for CFGtmp in `awk '/}/{print NR}' $GRUBDIR/$GRUBFILE`

do

[ $CFGtmp -gt "$CFG0" -a $CFGtmp -lt "$CFG2" ] && CFG1="$CFGtmp";

done

[ -z "$CFG1" ] && {

echo "Error! read $GRUBFILE. "

exit 1

}

sed -n "$CFG0,$CFG1"p $GRUBDIR/$GRUBFILE >/tmp/grub.new

[ -f /tmp/grub.new ] && [ "$(grep -c '{' /tmp/grub.new)" -eq "$(grep -c '}' /tmp/grub.new)" ] || {

echo -ne "\033[31mError! \033[0mNot configure $GRUBFILE. \n"

exit 1

}

sed -i "/menuentry.*/c\menuentry\\'InstallOS\[$vDEB\$VER\]\'\--classdebian\--class\gnu-linux\--class\gnu\--class\os\\{" /tmp/grub.new

[ "$(grep-c'{'/tmp/grub.new)" -eq "$(grep-c'}'/tmp/grub.new)" ] || {

echo "Error!configureappend$GRUBFILE."

exit 1

}

sed -i "/echo.*Loading/d" /tmp/grub.new

}

[ "$GRUBOLD" == '1' ] && {

CFG0="$(awk'/title /{print NR}'$GRUBDIR/$GRUBFILE|head-n1)"

CFG1="$(awk'/title /{print NR}'$GRUBDIR/$GRUBFILE|head-n2|tail-n1)"

[ -n $CFG0 ] && [ -z $CFG1 -o $CFG1 == $CFG0 ] && sed -n "$CFG0,$"p $GRUBDIR/$GRUBFILE >/tmp/grub.new

[ -n $CFG0 ] && [ -z $CFG1 -o $CFG1 != $CFG0 ] && sed -n "$CFG0,$CFG1"p $GRUBDIR/$GRUBFILE >/tmp/grub.new

[ ! -f /tmp/grub.new ] && echo "Error!configureappend$GRUBFILE." && exit 1

sed -i "/title.*/c\title\\'InstallOS\[$vDEB\$VER\]\'" /tmp/grub.new

sed -i '/^#/d' /tmp/grub.new

}

[ -n "$(grep'initrd.*/'/tmp/grub.new|awk'{print $2}'|tail-n1|grep'^/boot/')" ] && Type='InBoot' || Type='NoBoot'

LinuxKernel="$(grep'linux.*/'/tmp/grub.new|awk'{print $1}'|head-n1)"

[ -z $LinuxKernel ] && LinuxKernel="$(grep'kernel.*/'/tmp/grub.new|awk'{print $1}'|head-n1)"

LinuxIMG="$(grep'initrd.*/'/tmp/grub.new|awk'{print $1}'|tail-n1)"

[ "$Type" == 'InBoot' ] && {

sed -i "/$LinuxKernel.*\//c\\\t$LinuxKernel\\t\/boot\/linux auto=true hostname=$linuxdists domain= -- quiet" /tmp/grub.new

sed-i"/$LinuxIMG.*\//c\\\t$LinuxIMG\\t\/boot\/initrd.gz"/tmp/grub.new

}

["$Type"=='NoBoot']&&{

sed-i"/$LinuxKernel.*\//c\\\t$LinuxKernel\\t\/linux auto=true hostname=$linuxdists domain= -- quiet"/tmp/grub.new

sed-i"/$LinuxIMG.*\//c\\\t$LinuxIMG\\t\/initrd.gz"/tmp/grub.new

}

sed-i'$a\\n'/tmp/grub.new

["$inVNC"=='n']&&{

GRUBPATCH='0'

[-f/etc/network/interfaces-o-d/etc/sysconfig/network-scripts]&&{

sed-i''${CFG0}'i\\n'$GRUBDIR/$GRUBFILE

sed-i''${CFG0}'r /tmp/grub.new'$GRUBDIR/$GRUBFILE

[-z$AutoNet]&&echo"Error, Not found interfaces config."&&exit1

[-f$GRUBDIR/grubenv]&&sed-i's/saved_entry/#saved_entry/g'$GRUBDIR/grubenv

[-d/boot/tmp]&&rm-rf/boot/tmp

mkdir-p/boot/tmp/

cd/boot/tmp/

gzip-d<..>>/dev/null2>&1

cat>/boot/tmp/preseed.cfg<

d-idebian-installer/localestringen_US

d-iconsole-setup/layoutcodestringus

d-ikeyboard-configuration/xkb-keymapstringus

d-inetcfg/choose_interfaceselectauto

d-inetcfg/disable_autoconfigbooleantrue

d-inetcfg/dhcp_failednote

d-inetcfg/dhcp_optionsselectConfigurenetworkmanually

d-inetcfg/get_ipaddressstring$IPv4

d-inetcfg/get_netmaskstring$MASK

d-inetcfg/get_gatewaystring$GATE

d-inetcfg/get_nameserversstring8.8.8.8

d-inetcfg/no_default_routebooleantrue

d-inetcfg/confirm_staticbooleantrue

d-imirror/countrystringmanual

d-imirror/http/hostnamestring$DebianMirror

d-imirror/http/directorystring$DebianMirrorDirectory

d-imirror/http/proxystring

d-ipasswd/root-loginbooleanture

d-ipasswd/make-userbooleanfalse

d-ipasswd/root-passwordpassword$myPASSWORD

d-ipasswd/root-password-againpassword$myPASSWORD

d-iuser-setup/allow-password-weakbooleantrue

d-iuser-setup/encrypt-homebooleanfalse

d-iclock-setup/utcbooleantrue

d-itime/zonestringUS/Eastern

d-iclock-setup/ntpbooleantrue

d-ipartman/early_commandstring\

debconf-setpartman-auto/disk"\$(list-devices disk |head -n1)";\

debconf-setgrub-installer/bootdevstring"\$(list-devices disk |head -n1)";\

umount/media||true;

d-ipartman/mount_styleselectuuid

d-ipartman-auto/init_automatically_partitionselectGuided-useentiredisk

d-ipartman-auto/methodstringregular

d-ipartman-lvm/device_remove_lvmbooleantrue

d-ipartman-md/device_remove_mdbooleantrue

d-ipartman-auto/choose_recipeselectatomic

d-ipartman-partitioning/confirm_write_new_labelbooleantrue

d-ipartman/choose_partitionselectfinish

d-ipartman-lvm/confirmbooleantrue

d-ipartman-lvm/confirm_nooverwritebooleantrue

d-ipartman/confirmbooleantrue

d-ipartman/confirm_nooverwritebooleantrue

d-idebian-installer/allow_unauthenticatedbooleantrue

taskseltasksel/firstmultiselectminimal

d-ipkgsel/update-policyselectnone

d-ipkgsel/includestringopenssh-server

d-ipkgsel/upgradeselectnone

popularity-contestpopularity-contest/participatebooleanfalse

d-igrub-installer/only_debianbooleantrue

d-igrub-installer/bootdevstringdefault

d-ifinish-install/reboot_in_progressnote

d-idebian-installer/exit/rebootbooleantrue

d-ipreseed/late_commandstring\

sed-i's/^.*PermitRootLogin.*/PermitRootLogin yes/g'/target/etc/ssh/sshd_config;\

sed-i's/^.*PasswordAuthentication.*/PasswordAuthentication yes/g'/target/etc/ssh/sshd_config;

EOF

["$AutoNet"-eq'1']&&{

sed-i'/netcfg\/disable_autoconfig/d'/boot/tmp/preseed.cfg

sed-i'/netcfg\/dhcp_options/d'/boot/tmp/preseed.cfg

sed-i'/netcfg\/get_.*/d'/boot/tmp/preseed.cfg

sed-i'/netcfg\/confirm_static/d'/boot/tmp/preseed.cfg

}

["$vDEB"=='trusty']&&GRUBPATCH='1'

["$vDEB"=='wily']&&GRUBPATCH='1'

["$GRUBPATCH"=='1']&&{

sed-i's/^d-i\ grub-installer\/bootdev\ string\ default//g'/boot/tmp/preseed.cfg

}

["$GRUBPATCH"=='0']&&{

sed-i's/debconf-set\ grub-installer\/bootdev.*\"\;//g'/boot/tmp/preseed.cfg

}

["$linuxdists"=='debian']&&{

sed-i'/user-setup\/allow-password-weak/d'/boot/tmp/preseed.cfg

sed-i'/user-setup\/encrypt-home/d'/boot/tmp/preseed.cfg

sed-i'/pkgsel\/update-policy/d'/boot/tmp/preseed.cfg

sed-i's/umount\ \/media.*\;//g'/boot/tmp/preseed.cfg

}

rm-rf../initrd.gz

find.|cpio-Hnewc--create--verbose|gzip-9>../initrd.gz

rm-rf/boot/tmp

}

}

["$inVNC"=='y']&&{

sed-i'$i\\n'$GRUBDIR/$GRUBFILE

sed-i'$r /tmp/grub.new'$GRUBDIR/$GRUBFILE

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"

echo-e"\033[35mIPv4\t\tNETMASK\t\tGATEWAY\033[0m"

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"

read-n1-p"Press Enter to reboot..."INP

if["$INP"!=''];then

echo-ne'\b \n'

echo"";

fi

}

chownroot:root$GRUBDIR/$GRUBFILE

chmod444$GRUBDIR/$GRUBFILE

sleep3&&reboot>/dev/null2>&1

No related posts.

本文标签: 一键脚本重装系统网络ASP